/**
 * R4 Banco - Estilos de Pasarela Modal & Elements (Inspirado en Stripe Elements)
 * Estilos aislados e independientes del tema activo de WordPress.
 */

/* ==========================================================================
   Trigger Cards en el Checkout (Aspecto Stripe / Apple Pay)
   ========================================================================== */
.r4-stripe-card-trigger {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin: 10px 0 16px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.r4-stripe-card-trigger:hover {
    border-color: #635bff;
    box-shadow: 0 10px 15px -3px rgba(99, 91, 255, 0.12), 0 4px 6px -2px rgba(99, 91, 255, 0.05);
}

.r4-trigger-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.r4-badge-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #1a1f36;
}

.r4-badge-icon svg, .r4-badge-icon i {
    color: #635bff;
}

.r4-badge-secure {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fdf4;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #bbf7d0;
}

.r4-trigger-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #edf2f7;
    margin-bottom: 14px;
}

.r4-summary-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.r4-summary-value {
    font-size: 13px;
    color: #1e293b;
    font-weight: 600;
}

.r4-btn-open-modal {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100% !important;
    padding: 11px 16px !important;
    background: linear-gradient(180deg, #635bff 0%, #4f46e5 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.25) !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
}

.r4-btn-open-modal:hover {
    background: linear-gradient(180deg, #534be0 0%, #4338ca 100%) !important;
    box-shadow: 0 6px 16px rgba(99, 91, 255, 0.35) !important;
    transform: translateY(-1px);
    color: #fff !important;
}

.r4-btn-open-modal.r4-ready {
    background: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
}

/* ==========================================================================
   Ventana Modal Flotante (Stripe Modal Backdrop & Container)
   ========================================================================== */
.r4-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.r4-modal-backdrop.r4-show {
    display: flex !important;
    opacity: 1;
}

.r4-modal-window {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}

.r4-modal-backdrop.r4-show .r4-modal-window {
    transform: scale(1) translateY(0);
}

/* Header del Modal */
.r4-modal-header {
    background: #ffffff;
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.r4-modal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.r4-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #635bff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.r4-brand-icon img {
    width: 28px;
    height: 28px;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.r4-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}

.r4-modal-subtitle {
    font-size: 12.5px;
    color: #64748b;
    margin: 2px 0 0 0;
}

.r4-modal-close {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s ease;
    padding: 0;
    outline: none;
}

.r4-modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

/* Cuerpo del Modal */
.r4-modal-body {
    padding: 24px;
    max-height: 75vh;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Monto / Total Badge */
.r4-modal-amount-box {
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.r4-modal-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.r4-amount-label {
    font-size: 13.5px;
    color: #64748b;
    font-weight: 500;
}

.r4-amount-val {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
}

.r4-modal-conversion-note {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
    text-align: right;
    width: 100%;
    box-sizing: border-box;
}

.r4-modal-conversion-note strong {
    color: #4338ca;
}

/* Campos de Formulario dentro del Modal */
.r4-form-group {
    margin-bottom: 16px;
    text-align: left;
}

.r4-form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.r4-form-control, 
.r4-form-select {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 11px 14px !important;
    font-size: 14px !important;
    color: #0f172a !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    outline: none !important;
    transition: all 0.15s ease !important;
    font-family: inherit !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    height: auto !important;
}

.r4-form-control:focus, 
.r4-form-select:focus {
    border-color: #635bff !important;
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.18) !important;
}

.r4-form-row-grid {
    display: grid;
    grid-template-columns: 85px 1fr;
    gap: 10px;
}

.r4-form-help {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    display: block;
}

/* Botón de Confirmación dentro del Modal */
.r4-modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
}

.r4-btn-modal-save {
    flex: 1;
    background: #635bff;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(99, 91, 255, 0.2);
    transition: all 0.15s ease;
}

.r4-btn-modal-save:hover {
    background: #4f46e5;
    box-shadow: 0 4px 8px rgba(99, 91, 255, 0.3);
}

.r4-btn-modal-cancel {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.r4-btn-modal-cancel:hover {
    background: #f1f5f9;
}

