/* ===== TOTOSCORE — pagine account (login, registrazione, reset…) ===========
   Stessa identità dell'app: verde scuro + menta, Poppins per i titoli, Inter
   per il testo. Desktop: schermo diviso (marchio e regole a sinistra, modulo
   a destra). Telefono: solo il modulo, su fondo bianco.
   ========================================================================= */
:root {
    --green-950: #04231a;
    --green-900: #062a20;
    --green-800: #0a3a2c;
    --green-700: #0e4d39;
    --green-600: #12805a;
    --mint: #46e0a0;
    --white: #ffffff;
    --ink: #0b1f18;
    --muted: #566a61;
    --soft: #c3d6cc;
    --field-border: #cfded5;
    --danger: #9a3412;
    --danger-bg: #fff1e8;
    --success-bg: #e8f8f0;
    --surface: #ffffff;            /* fondo del modulo e dei campi (il bianco del testo resta --white) */
    --link: #0e4d39;
    --line: #dfe7e2;
    --hover: #f3f6f4;
    --text-2: #33443d;
    --tint: #d3f5e6;
    --tint-ink: #0a3a2c;
    color-scheme: light;
    --font:"Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-title: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; }

body.auth-body {
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    color: var(--ink);
    background: var(--surface);
}

/* ── Pannello del marchio (solo desktop) ─────────────────────────────── */
.auth-side { display: none; }
@media (min-width: 992px) {
    .auth-side {
        flex: 1 1 50%; display: flex; flex-direction: column; gap: 40px;
        padding: 48px 56px; background: var(--green-950); color: var(--white);
        position: sticky; top: 0; min-height: 100vh;
    }
}
.auth-side-brand { font-family: var(--font-title); font-weight: 700; font-size: 24px; letter-spacing: .5px; color: var(--white); text-decoration: none; }
.auth-side-brand b { color: var(--mint); font-weight: 700; }
.auth-side-claim { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.auth-side-claim h2 { font-family: var(--font-title); font-size: 40px; line-height: 1.15; font-weight: 700; }
.auth-side-claim p { font-size: 17px; line-height: 1.5; color: var(--soft); }
.auth-side-passi { list-style: none; display: flex; flex-direction: column; gap: 18px; max-width: 520px; }
.auth-side-passi li { display: flex; gap: 14px; align-items: flex-start; font-size: 14px; color: var(--soft); line-height: 1.45; }
.auth-side-passi li > span {
    flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--green-700); color: var(--mint);
    display: flex; align-items: center; justify-content: center; font: 700 14px var(--font-title);
}
.auth-side-passi strong { display: block; font-size: 16px; color: var(--white); margin-bottom: 2px; }
.auth-side-esempio {
    margin-top: auto; align-self: flex-start; display: flex; align-items: center; gap: 18px;
    background: var(--green-900); border: 1px solid var(--green-700); border-radius: 18px; padding: 16px 18px;
}
.auth-side-esempio div { display: flex; flex-direction: column; gap: 2px; }
.auth-side-esempio small { font-size: 12px; color: var(--soft); }
.auth-side-esempio b { font-family: var(--font-title); font-size: 26px; font-weight: 700; }
.auth-side-esempio em { font-style: normal; padding: 6px 12px; border-radius: 8px; background: var(--mint); color: var(--green-950); font-size: 13px; font-weight: 700; }

/* ── Area del modulo ──────────────────────────────────────────────────── */
.auth-main {
    flex: 1 1 50%; min-width: 0; display: flex; align-items: center; justify-content: center;
    padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
}
@media (min-width: 992px) { .auth-main { padding: 48px 32px; } }

.auth-card { width: 100%; max-width: 420px; animation: auth-in .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes auth-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Header / wordmark ────────────────────────────────────────────────── */
.auth-header { margin-bottom: 24px; }
.auth-brand {
    display: inline-block; font-family: var(--font-title); font-weight: 700; letter-spacing: .5px; font-size: 22px;
    color: var(--green-900); text-decoration: none; margin-bottom: 28px;
}
.auth-brand b { color: var(--green-600); font-weight: 700; }
@media (min-width: 992px) { .auth-brand { display: none; } }
.auth-header h1 { font-family: var(--font-title); font-size: 28px; font-weight: 700; color: var(--ink); margin-bottom: 6px; letter-spacing: -.01em; line-height: 1.2; }
@media (min-width: 992px) { .auth-header h1 { font-size: 30px; } }
.auth-header p { color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ── Google button ────────────────────────────────────────────────────── */
.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; min-height: 52px; padding: 0 16px;
    background: var(--surface); border: 1px solid var(--field-border); border-radius: 14px;
    color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: border-color .15s, background .15s;
}
.btn-google:hover { border-color: var(--green-600); background: var(--hover); color: var(--ink); }

/* ── Divider ──────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ── Form ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--ink); font-size: 14px; font-weight: 600; margin-bottom: 6px;
}
.form-control {
    width: 100%; min-height: 52px; padding: 0 14px;
    background: var(--surface); border: 1px solid var(--field-border); border-radius: 12px;
    color: var(--ink); font-size: 16px; font-family: inherit; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: #9fb1a8; }
.form-control:focus { border-color: var(--green-600); box-shadow: 0 0 0 4px rgba(18, 128, 90, .14); }
.form-control.input-validation-error { border-color: var(--danger); }

/* ── Campo password con toggle mostra/nascondi ────────────────────────── */
.password-field { position: relative; }
.password-field .form-control { padding-right: 52px; }
.password-toggle {
    position: absolute; top: 0; right: 0; height: 100%; width: 52px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--muted); border-radius: 0 12px 12px 0; transition: color .15s;
}
.password-toggle:hover { color: var(--link); }
.password-toggle:focus-visible { outline: 2px solid var(--green-600); outline-offset: -2px; }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* ── Checkbox ─────────────────────────────────────────────────────────── */
.form-check { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; min-height: 32px; }
.form-check-input { width: 20px; height: 20px; accent-color: var(--green-600); cursor: pointer; }
.form-check-label { color: var(--muted); font-size: 14px; cursor: pointer; }

/* ── Primary button ───────────────────────────────────────────────────── */
.btn-primary {
    width: 100%; min-height: 52px; padding: 0 16px; border: none; border-radius: 14px;
    background: var(--green-900); color: var(--white);
    font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
    transition: background .15s;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn-primary:hover { background: var(--green-700); color: var(--white); }
/* spento dopo il primo invio (vedi _AuthLayout): si vede che la richiesta è partita */
.btn-primary:disabled { opacity: .65; cursor: progress; }

/* ── Nota sotto il pulsante (es. informativa privacy nella registrazione) ─ */
.auth-note { margin-top: 14px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-note a { color: var(--link); font-weight: 600; }

/* ── Links & footer ───────────────────────────────────────────────────── */
.forgot-link { color: var(--link); font-size: 13px; font-weight: 600; text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--muted); font-size: 14px; }
.auth-footer a { color: var(--link); text-decoration: none; font-weight: 700; }
.auth-footer a:hover { text-decoration: underline; }

/* ── Validation / alert ───────────────────────────────────────────────── */
.field-error { display: block; color: var(--danger); font-size: 13px; margin-top: 5px; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 16px; line-height: 1.45; }
.alert:empty { display: none; }
.alert-danger { background: var(--danger-bg); border: 1px solid var(--danger-line, #f6d4bd); color: var(--danger); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success-line, #c5ebd9); color: var(--tint-ink); }

/* ── Torna indietro, esiti (email inviata, password aggiornata…), link secondari ── */
.auth-indietro {
    display: inline-flex; align-items: center; gap: 4px; height: 44px; margin: 0 0 10px -4px; padding: 0 6px 0 2px;
    color: var(--link); font-size: 14px; font-weight: 600; text-decoration: none;
}
.auth-indietro:hover { text-decoration: underline; }
.auth-esito { display: flex; flex-direction: column; gap: 12px; }
.auth-esito-ico {
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--tint); color: var(--tint-ink);
}
.auth-esito.is-errore .auth-esito-ico { background: var(--danger-bg); color: var(--danger); }
.auth-esito h2 { font-family: var(--font-title); font-size: 18px; font-weight: 700; color: var(--ink); }
.auth-esito p { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.auth-link-sec {
    display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 4px;
    color: var(--link); font-size: 14px; font-weight: 600; text-decoration: none;
}
.auth-link-sec:hover { text-decoration: underline; }

/* ── Telefono e tablet (come nel mockup): fondo verde scuro, intestazione chiara,
   modulo in una card bianca. Da 992px c'è lo schermo diviso con il pannello del marchio. ── */
@media (max-width: 991.98px) {
    body.auth-body { background: var(--green-950); }
    .auth-main { align-items: flex-start; padding: 28px 16px calc(28px + env(safe-area-inset-bottom)); }
    .auth-header { padding: 0 4px; margin-bottom: 22px; }
    .auth-brand { color: var(--white); margin-bottom: 18px; }
    .auth-brand b { color: var(--mint); }
    .auth-header h1 { color: var(--white); }
    .auth-header p { color: var(--soft); }
    .auth-box {
        background: var(--surface); border-radius: 22px; padding: 22px 18px;
        box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6);
    }
    .auth-footer { color: var(--soft); }
    .auth-footer a { color: var(--mint); }
    .auth-indietro { color: var(--white); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card { animation: none; }
}

/* ── Tema scuro (stessa scelta dell'app: data-theme su <html>, vedi _AuthLayout) ── */
:root[data-theme="dark"] {
    color-scheme: dark;
    --surface: #12201a;
    --ink: #e3eee8;
    --muted: #9ab0a5;
    --field-border: #304b3f;
    --link: #5fdca4;
    --line: #24382f;
    --hover: #1c2f27;
    --text-2: #c4d4cb;
    --tint: #133d2e;
    --tint-ink: #bdebd5;
    --danger: #ffb38a;
    --danger-bg: #3b1d0f;
    --danger-line: #6a3418;
    --success-bg: #12352a;
    --success-line: #1f5a43;
}
[data-theme="dark"] .auth-brand { color: var(--white); }
[data-theme="dark"] .auth-brand b { color: var(--mint); }
[data-theme="dark"] .btn-primary { background: var(--mint); color: var(--green-950); }
[data-theme="dark"] .btn-primary:hover { background: #6ae9b3; color: var(--green-950); }
[data-theme="dark"] .form-control::placeholder { color: #6f857b; }
@media (min-width: 992px) {
    [data-theme="dark"] .auth-main { border-left: 1px solid var(--line); }
}
