/* area-clienti/assets/portale.css — Stile del portale clienti Sormani Cucine
   Foglio autonomo (non dipende da style.css del sito), stessa palette. */

:root {
    color-scheme: light;
    --bordeaux: #9B1B1B;
    --bordeaux-dark: #7a1515;
    --bianco-caldo: #FAFAF8;
    --antracite: #2E2E2E;
    --beige: #F0EBE3;
    --beige-dark: #E4DDD4;
    --testo-muted: #636363;
    --bordo: #DDD8D0;
    --bianco: #FFFFFF;
    --verde: #2e7d32;
    --font-serif: 'Playfair Display', Georgia, serif;
    --font-sans: 'Lato', 'Helvetica Neue', Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body.portale {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--antracite);
    background: var(--bianco-caldo);
}

a { color: var(--bordeaux); }
a:hover { color: var(--bordeaux-dark); }
/* Niente ritardo del doppio tap su telefono/tablet */
a, button, input, label { touch-action: manipulation; }

h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }
.muted { color: var(--testo-muted); }
.piccolo { font-size: 0.875rem; }

/* ---------- Header / footer ---------- */
.portale-header {
    background: var(--bianco);
    border-bottom: 1px solid var(--bordo);
}
.portale-header__inner {
    max-width: 68rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.portale-logo img { display: block; height: 44px; width: auto; }
.portale-header__titolo {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.4rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--bordeaux);
    padding-left: 1.25rem;
    border-left: 1px solid var(--bordo);
    white-space: nowrap;
    text-decoration: none;
}
.portale-header__titolo:hover, .portale-header__titolo:focus-visible { color: var(--bordeaux-dark); }
.portale-header__utente {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.portale-main {
    flex: 1;
    width: 100%;
    max-width: 68rem;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.portale-footer {
    border-top: 1px solid var(--bordo);
    text-align: center;
    font-size: 0.85rem;
    color: var(--testo-muted);
    padding: 1rem;
}
.portale-footer p { margin: 0; }

/* ---------- Componenti ---------- */
.card {
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card--stretta { max-width: 28rem; margin-left: auto; margin-right: auto; }

.scelta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}
.scelta__voce {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bianco);
    border: 2px solid var(--bordo);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.15s, transform 0.15s;
}
.scelta__voce:hover, .scelta__voce:focus-visible {
    border-color: var(--bordeaux);
    transform: translateY(-2px);
    color: inherit;
}
.scelta__voce h2 { color: var(--bordeaux); }
.scelta__voce p { margin: 0; color: var(--testo-muted); }

.btn {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.9rem 1.6rem;
    border-radius: 6px;
    border: 2px solid var(--bordeaux);
    background: var(--bordeaux);
    color: var(--bianco);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn:hover { background: var(--bordeaux-dark); border-color: var(--bordeaux-dark); color: var(--bianco); }
.btn--blocco { display: block; width: 100%; }
.btn--ghost { background: transparent; color: var(--bordeaux); }
.btn--ghost:hover { background: var(--beige); color: var(--bordeaux-dark); }
.btn--piccolo { font-size: 0.85rem; padding: 0.5rem 0.9rem; }
.btn[disabled], .btn--disabilitato {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.campo { margin-bottom: 1.15rem; }
.campo label {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}
.campo input, .campo select {
    width: 100%;
    font: inherit;
    font-size: 1.05rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--bordo);
    border-radius: 6px;
    background: var(--bianco);
    color: var(--antracite);
}
.campo input:focus, .campo select:focus {
    outline: 2px solid var(--bordeaux);
    outline-offset: 1px;
    border-color: var(--bordeaux);
}
.campo .aiuto { display: block; margin-top: 0.3rem; font-size: 0.85rem; color: var(--testo-muted); }

.input-codice {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    text-align: center;
    font-size: 1.4rem !important;
}

.avviso {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
    border: 1px solid;
}
.avviso--errore  { background: #fdf1f1; border-color: #e5b4b4; color: #7a1515; }
.avviso--successo{ background: #eef7ee; border-color: #b8dcb9; color: #1f5a22; }
.avviso--info    { background: var(--beige); border-color: var(--beige-dark); color: var(--antracite); }

.intestazione-pagina {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.intestazione-pagina h1 { margin: 0; }

.tabella-wrap { overflow-x: auto; }
table.tabella {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--bianco);
}
.tabella th, .tabella td {
    text-align: left;
    padding: 0.6rem 0.6rem;
    border-bottom: 1px solid var(--bordo);
    vertical-align: top;
}
/* Solo codice e pulsanti restano su una riga: il resto puo' andare a capo, cosi' la
   tabella dell'admin (9 colonne) sta in un desktop da 1024px senza scorrimento */
.tabella .codice, .tabella .nowrap, .tabella__azioni { white-space: nowrap; }
.tabella th {
    background: var(--beige);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tabella tr:hover td { background: #fbf9f6; }
.tabella--compatta th, .tabella--compatta td { padding: 0.45rem 0.7rem; }

.codice {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 1.05em;
    letter-spacing: 0.12em;
    background: var(--beige);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.stato-vuoto {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--testo-muted);
}

.stat {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
}
.stat__voce {
    background: var(--beige);
    border-radius: 8px;
    padding: 1rem;
}
.stat__valore { font-size: 1.6rem; font-weight: 700; display: block; }
.stat__etichetta { font-size: 0.85rem; color: var(--testo-muted); }

:focus-visible { outline: 2px solid var(--bordeaux); outline-offset: 3px; }

@media (max-width: 600px) {
    /* Header su una riga sola: logo piu' piccolo, niente titolo, solo il nome */
    .portale-header__inner { flex-wrap: nowrap; gap: 0.75rem; }
    .portale-logo img { height: 34px; }
    .portale-header__titolo { display: none; }
    .portale-header__utente { font-size: 0.9rem; gap: 0.5rem; white-space: nowrap; }
    .solo-largo { display: none; }
    .portale-main { padding: 1.25rem 1rem 2rem; }
    .card { padding: 1.15rem; }
}

/* ---------- Sessione 2: scheda cliente, upload, locandina, pagina cliente ---------- */
.briciole { margin: 0 0 1rem; font-size: 0.9rem; }
.briciole a { text-decoration: none; }
.briciole a:hover { text-decoration: underline; }

.azioni { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.azioni--sotto { margin: 0.75rem 0 0; }

.tabella__azioni { white-space: nowrap; }
.tabella__azioni .btn + .btn { margin-left: 0.4rem; }

/* Codice di accesso in evidenza */
.codice-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 2rem;
    align-items: center;
}
.codice-box__codice { text-align: center; }
.codice--grande {
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    letter-spacing: 0.2em;
    padding: 0.5rem 1rem;
    display: inline-block;
    color: var(--bordeaux);
}
.codice-box__azioni { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.75rem; }
@media (max-width: 600px) {
    .codice-box { grid-template-columns: 1fr; }
}

/* Riquadri dei tre file nella scheda cliente */
.file-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem 2rem;
    align-items: center;
}
.file-card h3 { margin-bottom: 0.25rem; }
.file-card__stato a { word-break: break-all; }
.file-card__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    justify-content: flex-end;
}
.file-card__scegli { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.file-card__scegli input[type=file] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0; overflow: hidden;
}
.file-card__scegli:focus-within .btn { outline: 2px solid var(--bordeaux); outline-offset: 2px; }
.file-card__nome { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card__attesa { flex-basis: 100%; text-align: right; }
@media (max-width: 700px) {
    .file-card { grid-template-columns: 1fr; }
    .file-card__form { justify-content: flex-start; }
    .file-card__attesa { text-align: left; }
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--beige);
    color: var(--testo-muted);
    margin-right: 0.4rem;
}
.badge--ok { background: #eef7ee; color: #1f5a22; }

/* Locandina: anteprima a fianco dei comandi, stampa a piena pagina */
.locandina-pagina {
    display: grid;
    grid-template-columns: minmax(16rem, 22rem) 1fr;
    gap: 2rem;
    align-items: start;
}
.locandina-anteprima img {
    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    margin: 0 auto;
    border: 1px solid var(--bordo);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    background: var(--bianco);
}
@media (max-width: 800px) {
    .locandina-pagina { grid-template-columns: 1fr; }
}
@media print {
    @page { size: A4 portrait; margin: 0; }
    body.portale { background: #fff; }
    .portale-header, .portale-footer, .locandina-strumenti { display: none !important; }
    .portale-main { padding: 0; max-width: none; }
    .locandina-pagina { display: block; }
    .locandina-anteprima img {
        max-width: none;
        width: 100vw;
        height: auto;
        border: 0;
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Pagina del cliente */
.progetto-sezione__testa {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}
.progetto-sezione__testa h2 { margin: 0; }
.progetto-video {
    display: block;
    width: 100%;
    max-height: 70vh;
    background: #000;
    border-radius: 8px;
}
.progetto-immagine-link { display: block; }
.progetto-immagine {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--bordo);
}

/* ---------- Sessione 4: eliminazione file / cliente, ricerca admin ---------- */
.btn--pericolo {
    background: transparent;
    color: #7a1515;
    border-color: #e5b4b4;
}
.btn--pericolo:hover { background: #fdf1f1; border-color: #7a1515; color: #7a1515; }
.btn--pericolo-pieno {
    background: #7a1515;
    border-color: #7a1515;
    color: var(--bianco);
}
.btn--pericolo-pieno:hover { background: #5e0f0f; border-color: #5e0f0f; }

.file-card__elimina {
    grid-column: 2;
    justify-self: end;
    margin: 0;
}
@media (max-width: 700px) {
    .file-card__elimina { grid-column: 1; justify-self: start; }
}

.card--pericolo { border-color: #e5b4b4; }
.card--stretta-media { max-width: 40rem; }
.elenco-eliminazione { margin: 0 0 1rem; padding-left: 1.25rem; }
.elenco-eliminazione li { margin-bottom: 0.35rem; }

.cerca-cliente { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--bordo); }
.cerca-cliente label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.4rem; }
.cerca-cliente__riga { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.cerca-cliente__riga input {
    flex: 1 1 14rem;
    max-width: 20rem;
    font: inherit;
    text-transform: uppercase;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--bordo);
    border-radius: 6px;
    background: var(--bianco);
    color: var(--antracite);
}
.cerca-cliente__riga input:focus { outline: 2px solid var(--bordeaux); outline-offset: 1px; border-color: var(--bordeaux); }

/* Elenco clienti su telefono/tablet: ogni riga diventa una scheda impilata (niente scorrimento
   orizzontale). Le etichette delle colonne vengono da data-etichetta sui <td>. */
@media (max-width: 900px) {
    .tabella--schede thead { display: none; }
    .tabella--schede, .tabella--schede tbody, .tabella--schede tr, .tabella--schede td { display: block; }
    .tabella--schede tr {
        border: 1px solid var(--bordo);
        border-radius: 8px;
        padding: 0.5rem 0.9rem;
        margin-bottom: 0.75rem;
        background: var(--bianco);
    }
    .tabella--schede tr:hover td { background: transparent; }
    .tabella--schede td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
        padding: 0.4rem 0;
        border-bottom: 1px solid #eee9e1;
        white-space: normal;
    }
    .tabella--schede td::before {
        content: attr(data-etichetta);
        flex: 0 0 auto;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--testo-muted);
    }
    .tabella--schede td.tabella__azioni {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.5rem;
        border-bottom: 0;
        padding-top: 0.6rem;
    }
    .tabella--schede td.tabella__azioni::before { display: none; }
    .tabella--schede .tabella__azioni .btn + .btn { margin-left: 0; }
}

/* Su schermi touch (telefono/tablet) i pulsanti piccoli restano comodi da premere (~40px) */
@media (max-width: 900px) {
    .btn--piccolo { padding: 0.75rem 1rem; }
}
