/**
 * ============================================================================
 * ARCHIVO: login.css
 * PROYECTO: KORI SPA OS | Gateway de Seguridad
 * ARQUITECTURA: Sinapse OS Enterprise Blueprint (Vanilla JS)
 * ============================================================================
 * Capa estética del sistema de autenticación. Implementa Glassmorphism,
 * fondos dinámicos (Floating Shapes) y controles de formulario premium.
 * ============================================================================
 */

/* ==========================================
   1. VARIABLES DE ENTORNO (LOGIN ROOT)
   ========================================== */
   :root {
    /* Brand Colors (Sincronizados con el ecosistema) */
    --kori-primary: #FF007F; /* Rosa Fucsia / Magenta Vibrante */
    --kori-secondary: #00FFCC; /* Verde Menta / Aqua */
    
    /* Login UI Colors */
    --login-bg-base: #0b0b15; /* Fondo oscuro profundo tecnológico */
    --glass-bg: rgba(20, 20, 35, 0.65); /* Cristal Oscuro */
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-input-bg: rgba(255, 255, 255, 0.05);
    --glass-input-border: rgba(255, 255, 255, 0.15);
    
    --text-main: #FFFFFF;
    --text-muted: #A2A3B7;

    /* Tipografía y Espaciado */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    --transition-fast: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================
   2. RESET Y ESTRUCTURA BASE
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.login-body {
    font-family: var(--font-body);
    background-color: var(--login-bg-base);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Previene scroll por las figuras de fondo */
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================
   3. FONDOS DINÁMICOS (FLOATING SHAPES)
   ========================================== */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 1;
    opacity: 0.6;
}

.shape-primary {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--kori-primary) 0%, rgba(255,0,127,0) 70%);
    top: -10%;
    left: -10%;
    animation: floatShape1 15s infinite alternate ease-in-out;
}

.shape-secondary {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--kori-secondary) 0%, rgba(0,255,204,0) 70%);
    bottom: -15%;
    right: -10%;
    animation: floatShape2 18s infinite alternate-reverse ease-in-out;
}

@keyframes floatShape1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(150px, 100px) scale(1.2); }
}

@keyframes floatShape2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-100px, -150px) scale(1.3); }
}

/* ==========================================
   4. CONTENEDOR PRINCIPAL (GLASSMORPHISM)
   ========================================== */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255,255,255,0.15); /* Reflejo superior */
    border-left: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--border-radius-md);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
}

/* ==========================================
   5. CABECERA DE MARCA
   ========================================== */
.brand-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.brand-logo {
    height: 55px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.os-title {
    font-size: 1.8rem;
    letter-spacing: 2px;
    margin-bottom: 0.2rem;
}

.os-title span {
    color: var(--kori-primary);
}

.os-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================
   6. CONTROLES DE FORMULARIO
   ========================================== */
.auth-form .form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.auth-form label i {
    margin-right: 5px;
    color: var(--kori-primary);
}

.glass-input {
    width: 100%;
    background: var(--glass-input-bg);
    border: 1px solid var(--glass-input-border);
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.2rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.glass-input:focus {
    outline: none;
    border-color: var(--kori-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
}

/* Botón revelar contraseña */
.password-wrapper {
    position: relative;
}

.btn-eye {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 5px;
}

.btn-eye:hover {
    color: var(--kori-secondary);
}

/* ==========================================
   7. OPCIONES Y CHECKBOX PERSONALIZADO
   ========================================== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.text-link {
    color: var(--kori-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.text-link:hover {
    text-decoration: underline;
    color: #FFF;
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    user-select: none;
    color: var(--text-muted);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--glass-input-bg);
    border: 1px solid var(--glass-input-border);
    border-radius: 4px;
    transition: var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--kori-primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--kori-primary);
    border-color: var(--kori-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* ==========================================
   8. BOTONES DE ACCIÓN (CTA)
   ========================================== */
.cta-btn {
    width: 100%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    padding: 1.1rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: linear-gradient(135deg, var(--kori-primary), #cc0066);
    color: #FFF;
    box-shadow: 0 5px 20px rgba(255, 0, 127, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 0, 127, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Efecto de brillo interior en el botón */
.primary-btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.primary-btn:hover::after {
    left: 150%;
}

/* ==========================================
   9. FOOTER DEL LOGIN Y TOASTS
   ========================================== */
.login-footer {
    margin-top: 2rem;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 1.5rem;
}

.back-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.back-link i {
    margin-right: 5px;
}

.back-link:hover {
    color: #FFF;
}

/* Sistema de Toasts (Notificaciones) */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1E1E2D;
    color: #FFF;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    border-left: 4px solid var(--kori-primary);
}

.toast-success { border-color: var(--kori-secondary); }
.toast-success i { color: var(--kori-secondary); }

.toast-error { border-color: #ff3333; }
.toast-error i { color: #ff3333; }

.hidden { display: none !important; }

/* ==========================================
   10. MEDIA QUERIES (MOBILE)
   ========================================== */
@media (max-width: 480px) {
    .glass-panel {
        padding: 2rem 1.5rem;
    }
    
    .os-title {
        font-size: 1.5rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .bg-shape {
        filter: blur(50px); /* Menos blur en móviles para rendimiento */
    }
    
    .shape-primary { width: 300px; height: 300px; }
    .shape-secondary { width: 250px; height: 250px; }
}