/* ==========================================================================
   OVERLAY SSO UNIFICADO: CONTENEDOR PRINCIPAL DE ARRANQUE
   ========================================================================== */

#sso-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1A4B84; /* Azul Institucional Oscuro */
    z-index: 99990; /* Por debajo de firebase-auth-overlay (99999) */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif;
    /* Transición de salida para el revelado de la app */
    transition: opacity 0.4s ease-out;
}

/* Sub-modal activo: visible */
.modal-inicio.activo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Sub-modal oculto: invisible */
.modal-inicio.oculto {
    display: none !important;
}

/* ==========================================================================
   TEMA OSCURO: PANTALLA DE VALIDACIÓN (RED DE SEGURIDAD)
   ========================================================================== */

#firebase-auth-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: #0f172a; /* Gris Pizarra Oscuro 100% opaco */
    z-index: 99999; /* Por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

.firebase-auth-modal {
    position: relative; /* Crucial para posicionar el canvas de fondo */
    overflow: hidden; /* Cortar moléculas que salgan del borde */
    background-color: #1e293b; /* slate-800 */
    border: 1px solid #334155; /* slate-700 */
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

/* El contenido interno debe flotar sobre el canvas de las moléculas */
.firebase-auth-content {
    position: relative;
    z-index: 1; /* Flota sobre el canvas (z-index: 0) */
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
}

/* Cabecera Estructural (Clonable para otras pantallas) */
.modal-header-estructura {
    display: flex; 
    flex-direction: row; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
    border-bottom: 1px solid #334155; 
    padding-bottom: 12px; 
    margin-bottom: 4px;
}

/* Tipografía de Cabecera (Modo Oscuro) */
.modal-title-oscuro {
    font-size: 1.125rem; 
    color: #f8fafc; 
    margin: 0; 
    font-weight: 700; 
    line-height: 1.2;
}

.modal-subtitle-oscuro {
    font-size: 0.875rem; 
    color: #94a3b8; 
    font-weight: 500; 
    display: block; 
    margin-top: 4px;
}
.firebase-auth-input-group:last-of-type {
    margin-bottom: 0px; /* Manejado por el gap del formulario */
}

.firebase-auth-input-group label {
    color: #cbd5e1; /* slate-300 */
    font-size: 0.875rem;
    font-weight: 500;
}

.firebase-auth-input-group input {
    background-color: #020617; /* slate-950 (Vacío espacial) */
    border: 1px solid #334155; /* slate-700 */
    color: #f8fafc;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8); /* Profundidad interna estelar */
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.firebase-auth-input-group input:focus {
    border-color: #2563eb; /* Azul eléctrico */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(37, 99, 235, 0.5); /* Resplandor exterior */
}

/* --- NUEVOS ESTILOS PARA FASE 1 --- */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding-right: 40px; /* Espacio para el botón del ojito */
}

#firebase-password {
    color: #fde047; /* Amarillo de las órbitas del pulsador */
}

.toggle-password-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #10b981; /* Verde corporativo del pulsador */
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password-btn:hover {
    color: #34d399; /* Verde más claro en hover */
}

.firebase-auth-footer {
    text-align: center;
    margin-top: 0px; /* Manejado por el gap del formulario */
}

