/* Pagine PRIMA dell'accesso (login, reimposta password, primo accesso): non usano il
   layout dell'applicativo, quindi hanno un foglio di stile loro. Un solo file per
   tutte: prima ogni pagina ne teneva una copia nel proprio HTML. I colori devono
   restare allineati a quelli di app.css. */

:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-alt: #edf1f6;
    --border: #d7dfe8;
    --text: #16202b;
    --text-muted: #5b6b7a;
    --primary: #2a6f97;
    --primary-hover: #1d5b7c;
    --primary-soft-bg: #e2edf3;
    --alert-success-bg: #e1f0e8;
    --alert-success-border: #2e8b57;
    --alert-success-text: #1f6b41;
    --alert-error-bg: #f9e2de;
    --alert-error-border: #c0453c;
    --alert-error-text: #a5372f;
    --glow-1: rgba(42, 111, 151, 0.22);
    --glow-2: rgba(14, 140, 140, 0.18);
}
[data-theme="dark"] {
    --bg: #0e1621;
    --surface: #16212e;
    --surface-alt: #1d2a39;
    --border: #2a3a4a;
    --text: #e4ebf1;
    --text-muted: #93a3b2;
    --primary: #4b93b9;
    --primary-hover: #63a6c9;
    --primary-soft-bg: #17303f;
    --alert-success-bg: #123326;
    --alert-success-border: #3e9e6e;
    --alert-success-text: #74cf98;
    --alert-error-bg: #3a1e1b;
    --alert-error-border: #d0574d;
    --alert-error-text: #ec8a80;
    --glow-1: rgba(75, 147, 185, 0.18);
    --glow-2: rgba(47, 182, 176, 0.14);
}
* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0; padding: 0;
    background: var(--bg);
    background:
        radial-gradient(900px 520px at 4% -6%, var(--glow-1), transparent 64%),
        radial-gradient(850px 580px at 102% 0%, var(--glow-2), transparent 62%),
        linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, var(--primary-soft-bg)) 0%, var(--bg) 280px),
        var(--bg);
    background-attachment: fixed, fixed, scroll, scroll;
    color: var(--text);
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}
.card {
    background: var(--surface);
    border-radius: 10px;
    padding: 36px 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
}
h1 {
    margin: 0 0 6px 0;
    color: var(--primary);
    font-size: 1.5em;
}
.sub {
    color: var(--text-muted);
    margin: 0 0 26px 0;
    font-size: 0.92em;
}
label {
    display: block;
    font-weight: 600;
    font-size: 0.88em;
    margin-bottom: 6px;
    color: var(--text);
}
input[type=email], input[type=text], input[type=password] {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1em;
    margin-bottom: 16px;
}
input[type=email]::placeholder,
input[type=text]::placeholder,
input[type=password]::placeholder {
    color: var(--text-muted);
}
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 91, 124, 0.22);
}
/*
    Neutralizza l'autofill del browser (Chrome/Firefox riempie i
    campi credenziali con un bg giallo/bianco proprio, che in dark
    stride). Trick: box-shadow inset che copre il bg autofill +
    text-fill-color per il colore del testo. La transition lunga
    evita il flash all'apertura della pagina.
*/
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--surface-alt) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--text);
    transition: background-color 5000s ease-in-out 0s;
}
button {
    width: 100%;
    background: var(--primary);
    color: #fbfaf7;
    border: 0;
    padding: 12px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
}
button:hover { background: var(--primary-hover); }
.alert {
    padding: 11px 14px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.9em;
    border: 1px solid;
}
.alert-error   { background: var(--alert-error-bg);   color: var(--alert-error-text);   border-color: var(--alert-error-border); }
.alert-success { background: var(--alert-success-bg); color: var(--alert-success-text); border-color: var(--alert-success-border); }
.card .sub a { color: var(--primary, #2f6fab); font-weight: 600; }

/* ── piè di pagina ── */
.app-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    text-align: center; padding: 14px 16px;
    font-size: 0.76em; letter-spacing: 0.4px; color: var(--text-muted);
}
.app-footer a { color: #d81f26; font-weight: 600; text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
[data-theme="dark"] .app-footer a { color: #ff5b60; }

/* ── Solo pagina "Imposta la tua password" (primo accesso) ── */
:root { --info-text: #1d5b7c; --info-bg: #e2edf3; }
[data-theme="dark"] { --info-text: #6fb0d2; --info-bg: #17303f; }
.card.card-larga { max-width: 460px; }
.card-larga .sub { margin: 0 0 22px 0; line-height: 1.5; }
.card .sub.assistenza { text-align: center; margin: 10px 0 0 0; font-size: 0.85em; }
.esci { display: block; text-align: center; margin-top: 18px; font-size: 0.86em; color: var(--text-muted); }
.esci a { color: var(--text-muted); text-decoration: underline; }
.esci form.logout { display: inline; margin: 0; padding: 0; }
.esci button.link {
    background: none; border: 0; padding: 0; color: var(--text-muted);
    text-decoration: underline; cursor: pointer; font-size: 1em;
    font-family: inherit; width: auto; margin: 0;
}
.esci button.link:hover { background: none; color: var(--text); }

/* ── Pagina "Verifica del dispositivo" (codice via mail) ── */
label.ricorda {
    display: flex; align-items: flex-start; gap: 10px;
    font-weight: 400; font-size: 0.9em; line-height: 1.45;
    margin: 2px 0 18px 0; cursor: pointer;
}
label.ricorda input[type=checkbox] { margin-top: 3px; flex: 0 0 auto; }
label.ricorda small { display: block; color: var(--text-muted); font-size: 0.92em; }
