/* ==========================================================================
   LOGIN — CSS único con tokens por marca
   Reemplaza: style_general_neutro.css, style_general.css (bloque auth),
              style_general_leadadgo.css (bloque auth)
   Los demás estilos de style_general.css y style_general_leadadgo.css
   (panel, sidebar, galería, etc.) NO se tocan.
   ========================================================================== */

/* ── Google Fonts (carga solo si la marca las necesita, pero las declaramos
       aquí para que el swap de variables sea inmediato) ──────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════════════════════
   1. TOKENS POR MARCA  (solo :root — cambian vía JS sin recargar hoja)
   ══════════════════════════════════════════════════════════════════════════ */

/* — Neutro (estado por defecto, sin correo detectado) — */
:root {
    --lg-bg:            #f6f7fb;
    --lg-card:          #ffffff;
    --lg-text:          #0f172a;
    --lg-muted:         #64748b;
    --lg-border:        #e2e8f0;
    --lg-btn:           #0f172a;
    --lg-btn-hover:     #1e293b;
    --lg-ring:          rgba(2, 132, 199, .2);
    --lg-focus-border:  #38bdf8;
    --lg-accent:        transparent;   /* barra superior de color */
    --lg-font:          system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --lg-font-title:    system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --lg-shadow:        0 14px 40px rgba(15, 23, 42, .08);
    --lg-forgot:        #334155;
    --lg-link-hover:    #0f172a;
}

/* — QL — (se aplican vía JS: document.documentElement.setAttribute('data-brand','ql')) */
:root[data-brand="ql"] {
    --lg-bg:            #f7f9fb;
    --lg-card:          #ffffff;
    --lg-text:          #0d1b2a;
    --lg-muted:         #5f6b76;
    --lg-border:        #e2e8f0;
    --lg-btn:           #004E98;
    --lg-btn-hover:     #003d78;
    --lg-ring:          rgba(255, 103, 0, .22);
    --lg-focus-border:  #FF6700;
    --lg-accent:        #FF6700;
    --lg-font:          'Poppins', system-ui, sans-serif;
    --lg-font-title:    'Poppins', system-ui, sans-serif;
    --lg-shadow:        0 14px 40px rgba(0, 78, 152, .1);
    --lg-forgot:        #004E98;
    --lg-link-hover:    #FF6700;
}

/* — LeadAdGo — */
:root[data-brand="leadadgo"] {
    --lg-bg:            #f6f7fb;
    --lg-card:          #ffffff;
    --lg-text:          #0d1b2a;
    --lg-muted:         #5f6b76;
    --lg-border:        #dde2f0;
    --lg-btn:           #B73C8E;
    --lg-btn-hover:     #9a2e77;
    --lg-ring:          rgba(183, 60, 142, .25);
    --lg-focus-border:  #B73C8E;
    --lg-accent:        #00A298;
    --lg-font:          'Outfit', system-ui, sans-serif;
    --lg-font-title:    'Outfit', system-ui, sans-serif;
    --lg-shadow:        0 18px 52px rgba(0, 0, 0, .22);
    --lg-forgot:        #1A1449;
    --lg-link-hover:    #B73C8E;
}

/* ══════════════════════════════════════════════════════════════════════════
   2. BASE
   ══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--lg-font);
    background-color: var(--lg-bg);
    color: var(--lg-text);
    /* transición del fondo al cambiar de marca */
    transition: background-color .45s cubic-bezier(.4, 0, .2, 1),
                color .35s ease;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════════════════════════════════════════
   3. LAYOUT CENTRADO
   ══════════════════════════════════════════════════════════════════════════ */

.auth {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

/* ══════════════════════════════════════════════════════════════════════════
   4. LOGO / HEADER DE MARCA
   ══════════════════════════════════════════════════════════════════════════ */

.auth-header {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 52px;
    margin-bottom: 12px;
}

.auth-logo {
    max-width: min(200px, 55vw);
    height: auto;
    max-height: 44px;
    object-fit: contain;
    /* animación de entrada / salida */
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .35s ease .08s,
                transform .35s cubic-bezier(.4, 0, .2, 1) .08s;
    display: block;
}

.auth-logo.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════════
   5. TARJETA
   ══════════════════════════════════════════════════════════════════════════ */

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--lg-card);
    border: 1px solid var(--lg-border);
    border-radius: 20px;
    padding: 28px 24px 24px;
    box-shadow: var(--lg-shadow);
    transition: box-shadow .45s cubic-bezier(.4, 0, .2, 1),
                border-color .35s ease;
    position: relative;
    overflow: hidden;
}

