/*
 * Volley Treviso Summer Break — stili comuni a backoffice e area genitori.
 * I colori del camp (locandina «Summer Break»): arancio e rosso su nero, per
 * tutto il sito (richiesta del committente: prima il pannello era granata).
 */

/* I caratteri li serviamo noi: un <link> esterno che non risponde lascia la
   pagina bianca. Fira Sans per il testo, Archivo per i titoli, Fira Code per
   codici e IBAN (tutti SIL Open Font License, vedi fonts/LICENZE.txt). */
@font-face { font-family: 'Fira Sans'; src: url('../fonts/fira-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('../fonts/fira-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('../fonts/fira-sans-700.woff2') format('woff2'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('../fonts/archivo-latin.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Fira Code'; src: url('../fonts/fira-code.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
    --arancio: #f39200;         /* solo riempimenti e bordi: come testo su bianco non regge */
    --rosso: #e2231a;
    --nero: #141210;
    --camp-sfumatura: linear-gradient(100deg, var(--arancio), var(--rosso));
    --accent: #d23a18;          /* bottoni e riempimenti: col bianco sopra regge 4,8:1 */
    --accent-dark: #a51f16;     /* testo e link su bianco: 6,7:1 */
    --accent-light: #fff0e6;
    --oro: var(--arancio);      /* nome storico: gli accenti di bordo */
    --bg: #f4f6f8;
    --surface: #ffffff;
    --sidebar: var(--nero);
    --sidebar-text: #f5ede6;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warn: #b45309;
    --warn-bg: #fffbeb;
    --ok: #15803d;
    --ok-bg: #f0fdf4;
    --radius: 10px;
    --ombra: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --font-testo: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-titoli: 'Archivo', 'Fira Sans', system-ui, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, 'SF Mono', Menlo, monospace;
}

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

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-testo);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-titoli);
    line-height: 1.25;
    margin: 0 0 .5em;
    color: var(--text);
}
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }

a { color: var(--accent-dark); }
code, .mono { font-family: var(--font-mono); font-size: .88em; }
.muted { color: var(--muted); }
.piccolo { font-size: .85rem; }
.nascosto { display: none !important; }

/* ---------- Bottoni ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit; font-weight: 700; font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primario { background: var(--accent); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondario { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondario:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; }
.btn-pericolo { background: var(--surface); color: var(--danger); border-color: #fecaca; }
.btn-pericolo:hover:not(:disabled) { background: var(--danger-bg); }
.btn-piccolo { padding: 5px 10px; font-size: .82rem; }
.btn-pieno { width: 100%; }
.btn-link {
    background: none; border: 0; padding: 0; font: inherit;
    color: var(--accent-dark); text-decoration: underline; cursor: pointer;
}
.btn:focus-visible, .btn-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid rgba(210, 58, 24, .35);
    outline-offset: 1px;
}

/* ---------- Moduli ---------- */
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.campo label { font-weight: 700; font-size: .85rem; }
.campo .aiuto { font-size: .8rem; color: var(--muted); }
.campo-check { flex-direction: row; align-items: center; gap: 8px; }
.campo-check label { font-weight: 600; }
.griglia-campi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.griglia-campi .intero { grid-column: 1 / -1; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
/* hidden vince sempre: .campo e altri hanno display proprio, e l'attributo da solo non bastava */
[hidden] { display: none !important; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

/* Casella segnalata dal server */
.campo-errore input, .campo-errore select, .campo-errore textarea { border-color: var(--danger) !important; background: #fffafa; }
.campo-errore .scelta { border-color: #fca5a5; }
.messaggio-campo { color: #b91c1c; font-size: .84rem; font-weight: 600; margin-top: 4px; }

.errore-form {
    background: var(--danger-bg); color: #991b1b;
    border: 1px solid #fecaca; border-radius: 8px;
    padding: 9px 12px; font-size: .88rem; margin-bottom: 14px;
}

/* ---------- Schede ---------- */
.scheda {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--ombra);
    padding: 20px;
    margin-bottom: 20px;
}
.scheda-testa {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.scheda-testa h2 { margin: 0; }

/* ---------- Tabelle ---------- */
.tabella-contenitore { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabella { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabella th, .tabella td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabella th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: #f8fafc; }
.tabella tr:last-child td { border-bottom: 0; }
.tabella td.azioni { text-align: right; white-space: nowrap; }
.tabella td.azioni .btn + .btn { margin-left: 6px; }
.tabella .numero { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Etichette di stato ---------- */
.etichetta {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: .75rem; font-weight: 700; white-space: nowrap;
    background: #f1f5f9; color: #334155;
}
.etichetta.ok { background: var(--ok-bg); color: var(--ok); }
.etichetta.avviso { background: var(--warn-bg); color: var(--warn); }
.etichetta.pericolo { background: var(--danger-bg); color: #b91c1c; }
.etichetta.accento { background: var(--accent-light); color: var(--accent-dark); }
.etichetta.attesa { background: #e0ecff; color: #1d4ed8; }

/* ---------- Stati di una schermata: carica, errore, vuoto ---------- */
.stato {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 12px; padding: 48px 16px; color: var(--muted);
}
.stato h3 { margin: 0; color: var(--text); }
.stato p { margin: 0; max-width: 460px; }
.stato-errore .icona { font-size: 2rem; }
.rotella {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--border); border-top-color: var(--accent);
    animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Avvisi a comparsa ---------- */
.notifiche { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.notifica {
    background: var(--text); color: #fff; padding: 11px 16px; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .25); font-size: .9rem; max-width: 420px;
    animation: entra .2s ease-out;
}
.notifica.errore { background: #991b1b; }
.notifica.ok { background: var(--ok); }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Finestre modali ---------- */
.modale-sfondo {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 900;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 6vh 16px 16px; overflow-y: auto;
}
.modale {
    background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
}
.modale.larga { max-width: 820px; }
.modale-testa { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modale-testa h2 { margin: 0; }
.modale-chiudi { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.modale-corpo { padding: 20px; }
.modale-piede { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: #f8fafc; border-radius: 0 0 12px 12px; }

@media (max-width: 640px) {
    .griglia-campi { grid-template-columns: 1fr; }
    .modale-sfondo { padding: 12px; }
    /* Su un telefono un bottone con una frase lunga va a capo invece di uscire dallo schermo */
    .btn { white-space: normal; text-align: center; }
}

/* Prezzo di facciata barrato accanto a quello di vendita (UI.prezzo) */
.prezzo-facciata { color: var(--muted); font-weight: 400; margin-right: 4px; text-decoration-thickness: 1px; }
.solo-lettore {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Il bottone principale con la sfumatura della locandina, verso il rosso */
.btn-primario { background: linear-gradient(135deg, #d23a18, #b3221a); border-color: #b3221a; }
.btn-primario:hover { background: linear-gradient(135deg, #bf3214, #9c1c15); }
