/* ================================== */
/* === ESTILOS PARA EL NUEVO LOGIN === */
/* ================================== */

/* --- 1. Variables de Color --- */
:root {
    --color-principal: #02472E;
    --color-texto: #333;
    --color-fondo: #f8f9fa;
    --color-input-border: #e0e0e0;
    --color-input-focus: #02472E;
    --color-placeholder: #999;
    --color-card-background: #ffffff; 
}

/* --- 2. Estilos Base y Fondo --- */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    overflow: hidden; 
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; 
}

/* --- 3. Contenedor Principal --- */
.main-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: calc(100vh - 70px); 
    box-sizing: border-box;
}

.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 820px; /* reducido ligeramente para ajustar tamaño general */
    min-height: 460px; /* altura reducida para tarjeta más compacta */
    background: var(--color-card-background);
    border-radius: 20px; /* bordes un poco más pequeños */
    box-shadow: 0 12px 34px rgba(2, 71, 46, 0.10); /* sombra ajustada */
    overflow: hidden;
}

    /* Mostrar la etiqueta cuando el input está enfocado o tiene contenido */
    .input-field:focus + .input-label,
    .input-field:not(:placeholder-shown) + .input-label {
        display: block;
    }

.login-left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    padding: 1.8rem;
    position: relative;
    border-top-left-radius: 20px; 
    border-bottom-left-radius: 20px;

    /* --- MODO FLASH Y CORRECCIÓN VISUAL --- */
    
    /* 1. Color de respaldo (carga inmediata) */
    background-color: #02472E; 

    /* 2. Tu imagen y el degradado */
    background-image: linear-gradient(180deg, rgba(2,71,46,0.88) 0%, rgba(2,71,46,0.55) 100%), url('imagen/medio1.jpg');
    
    /* 3. Ajustes de posición */
    background-size: cover;
    background-position: center;

    /* 4. IMPORTANTE: Esto arregla el contraste para que no se vea oscurecido */
    background-blend-mode: multiply, normal;
}

.login-left-panel .panel-title { /* Usamos esta clase para el h3 del panel */
    font-family: 'Montserrat', sans-serif;
    font-size: 3rem; /* reducido un poco para ajustar según petición */
    font-weight: 800; /* mantener grosor */
    margin: 0;
    line-height: 1;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.login-left-panel .panel-title .line1 {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 6px;
}
.login-left-panel .panel-title .line2 {
    display: block;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-top: -6px;
}

.login-left-panel .separator {
    width: 50px;
    height: 3px;
    background-color: white;
    margin: 15px auto; 
    border-radius: 2px;
}

.login-left-panel .panel-subtitle { /* Usamos esta clase para el p del panel */
    font-size: 1rem;
    font-weight: 400;
    margin-top: 0.5rem; /* Espacio ajustado */
    opacity: 0.9;
}

/* --- Imagen de Navidad --- */
body.xmas .login-left-panel {
    background-image: linear-gradient(180deg, rgba(2,71,46,0.88) 0%, rgba(2,71,46,0.55) 100%), url('imagen/navidad.png');
    background-size: cover;
    background-position: center;
    /* CAMBIAR ESTO: */
    background-blend-mode: multiply, normal; 
}

/* --- Imagen de Halloween --- */
body.halloween .login-left-panel {
    background-image: linear-gradient(180deg, rgba(2,71,46,0.88) 0%, rgba(2,71,46,0.55) 100%), url('imagen/hallowen.png');
    background-size: cover;
    background-position: center;
    /* CAMBIAR ESTO: */
    background-blend-mode: multiply, normal;
}

/* --- Imagen de Año Nuevo (ESTA ES LA QUE TE ESTÁ MOLESTANDO AHORA) --- */
body.newyear .login-left-panel {
    background-image: linear-gradient(180deg, rgba(2,71,46,0.88) 0%, rgba(2,71,46,0.55) 100%), url('imagen/año.png');
    background-size: cover;
    background-position: center;
    /* CAMBIAR ESTO URGENTE: */
    background-blend-mode: multiply, normal;
}

/* --- Imagen de Fiestas Patrias --- */
body.patria .login-left-panel {
    background-image: linear-gradient(180deg, rgba(2,71,46,0.88) 0%, rgba(2,71,46,0.55) 100%), url('imagen/patria.png');
    background-size: cover;
    background-position: center;
    /* CAMBIAR ESTO: */
    background-blend-mode: multiply, normal;
}

/* --- 5. Panel Derecho (Formulario) --- */
.login-right-panel {
    flex: 1.1; /* Ligeramente más grande que el izquierdo */
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; /* Centrar el formulario verticalmente */
    border-top-right-radius: 22px;
    border-bottom-right-radius: 20px;
}

#login-form {
    width: 100%;
    max-width: 320px; /* formulario ligeramente más estrecho */
    margin: 0 auto;
}

.form-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px; /* Pequeño espacio entre icono y texto */
    color: var(--color-principal);
    margin-bottom: 0.5rem;
}

.form-header i {
    font-size: 1.2rem; /* El icono real se coloca dentro del círculo */
}

.form-header h2 {
    font-size: 1.9rem; /* Título "Bienvenido" más prominente */
    font-weight: 700;
    margin: 0;
}

.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; /* reducido para mantener proporción */
    height: 52px;
    background: var(--color-principal);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(2,71,46,0.10);
    font-size: 1.1rem;
}

.welcome-title {
    color: var(--color-principal);
}

.form-subtitle {
    color: #9aa3a3; /* Tono gris claro similar a la imagen */
    margin: 0 0 2rem 0; /* Espacio debajo */
    font-size: 0.98rem;
    text-align: center;
    max-width: 320px;
}

