:root {
    --primary-color: #0056b3; 
    --primary-red: #e60000;
    --primary-red-hover: #cc0000;
    --bg-body: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #cbd5e1;
    --radius: 8px;
}

/* Solución a la franja lateral vacía (evita que el padding sume ancho extra) */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden; /* Seguridad extra para evitar scroll horizontal */
}

/* Layout Dividido */
.login-split-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- Panel Izquierdo (Slider) --- */
.login-banner {
    position: relative;
    width: 55%;
    overflow: hidden;
    /* Color base por si la imagen tarda en cargar */
    background: linear-gradient(165deg, #001031 0%, #0039a3 100%);
}

.slider-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: fadeSlider 25s infinite;
}

.bg-1 { background-image: url('../img/portadas/portada-1.webp'); animation-delay: 0s; }
.bg-2 { background-image: url('../img/portadas/portada-2.webp'); animation-delay: -20s; }
.bg-3 { background-image: url('../img/portadas/portada-3.webp'); animation-delay: -15s; }
.bg-4 { background-image: url('../img/portadas/portada-4.webp'); animation-delay: -10s; }
.bg-5 { background-image: url('../img/portadas/portada-5.webp'); animation-delay: -5s; }

@keyframes fadeSlider {
    0%   { opacity: 1; }
    16%  { opacity: 1; }
    20%  { opacity: 0; }
    96%  { opacity: 0; }
    100% { opacity: 1; }
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* DEGRADADO MUY NOTORIO: Negro profundo casi sólido arriba a la izq -> Azul vibrante translúcido abajo a la der */
    background: linear-gradient(135deg, rgba(0, 20, 46, 0.95) 0%, rgba(1, 62, 153, 0.4) 100%);
    z-index: 1;
}

.banner-content {
    position: relative;
    z-index: 2;
    padding: 3rem;
}

.banner-logo {
    max-width: 180px;
    height: auto;
}

/* --- Panel Derecho (Formulario) --- */
.login-form-section {
    width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.text-center {
    text-align: center;
}

.login-header {
    margin-bottom: 2.5rem;
}

.form-logo {
    max-width: 250px;
    margin-bottom: 1.5rem;
    padding: 0.5rem 2rem; 
    border: 1px solid var(--border-color);
    border-radius: 12px; 
    background-color: #ffffff; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.login-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #111827;
}

.login-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #334155;
}

.required {
    color: var(--primary-red);
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-group input::placeholder {
    color: #94a3b8;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-text {
    display: block;
    color: var(--primary-red);
    font-size: 0.75rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.btn-login {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.5rem;
}

.btn-login:hover {
    background: var(--primary-red-hover);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- Loaders (Modal e Inicial) --- */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-modal {
    width: 180px;
    height: 180px;
    background: white;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.loader-modal.shadow-none {
    box-shadow: none;
}

.spinner {
    position: absolute;
    width: 140px;
    height: 140px;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-bottom-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.loader-logo {
    width: 75px;
    height: auto;
    z-index: 10;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* --- Toast Notification (Elegante y Sutil) --- */
.toast-notification {
    position: fixed;
    top: 24px;
    left: -400px; /* Oculto fuera de la pantalla a la izquierda */
    width: 320px;
    background-color: #ffffff;
    border-left: 4px solid var(--primary-red);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border-radius: var(--radius);
    display: flex;
    align-items: flex-start;
    padding: 16px;
    z-index: 10001; /* Por encima de todo */
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.show {
    transform: translateX(424px); /* Se mueve a la posición left: 24px (400 + 24) */
}

.toast-icon {
    flex-shrink: 0;
    margin-right: 12px;
    color: var(--primary-red);
}

.toast-icon svg {
    width: 24px;
    height: 24px;
}

.toast-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    transition: color 0.2s;
}

.toast-close:hover {
    color: var(--text-main);
}

/* --- Responsividad --- */
@media (max-width: 900px) {
    .login-split-container {
        flex-direction: column;
    }
    
    .login-banner {
        width: 100%;
        height: 35vh;
        min-height: 250px;
    }
    
    .login-form-section {
        width: 100%;
        padding: 3rem 1.5rem;
    }

    /* Ocultar logo del formulario en pantallas pequeñas */
    .form-logo {
        display: none;
    }
    
    .banner-content {
        padding: 2rem; 
    }
    
    .banner-logo {
        max-width: 160px;
    }
}

/* Ajuste de Toast en móviles para que no se corte */
@media (max-width: 500px) {
    .toast-notification.show {
        transform: translateX(calc(400px + 5vw)); 
        width: 90vw;
    }
}