.firebase-forgot-link {
    color: #4396BE; /* Celeste Andilab institucional */
    font-size: 0.875rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.firebase-forgot-link:hover {
    color: #2b6d8c; /* Celeste oscuro hover */
    text-decoration: underline;
}

.firebase-auth-btn {
    background-color: #1d4ed8; /* Azul Profundo */
    color: white;
    border: none;
    padding: 6px 12px; /* Igualado al botón de registro */
    border-radius: 8px;
    font-size: 0.875rem; /* Igualado a 14px */
    font-weight: 400; /* Texto normal igual a registro */
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0px; /* Sin espacio superior para que quede agrupado con la contraseña */
    width: 100%; /* Asegura que tome todo el ancho disponible al igual que los inputs */
}

.firebase-auth-btn:hover {
    background-color: #1e40af; /* Azul Noche hover */
    color: #fde047; /* Amarillo estelar del pulsador */
}

.firebase-auth-btn:disabled {
    background-color: #475569;
    cursor: not-allowed;
    opacity: 0.7;
}

.firebase-auth-error {
    color: #ef4444; /* red-500 */
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    text-align: center;
    display: none; /* Oculto por defecto */
}

.firebase-register-btn {
    display: inline-block;
    width: auto;
    text-align: center;
    border: 1px solid #1d4ed8;
    background-color: #1d4ed8;
    color: white;
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
    animation: pulse-soft 3.5s infinite;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.firebase-register-btn:hover {
    background-color: #1e40af;
    border-color: #1e40af;
    color: #fde047 !important; /* Amarillo estelar del pulsador */
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
    animation: none;
}

@keyframes pulse-soft {
    0% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(29, 78, 216, 0.4); }
    70% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 8px rgba(29, 78, 216, 0); }
    100% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(29, 78, 216, 0); }
}
/* ==========================================================================
   TEMA CLARO: PANTALLA DE ACTUALIZACIÓN
   ========================================================================== */

.update-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: #1A4B84; /* Azul Institucional Oscuro */
    z-index: 99998; /* Un nivel debajo de validación por si ocurren juntas */
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

.update-modal {
    position: relative; /* Crucial para posicionar el canvas de fondo */
    overflow: hidden; /* Cortar moléculas que salgan del borde */
    background-color: #ffffff; /* Blanco */
    border: 1px solid #e2e8f0; /* slate-200 */
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

/* El contenido interno debe flotar sobre el canvas de las moléculas */
.update-content {
    position: relative;
    z-index: 1; /* Flota sobre el canvas (z-index: 0) */
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
}

/* Cabecera Estructural (Modo Claro) */
.modal-header-estructura-claro {
    display: flex; 
    flex-direction: row; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
    border-bottom: 1px solid #e2e8f0; /* Borde más claro */
    padding-bottom: 12px; 
    margin-bottom: 4px;
}

/* Tipografía de Cabecera (Modo Claro) */
.modal-title-claro {
    font-size: 1.125rem; 
    color: #1e293b; /* slate-800 */
    margin: 0; 
    font-weight: 700; 
    line-height: 1.2;
}

.modal-subtitle-claro {
    font-size: 0.875rem; 
    color: #64748b; /* slate-500 */
    font-weight: 500; 
    display: block; 
    margin-top: 4px;
}

/* Textos de Actualización Centrales */
.update-main-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1A4B84; /* Azul Institucional */
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.update-cycle-text {
    font-size: 0.875rem;
    color: #6b7280; /* gray-500 */
    height: 1.25rem;
    text-align: center;
}
/* ==========================================================================
   ESTILOS COMPONENTE AUTÓNOMO: ORBE PULSANTE CON SATÉLITES
   ========================================================================== */

/* Animación: Pulsación del orbe central (solo expansivo, sin contraer) */
@keyframes orb-pulse-core {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8);
    }
    100% {
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }
}

/* Animación: Órbita de los satélites (sin desvanecimiento) */
@keyframes orbit-satellites {
    from {
        transform: rotate(0deg) translateX(18px) rotate(0deg);
    }
    to {
        transform: rotate(360deg) translateX(18px) rotate(-360deg);
    }
}

/* Contenedor principal del orbe */
.spinner-orb-container {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.8); /* Tamaño estándar acordado para cabeceras */
    margin: 0;
}

/* Núcleo central del Orbe */
.spinner-orb-core {
    width: 16px;
    height: 16px;
    background-color: #10b981; /* Verde Corporativo */
    border-radius: 50%;
    animation: orb-pulse-core 2s infinite;
}

/* Satélites en órbita */
.spinner-orb-satellite {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #fde047; /* Amarillo Corporativo */
    border-radius: 50%;
    animation: orbit-satellites 3s linear infinite;
}