/* --- 6. Campos del Formulario --- */
.input-group {
    position: relative;
    margin-bottom: 1.5rem; /* Espacio entre campos ajustado */
}


.input-label {
    display: none; /* Mostrar sólo en focus o cuando hay contenido */
    position: absolute;
    left: 14px;
    top: -10px;
    background: #fff;
    padding: 0 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-principal);
    border-radius: 6px;
    line-height: 1;
    z-index: 3;
}

.input-field {
    width: 100%;
    padding: 14px 16px; /* padding normal: sin espacio extra superior */
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    color: var(--color-texto);
    border: 1px solid #e6e6e6;
    background: #fafafa;
    border-radius: 12px; /* Bordes de campo más redondeados */
    box-sizing: border-box; 
    transition: all 0.2s ease;
}

.input-field {
    box-shadow: 0 3px 10px rgba(2,71,46,0.03);
}

.input-field:focus {
    outline: none;
    border-color: var(--color-input-focus);
    box-shadow: 0 0 0 3px rgba(2, 71, 46, 0.1); 
}

/* Si aún hubiese placeholder, mantener color */
.input-field::placeholder {
    color: var(--color-placeholder);
    opacity: 1;
}

/* Ocultar placeholder cuando el label esté visible (al enfocar) */
.input-field:focus::placeholder {
    color: transparent;
}

/* Ojo para contraseña */
.password-toggle {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 16px;
    margin: auto 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-placeholder);
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 2;
}
.password-toggle:hover {
    color: var(--color-principal);
}
.password-toggle svg {
    width: 20px; /* Icono de ojo ajustado */
    height: 20px;
}

/* --- Ocultar el icono nativo de los navegadores (revelar contraseña) --- */
/* Edge / IE */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}
/* Chrome / Opera (WebKit) - intentar ocultar decoraciones nativas */
input[type="password"]::-webkit-textfield-decoration-container {
    display: none !important;
}
/* For good measure, desactivar appearance en el campo para evitar duplicados */
input[type="password"] {
    -webkit-appearance: none;
    appearance: none;
}

/* --- 7. Botón de Login --- */
#login-button {
    display: block; /* Centrar y forma tipo 'pill' */
    margin: 1.5rem auto 0;
    align-items: center;
    justify-content: center;
    padding: 12px 40px; /* Padding mayor para botón tipo pill */
    font-family: 'Poppins', sans-serif;
    font-size: 1rem; /* Tamaño de fuente ajustado */
    font-weight: 600;
    color: #fff;
    background-color: var(--color-principal);
    border: none;
    border-radius: 26px; /* Bordes pill ligeramente más pequeños */
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
    min-width: 180px; /* ancho mínimo reducido */
}

#login-button:hover:not(:disabled) {
    background-color: #013a27; 
    box-shadow: 0 8px 22px rgba(2, 71, 46, 0.14); 
}

/* Si está deshabilitado pero NO está en modo 'loading', mostrará gris */
#login-button:disabled:not(.loading) {
    background-color: #999;
    cursor: not-allowed;
}

/* Estado de carga: mantener color y mostrar cursor wait */
#login-button.loading {
    background-color: var(--color-principal);
    color: #fff;
    cursor: wait;
}

/* Spinner de carga */
.hidden {
    display: none;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
#loading-spinner {
    width: 18px; 
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}

/* Animación de error */
.shake-error {
    animation: shake 0.5s;
    animation-iteration-count: 1;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* --- 8. Responsividad --- */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
        min-height: calc(100vh - 60px); 
    }
    .login-wrapper {
        flex-direction: column; 
        max-width: 420px;
        min-height: auto;
        border-radius: 14px;
    }
    .login-left-panel {
        display: none; /* Oculta el panel izquierdo en móviles */
    }
    .login-right-panel {
        padding: 2rem;
    }
    #login-form {
        max-width: 100%;
    }
    #login-button {
        width: 100%; /* El botón ocupa todo el ancho en móvil */
    }
}

/* --- Estado/animación de éxito para el botón de login --- */
#login-button.success-animate {
    background-color: #28a745 !important; /* verde éxito */
    color: #fff !important;
    box-shadow: 0 12px 30px rgba(40,167,69,0.22);
    transform: translateY(-2px);
    transition: transform 220ms ease, box-shadow 220ms ease, background-color 220ms ease;
}

@keyframes check-pop {
    0% { transform: scale(0.6); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#login-button.success-animate i {
    animation: check-pop 360ms ease forwards;
    font-size: 1.05rem;
}

/* Animación de Temblor (Shake) */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

.input-error-anim {
    animation: errorShake 0.4s ease-in-out;
    border-color: #ff4d4d !important; /* Rojo */
    background-color: #fff5f5 !important; /* Fondo rojizo */
}

/* =========================================================
   PARCHE: SUBIR POSICIÓN DEL LOGIN EN CELULAR
   ========================================================= */
@media (max-width: 768px) {
    .main-container {
        /* 1. Quitamos el centrado vertical automático */
        align-items: flex-start !important; 
        
        /* 2. Definimos la distancia desde el techo */
        /* Cambia '40px' por un número mayor si lo quieres más abajo, 
           o menor si lo quieres más pegado arriba. */
        padding-top: 60px !important; 
        
        /* Mantenemos el padding lateral */
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Opcional: Aseguramos que la tarjeta tenga un margen inferior 
       para que no se pegue al teclado si este se abre */
    .login-wrapper {
        margin-bottom: 2rem !important;
    }
}
