/* --- VARIABLES & THEME CONFIGURATION --- */
:root {
    /* Brand Colors */
    --brand-dark: #383e4e;
    --brand-grey: #b6bac5;
    --brand-accent: #383e4e;
    --brand-green: #04f57c;
    --error: #ff4d4d;
    
    /* Light Theme Defaults (Modo Claro) */
    --bg-body: #F9FAFB;
    --bg-panel: #FFFFFF;
    --bg-input: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border-subtle: rgba(0, 0, 0, 0.1);
    --border-input: rgba(0, 0, 0, 0.15);
    
    /* Decoration & UI */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-float: 0 4px 15px rgba(0,0,0,0.1);
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --font-main: 'Funnel Display', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Dark Theme Overrides (Modo Oscuro) */
[data-theme="dark"] {
    --bg-body: #050505;
    --bg-panel: #0a0a0a;
    --bg-input: rgba(255, 255, 255, 0.03);
    --text-main: #ffffff;
    --text-muted: #b6bac5;
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-input: rgba(182, 186, 197, 0.2);
    --brand-accent: #e5fcf9;
    --shadow-float: 0 4px 15px rgba(0,0,0,0.5);
}

/* --- RESET & BASICS --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- LAYOUT --- */
.auth-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.auth-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

/* --- BRANDING PANEL (Left) --- */
.branding-panel {
    width: 45%;
    background-color: var(--bg-panel);
    position: relative;
    padding: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
    z-index: 1;
}

.panel-bg-decoration {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, var(--border-subtle), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.branding-content-wrapper { z-index: 2; position: relative; }

/* Logo Logic: Invertir en light mode si el logo original es blanco */
.auth-logo {
    height: 80px;
    width: auto;
    filter: invert(1); /* Default (Light Mode): Se vuelve negro */
    transition: filter 0.3s ease;
    margin-left: -60px;
    
}
[data-theme="dark"] .auth-logo {
    filter: none; /* Dark Mode: Se queda blanco original */
}

.branding-title {
    font-size: 3.5vw;
    line-height: 1.1;
    color: var(--text-main);
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.branding-title .highlight { color: var(--text-muted); }

.branding-text {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.7;
    opacity: 0.9;
}

/* Feature Cards */
.system-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 30px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 30px;
}

.feature-card {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    padding: 15px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-smooth);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    border-color: var(--text-muted);
}

.f-icon-box {
    width: 36px;
    height: 36px;
    background-color: var(--text-main); /* Dinámico según tema */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--bg-panel); /* El icono toma el color del fondo para contraste */
}

.f-svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
}

.f-info { display: flex; flex-direction: column; }
.f-label { font-size: 0.65rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.f-value { font-size: 0.85rem; color: var(--text-main); font-weight: 600; }

/* Branding Footer */
.branding-footer { z-index: 2; margin-top: auto; }
.trust-label { font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 2px; font-weight: 700; margin-bottom: 10px; }
.trust-logos { display: flex; gap: 10px; color: var(--text-muted); font-size: 0.75rem; font-weight: 500; align-items: center; opacity: 0.7; }

/* --- FORM PANEL (Right) --- */
.form-panel {
    width: 55%;
    background-color: var(--bg-body);
    position: relative;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.form-wrapper { width: 100%; max-width: 480px; padding: 40px; }

.form-header { position: absolute; top: 40px; right: 60px; }
.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}
.back-link:hover { color: var(--text-main); }

.form-title { font-size: 2.2rem; font-weight: 600; margin-bottom: 0.5rem; letter-spacing: -0.02em; color: var(--text-main); }
.form-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 1rem; }

/* Inputs */
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 1.5rem; }
.label-row { display: flex; justify-content: space-between; align-items: center; }

label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; }

input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

input:focus {
    outline: none;
    border-color: var(--brand-dark);
    box-shadow: 0 0 0 3px rgba(56, 62, 78, 0.1);
}
[data-theme="dark"] input:focus { border-color: var(--brand-grey); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05); }

/* Buttons */
.submit-btn {
    width: 100%;
    margin-top: 10px;
    padding: 1rem;
    background-color: var(--text-main); /* Invierte: negro en light, blanco en dark */
    color: var(--bg-body);
    border: none;
    border-radius: 100px; /* Pill shape */
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Links */
.link-accent, .forgot-link { color: var(--text-main); text-decoration: none; font-weight: 500; font-size: 0.85rem; transition: opacity 0.2s; }
.link-accent:hover, .forgot-link:hover { opacity: 0.7; text-decoration: underline; }
.form-footer { margin-top: 2rem; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

/* Messages */
.flash-message { padding: 1rem; border-radius: var(--radius-md); font-size: 0.9rem; margin-bottom: 1.5rem; text-align: center; }
.flash-message.error { background: rgba(239, 68, 68, 0.1); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.flash-message.warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.flash-message.success { background: rgba(16, 185, 129, 0.1); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }

/* --- THEME TOGGLE BUTTON --- */
.theme-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-float);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s ease;
}
.theme-float-btn:hover { transform: scale(1.1); }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .auth-container { flex-direction: column; height: auto; min-height: 100vh; }
    .branding-panel { width: 100%; padding: 40px; min-height: 300px; }
    .form-panel { width: 100%; flex: 1; }
    .form-header { position: relative; top: 0; right: 0; margin-bottom: 2rem; text-align: left; }
    .branding-title { font-size: 2.5rem; }
}

/* --- LANGUAGE SWITCHER (Global) --- */
.lang-switch-btn {
    background: none;
    border: none;
    font-family: var(--font-main);
    color: var(--text-muted);
    font-size: 0.8rem; /* Pequeño y discreto */
    cursor: pointer;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0;
    transition: color 0.3s ease;
    letter-spacing: 1px;
}

.lang-switch-btn:hover {
    color: var(--text-main);
}

.lang-opt {
    opacity: 0.5;
    transition: all 0.3s ease;
    font-weight: 500;
}

.lang-opt.active {
    opacity: 1;
    font-weight: 700;
    color: var(--text-main);
}

.separator {
    opacity: 0.3;
}

/* --- LANGUAGE FADE ANIMATIONS --- */
/* Clase que se añade al body durante el cambio */
.lang-changing {
    cursor: wait;
}

/* Estado de desvanecimiento para textos */
.fade-out-text {
    opacity: 0;
    transform: translateY(2px); /* Pequeño desplazamiento hacia abajo */
    filter: blur(2px); /* Efecto desenfoque moderno */
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, filter 0.2s ease-out;
}

/* Soporte para transiciones en elementos que ya tienen transición (inputs) */
input.fade-out-text {
    transition: opacity 0.2s ease-out, border-color 0.3s, box-shadow 0.3s !important;
}

/* Ajuste del Header del Formulario para acomodar el Switcher */
.form-header {
    display: flex;
    align-items: center;
    gap: 30px; /* Separación entre "Return to Base" y el idioma */
}
