/* ==========================================
   1. VARIABLES Y ESTILOS BASE
========================================== */
:root {
    --morado: #9b30ff;
    --azul: #3a86ff;
    --oscuro: #2d3436;
    --degradado: linear-gradient(90deg, #9b30ff 0%, #3a86ff 100%);
    --fondo: #f0f2f5;
    --rojo-error: #e53e3e;
    --verde-ok: #38a169;
}

body { font-family: 'Segoe UI', sans-serif; background-color: var(--fondo); margin: 0; padding: 10px; }
.logo-superior { text-align: center; margin: 15px 0; }
.logo-superior img { max-width: 130px; }
.caja-principal { max-width: 650px; margin: 0 auto; background: white; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); overflow: hidden; }

/* ==========================================
   2. BARRAS Y CABECERAS
========================================== */
.barra-navegacion { display: flex; background: #eee; position: relative; height: 50px; }
.progreso-pintado { position: absolute; height: 100%; background: var(--degradado); width: 33.33%; transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1); z-index: 1; }
.paso { flex: 1; z-index: 2; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; color: #888; text-transform: uppercase; }
.paso.activo { color: white; }

.cabecera-cliente { text-align: center; padding: 20px 10px 5px 10px; }
.identidad-cliente { font-size: 20px; font-weight: 800; color: var(--morado); text-transform: uppercase; }
.plan-cliente { display: inline-block; background: #e1f5fe; color: #0288d1; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: bold; margin-top: 5px; }

/* ==========================================
   3. TARJETA PAGO MÓVIL SUPERIOR
========================================== */
.tarjeta-pago-movil { display: flex; justify-content: space-between; align-items: center; background: var(--oscuro); color: white; padding: 15px; margin: 10px; border-radius: 15px; }
.montos-lado { border-right: 1px solid #444; padding-right: 15px; }
.monto-item small { font-size: 9px; color: #aaa; text-transform: uppercase; display: block;}
.monto-item div { font-size: 19px; font-weight: bold; color: #00d4ff; margin-bottom: 5px;}
.datos-banco-lado { display: flex; align-items: center; gap: 12px; }
.datos-texto { font-size: 12px; line-height: 1.4; text-align: right; }
.logo-banco { width: 45px; height: 45px; object-fit: contain; border-radius: 8px; background: white; padding: 2px; }
.btn-copiar { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white; border-radius: 8px; padding: 8px; cursor: pointer; transition: 0.3s;}
.btn-copiar:hover { background: var(--azul); }

/* ==========================================
   4. DISEÑO DE LA TABLA
========================================== */
.tabla-contenedor { overflow-x: auto; margin: 15px 0; border-radius: 12px; border: 1px solid #eef0f5; box-shadow: 0 4px 15px rgba(0,0,0,0.02); background: white; }
table { width: 100%; min-width: 650px; border-collapse: collapse; }

th { background: #f8f9fa; color: #718096; font-size: 11px; padding: 14px 10px; text-align: center; text-transform: uppercase; font-weight: 700; border-bottom: 2px solid #edf2f7; }
td { padding: 15px 10px; border-bottom: 1px solid #f1f3f5; font-size: 13px; vertical-align: middle; color: #4a5568; text-align: center; }
tbody tr { transition: background-color 0.2s ease; }
tbody tr:hover { background-color: #f8fafc; }

th:first-child, td:first-child { width: 40px; }
td:nth-child(2) { text-align: left; }
th:nth-last-child(1), th:nth-last-child(2) { text-align: center; }
td:nth-last-child(1), td:nth-last-child(2) { text-align: right; font-weight: 600; }

.id-factura { font-weight: 800; color: var(--oscuro); font-size: 14px; }
td small { display: block; color: #a0aec0; margin-top: 4px; font-size: 11px; line-height: 1.3; font-weight: 500;}
.monto-bs { color: var(--oscuro); }
.monto-usd { color: #27ae60; }
.check { width: 18px; height: 18px; accent-color: var(--morado); cursor: pointer; transition: transform 0.1s; margin: 0;}
.check:active { transform: scale(0.9); }

.badge-plan { display: inline-block; background: #eef2ff; color: var(--azul); padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid #d0dcfb; }
.periodo-texto { font-family: Arial, sans-serif !important; font-weight: bold !important; font-size: 14px !important; color: #000000 !important; white-space: nowrap; background: #f7fafc; padding: 4px 8px; border-radius: 4px; border: 1px solid #edf2f7; }
.badge-pagada { display: inline-block; background: #f0fff4; color: #38a169; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid #c6f6d5; }

/* ==========================================
   5. CONTROLES GENERALES Y SECCIONES
========================================== */
.seccion { display: none; padding: 20px; }
.seccion.visible { display: block; }
.oculto { display: none; }
.centro { text-align: center; }

.boton { width: 100%; padding: 15px; border: none; border-radius: 12px; font-size: 16px; font-weight: bold; cursor: pointer; transition: 0.3s; margin-top: 10px;}
.boton-azul { background: var(--azul); color: white; }
.boton-morado { background: var(--morado); color: white; }
.boton:disabled { background: #ccc !important; cursor: not-allowed;}
input[type="text"] { width: 100%; padding: 14px; margin: 8px 0; border: 1px solid #ddd; border-radius: 10px; box-sizing: border-box; font-size: 16px;}

.resumen-tarjeta { background: #fdfdfd; border: 2px dashed #eee; padding: 30px; border-radius: 20px; text-align: center; margin-bottom: 20px;}
.icono-exito { font-size: 60px; color: #2ecc71; margin-bottom: 15px; }

.soporte-link { text-align: center; padding: 15px; background: #f8f9fa; border-top: 1px solid #eee; }
.soporte-link a { color: var(--azul); text-decoration: none; font-size: 13px; font-weight: bold; }
.soporte-link a:hover { text-decoration: underline; }

.boton-link { display: block; width: 100%; margin-top: 15px; color: #888; background: none; border: none; cursor: pointer; font-size: 14px; transition: 0.2s; font-weight: bold;}
.boton-link:hover { color: var(--morado); }

/* ==========================================
   6. RESPONSIVIDAD (MÓVILES)
========================================== */
@media (max-width: 480px) {
    .tarjeta-pago-movil { flex-direction: column; gap: 15px; }
    .montos-lado { border-right: none; border-bottom: 1px solid #444; padding-bottom: 15px; padding-right: 0; width: 100%; text-align: center;}
    .datos-texto { text-align: center; }
}

/* ==========================================
   7. ANIMACIONES DE CARGA
========================================== */
@keyframes girar {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.icono-cargando {
    font-size: 18px;
    vertical-align: middle;
    animation: girar 1s linear infinite;
    margin-right: 8px;
}

input[type="text"], input[type="number"], select { width: 100%; padding: 14px; margin: 8px 0; border: 1px solid #ddd; border-radius: 10px; box-sizing: border-box; font-size: 16px; font-family: inherit; background: white;}
input[type="file"] { width: 100%; padding: 12px; margin: 8px 0 15px 0; border: 2px dashed #cbd5e0; border-radius: 10px; box-sizing: border-box; font-size: 14px; background: #f8fafc; cursor: pointer; color: #4a5568;}

/* ==========================================
   8. CAMPO MONTO BLOQUEADO (NUEVO)
========================================== */
.campo-bloqueado {
    background: #f1f3f5 !important;
    color: #555 !important;
    cursor: not-allowed !important;
    font-weight: 700;
    border: 1px solid #d1d5db !important;
}

/* ==========================================
   9. VALIDACIÓN EN TIEMPO REAL (NUEVO)
========================================== */
.campo-grupo {
    position: relative;
    width: 100%;
    text-align: left;
}

.error-campo {
    display: none;
    color: var(--rojo-error);
    font-size: 12px;
    font-weight: 600;
    margin: -4px 0 6px 5px;
    line-height: 1.3;
}

.error-campo.visible {
    display: block;
}

/* Borde rojo cuando el campo tiene error */
.campo-invalido {
    border-color: var(--rojo-error) !important;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.15);
}

/* ==========================================
   10. BOTÓN FINALIZAR CON CARGA (NUEVO)
========================================== */
.boton-cargando {
    pointer-events: none;
    opacity: 0.85;
    position: relative;
}

/* ==========================================
   11. NOTIFICACIÓN DE RESULTADO (NUEVO)
========================================== */
.notificacion-pago {
    margin-top: 15px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.notificacion-pago.oculto {
    display: none;
}

.notificacion-pago.exito {
    background: #f0fff4;
    color: var(--verde-ok);
    border: 1px solid #c6f6d5;
}

.notificacion-pago.error {
    background: #fff5f5;
    color: var(--rojo-error);
    border: 1px solid #fed7d7;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}