/* barra de acento superior — aparece solo cuando hay marca */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 56px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--lg-accent);
    transition: transform .4s cubic-bezier(.4, 0, .2, 1) .1s,
                background .35s ease;
}

:root[data-brand="ql"] .auth-card::before,
:root[data-brand="leadadgo"] .auth-card::before {
    transform: translateX(-50%) scaleX(1);
}

/* ══════════════════════════════════════════════════════════════════════════
   6. TÍTULO
   ══════════════════════════════════════════════════════════════════════════ */

.card-title {
    margin: 0 0 18px;
    font-family: var(--lg-font-title);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-align: center;
    color: var(--lg-text);
    transition: color .35s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   7. FORMULARIO
   ══════════════════════════════════════════════════════════════════════════ */

.login-form {
    display: grid;
    gap: 12px;
}

/* inputs */
.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 13px;
    border: 1.5px solid var(--lg-border);
    background: #fff;
    outline: none;
    font-size: .97rem;
    font-family: var(--lg-font);
    color: var(--lg-text);
    transition: border-color .25s ease,
                box-shadow .25s ease;
}

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

.login-form input:focus {
    border-color: var(--lg-focus-border);
    box-shadow: 0 0 0 3.5px var(--lg-ring);
}

/* ══════════════════════════════════════════════════════════════════════════
   8. CAMPO CONTRASEÑA — animación max-height (no display:none)
   ══════════════════════════════════════════════════════════════════════════ */

#passwordWrap {
    display: grid;
    gap: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    /* hidden state */
    transition: max-height .38s cubic-bezier(.4, 0, .2, 1),
                opacity .28s ease,
                margin .28s ease;
    margin-bottom: 0;
    position: relative;
}

#passwordWrap.visible {
    max-height: 130px;
    opacity: 1;
    margin-bottom: 0;
}

/* mantener hidden para compatibilidad con JS existente */
#passwordWrap.hidden {
    max-height: 0 !important;
    opacity: 0 !important;
}

/* padding derecho para el ojo */
#password { padding-right: 46px; }

/* ojo */
.toggle-psw {
    position: absolute;
    right: 12px;
    top: 23px;           /* mitad del input de 46px */
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--lg-muted);
    display: flex;
    align-items: center;
    user-select: none;
    transition: color .2s ease;
}
.toggle-psw:hover { color: var(--lg-text); }

.eye-icon { fill: currentColor; display: block; }
.eye-icon.hidden { display: none; }

/* olvidé contraseña */
.forgot-password { text-align: right; }

.forgot-password a {
    color: var(--lg-forgot);
    font-size: .88rem;
    text-decoration: none;
    transition: color .2s ease;
}
.forgot-password a:hover {
    color: var(--lg-link-hover);
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════════════════
   9. BOTÓN
   ══════════════════════════════════════════════════════════════════════════ */

#btnSubmit {
    width: 100%;
    height: 46px;
    border-radius: 13px;
    border: 0;
    background: var(--lg-btn);
    color: #fff;
    font-size: .97rem;
    font-weight: 600;
    font-family: var(--lg-font);
    letter-spacing: .01em;
    cursor: pointer;
    transition: background .35s cubic-bezier(.4, 0, .2, 1),
                transform .07s ease,
                box-shadow .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btnSubmit:hover  { background: var(--lg-btn-hover); }
#btnSubmit:active { transform: translateY(1px); }
#btnSubmit:disabled { opacity: .75; cursor: not-allowed; }

.btn-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════════════════════════
   10. SPINNER
   ══════════════════════════════════════════════════════════════════════════ */

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lg-spin .85s linear infinite;
}

@keyframes lg-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════════
   11. HINT / TEXTO MUTED
   ══════════════════════════════════════════════════════════════════════════ */

.hint, .muted {
    margin: 6px 0 0;
    color: var(--lg-muted);
    font-size: .88rem;
    text-align: center;
    line-height: 1.4;
    transition: color .3s ease;
}

/* ══════════════════════════════════════════════════════════════════════════
   12. TRANSICIÓN SUAVE DEL CONTENEDOR INTERNO
       (fade + micro-slide al cambiar marca)
   ══════════════════════════════════════════════════════════════════════════ */

.auth-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    transition: opacity .3s ease,
                transform .3s cubic-bezier(.4, 0, .2, 1);
}

.auth-inner.switching {
    opacity: 0;
    transform: translateY(5px) scale(.985);
}

/* ══════════════════════════════════════════════════════════════════════════
   13. HELPERS
   ══════════════════════════════════════════════════════════════════════════ */

.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   14. RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .auth-card { padding: 22px 16px 20px; border-radius: 16px; }
    .card-title { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
