/* ─────────────────────────────────────────────────────────────
   Facturando — Auth CSS
   Tipografías: DM Serif Display (headlines) + DM Sans (UI)
   Paleta: Índigo profundo + crema cálido + acentos emerald
───────────────────────────────────────────────────────────── */

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

:root {
    --brand:        #4338CA;
    --brand-dark:   #312E81;
    --brand-light:  #EEF2FF;
    --accent:       #10B981;
    --cream:        #FAF9F6;
    --ink:          #1C1917;
    --ink-muted:    #78716C;
    --ink-faint:    #A8A29E;
    --border:       #E7E5E4;
    --danger:       #DC2626;
    --danger-bg:    #FEF2F2;
    --success-bg:   #F0FDF4;
    --success:      #16A34A;
    --radius:       12px;
    --radius-sm:    8px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:    0 4px 16px rgba(0,0,0,.1), 0 2px 6px rgba(0,0,0,.06);
    --transition:   160ms cubic-bezier(.4,0,.2,1);
}

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--cream);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Shell: split layout ────────────────────────────────────── */
.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Panel izquierdo — branding ─────────────────────────────── */
.auth-brand {
    background: var(--brand-dark);
    background-image:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,.35) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(16,185,129,.2) 0%, transparent 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 56px;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Ccircle cx='20' cy='20' r='1' fill='rgba(255,255,255,0.04)'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.brand-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(16,185,129,.4);
}

.logo-text {
    font-size: 22px;
    font-weight: 500;
    color: rgba(255,255,255,.95);
    letter-spacing: -.3px;
}

.brand-headline {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand-tagline {
    font-family: 'DM Serif Display', serif;
    font-size: 38px;
    line-height: 1.2;
    color: #ffffff;
    letter-spacing: -.5px;
}

.brand-sub {
    font-size: 16px;
    color: rgba(255,255,255,.55);
    line-height: 1.6;
    font-weight: 300;
}

.brand-stats {
    display: flex;
    gap: 32px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-num {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--accent);
}

.stat-label {
    font-size: 13px;
    color: rgba(255,255,255,.45);
    font-weight: 300;
}

/* Decorativo: círculo grande semitransparente */
.brand-deco {
    position: absolute;
    bottom: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.07);
    pointer-events: none;
}
.brand-deco::after {
    content: '';
    position: absolute;
    inset: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.05);
}

/* ── Panel derecho — formulario ─────────────────────────────── */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--cream);
}

.auth-form-wrap {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ── Cabecera del formulario ────────────────────────────────── */
.form-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-title {
    font-family: 'DM Serif Display', serif;
    font-size: 30px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -.4px;
}

.form-subtitle {
    font-size: 15px;
    color: var(--ink-muted);
    font-weight: 300;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 8px;
    transition: gap var(--transition);
}
.back-link:hover { gap: 10px; }

/* ── Alertas ────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
}

.alert svg { flex-shrink: 0; margin-top: 1px; }

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(220,38,38,.15);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(22,163,74,.15);
}

/* ── Formulario ─────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Campo ──────────────────────────────────────────────────── */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: .1px;
}

.field-link {
    font-size: 13px;
    color: var(--brand);
    text-decoration: none;
    font-weight: 400;
    transition: color var(--transition);
}
.field-link:hover { color: var(--brand-dark); }

.field-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: #ffffff;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.field-input::placeholder { color: var(--ink-faint); }

.field-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(67,56,202,.12);
}

/* ── Input con toggle password ──────────────────────────────── */
.input-with-toggle {
    position: relative;
}

.input-with-toggle .field-input {
    padding-right: 46px;
}

.toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-faint);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition);
}
.toggle-pw:hover { color: var(--ink-muted); }

/* ── Barra de fortaleza de contraseña ──────────────────────── */
.password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    margin-top: 4px;
    position: relative;
    overflow: hidden;
}

.password-strength::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--sw, 0%);
    background: var(--sc, transparent);
    border-radius: 2px;
    transition: width .3s ease, background .3s ease;
}

.password-strength::after {
    content: attr(data-label);
    position: absolute;
    right: 0;
    top: 6px;
    font-size: 11px;
    color: var(--sc, var(--ink-faint));
    font-weight: 500;
    transition: color .3s ease;
}

/* ── Botones ────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    background: var(--brand);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 2px 8px rgba(67,56,202,.3);
    -webkit-appearance: none;
}

.btn-primary:hover {
    background: var(--brand-dark);
    box-shadow: 0 4px 14px rgba(67,56,202,.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(67,56,202,.25);
}

.btn-full { width: 100%; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-brand {
        display: none;
    }
    .auth-panel {
        padding: 40px 24px;
        align-items: flex-start;
        padding-top: 60px;
    }
}

@media (max-width: 400px) {
    .auth-form-wrap { max-width: 100%; }
}
