/* COPIA dello stile del pannello v1 (pannello/css/style.css, 2026-12-01) come base del pannello di
   Sintelia Tools. Il pannello v1 non si tocca: le modifiche per Tools vanno in fondo a questo file. */
/* ============================================================
   Pannello cliente - stile mobile-first, pulito e premium.
   ============================================================ */
:root {
  /* Palette NEUTRA e PROFESSIONALE: il pannello è un unico strumento per tutti
     i clienti, quindi ha una sua identità (slate + blu), non i colori di un locale. */
  --bg:        #eef1f5;
  --surface:   #ffffff;
  --surface-2: #f4f6f9;
  --ink:       #1b2430;
  --ink-soft:  #5a6675;
  --line:      #e2e7ee;
  --brand:     #1e293b;   /* slate scuro (header, bottoni primari) */
  --brand-2:   #334155;
  --accent:    #2563eb;   /* blu professionale (azioni/accenti) */
  --ok:        #15935a;
  --danger:    #d23f3f;
  --warn-bg:   #fff3e0;
  --radius:    16px;
  --radius-sm: 11px;
  --shadow:    0 6px 22px rgba(30, 41, 59, .08);
  --tap:       48px;
  --maxw:      640px;
  font-synthesis: none;
}

/* Wordmark del brand Sintelia Studio (auto-ospitato, niente Google) */
@font-face {
  font-family: 'Josefin Sans';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/josefin-sans-latin.woff2') format('woff2');
}
.marca-sintelia { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto 16px; }
.marca-sintelia__emblema { width: 46px; height: 46px; color: #1A1A22; display: inline-flex; flex: 0 0 auto; }
.marca-sintelia__emblema svg { width: 100%; height: 100%; }
.marca-sintelia__nome { display: flex; flex-direction: column; line-height: .9; font-family: 'Josefin Sans', system-ui, sans-serif; font-weight: 600; font-size: 1.55rem; letter-spacing: .18em; color: #1A1A22; }
.marca-sintelia__studio { font-size: .64rem; letter-spacing: .42em; color: #A8854D; padding-left: .05em; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

.app { max-width: var(--maxw); margin: 0 auto; min-height: 100dvh; }
.loader { padding: 28vh 24px; text-align: center; color: var(--ink-soft); }

/* ---------- Tipografia ---------- */
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
.muted { color: var(--ink-soft); }
.small { font-size: .86rem; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top));
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.topbar-marchio { width: 30px; height: 30px; color: #ECE6D9; flex: 0 0 auto; display: inline-flex; }
.topbar-marchio svg { width: 100%; height: 100%; }
.topbar .titolo { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar .titolo strong { font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .titolo span { font-size: .76rem; opacity: .8; }
.topbar .spacer { flex: 1; }
.iconbtn {
  appearance: none; border: 0; background: rgba(255,255,255,.14); color: #fff;
  min-width: var(--tap); height: var(--tap); border-radius: 12px;
  font-size: .9rem; font-weight: 600; padding: 0 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.iconbtn:active { transform: scale(.96); }
.iconbtn.ghost { background: transparent; }

/* ---------- Contenuto ---------- */
.content { padding: 16px; }
.stack > * + * { margin-top: 12px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card.pad { padding: 16px; }

/* ---------- Icone inline ---------- */
.ic { width: 1.05em; height: 1.05em; flex: 0 0 auto; vertical-align: -2px; }
.btn .ic { width: 1.15em; height: 1.15em; }
.iconbtn .ic { width: 1.1em; height: 1.1em; }
.mini .ic { width: 1.2em; height: 1.2em; }

.sez-tit {
  font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); margin: 2px 2px 2px;
}

/* lista blocchi (home) */
.blocco-link {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 15px 16px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: inherit;
  transition: transform .14s cubic-bezier(.16,1,.3,1), border-color .14s ease;
}
.blocco-link:active { transform: scale(.99); }
.blocco-link:hover { border-color: #cfd8e4; }
.blocco-link .chip {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eaf0fb; color: var(--accent); border: 1px solid #d9e3f7;
}
.blocco-link .chip .ic { width: 22px; height: 22px; }
.blocco-link .testo { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.blocco-link b { display: block; font-size: 1.02rem; }
.blocco-link .freccia { margin-left: auto; color: var(--ink-soft); display: inline-flex; }
.blocco-link .freccia .ic { width: 1.3em; height: 1.3em; }

/* pill di stato (interruttori: Attivo / Spento) */
.stato-pill {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: .74rem; font-weight: 700; padding: 2px 9px 2px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.stato-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stato-pill.on { color: #1b6b3f; background: #e7f3ec; border-color: #c3e2cf; }
.stato-pill.on .dot { animation: respiro 2.2s ease-in-out infinite; }
@keyframes respiro { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* scheletri di caricamento */
.blocco-link.skel { pointer-events: none; }
.sk { display: inline-block; background: linear-gradient(90deg,#e9edf3 25%,#f3f6fa 37%,#e9edf3 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
.sk-chip { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto; }
.sk-line { height: 13px; } .sk-line.w50 { width: 50%; height: 16px; } .sk-line.w25 { width: 25%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Menu / elenco piatti ---------- */
.cat-titolo {
  margin: 22px 4px 8px; font-size: .8rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
}
.cat-titolo:first-of-type { margin-top: 4px; }

.piatto {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-top: 8px;
}
.piatto.non-disp { opacity: .62; }
.piatto .info { flex: 1; min-width: 0; cursor: pointer; }
.piatto .nome { font-weight: 600; }
.piatto .desc { font-size: .85rem; color: var(--ink-soft); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.piatto .meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.prezzo { font-weight: 700; color: var(--brand-2); }
.piatto .quando { font-weight: 600; color: var(--ink-soft); font-size: .85rem; }
.badge {
  font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-bg); color: #9a6a1e; border: 1px solid #ecd9b6;
}
.piatto .azioni { display: flex; flex-direction: column; gap: 4px; }
.azione-disponibilita {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft);
  min-height: 30px; border-radius: 9px; padding: 4px 7px; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer;
}
.azione-disponibilita[aria-pressed="false"] { color: #9a6a1e; background: var(--warn-bg); border-color: #ecd9b6; }
.prezzo-rapido { display: grid; gap: 2px; width: 76px; }
.prezzo-rapido input { width: 100%; min-height: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: .82rem; font-weight: 700; text-align: right; }
.prezzo-correggi { color: var(--danger); font-size: .65rem; line-height: 1.1; text-align: right; }
.prezzo-rapido.da-correggere input { border-color: var(--danger); }
.ricerca-collezione { margin: 0 0 12px; }
.mini {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2);
  width: 38px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-soft);
}
.mini:active { transform: scale(.94); }
.mini.del { color: var(--danger); }
.mini:disabled { opacity: .35; cursor: default; }

/* ---------- Bottoni ---------- */
.btn {
  appearance: none; cursor: pointer; border: 0; border-radius: 13px;
  min-height: var(--tap); padding: 0 20px; font-size: 1rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--accent  { background: var(--accent); color: #fff; }
.btn--ghost   { background: transparent; color: var(--brand); border: 1.5px solid var(--line); }
.btn--danger  { background: transparent; color: var(--danger); border: 1.5px solid #e7c4c4; }
.btn:disabled { opacity: .55; cursor: default; }
.anteprima-btn { margin-top: 10px; }

.barra-azione {
  position: sticky; bottom: 0; z-index: 4;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* ---------- Anteprima sito ---------- */
.anteprima-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: #0f172a; color: #fff;
}
.anteprima-topbar {
  min-height: 58px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px;
  background: var(--brand); box-shadow: 0 2px 14px rgba(0,0,0,.24);
}
.anteprima-titolo {
  min-width: 0; flex: 1;
  font-weight: 800; line-height: 1.15;
}
.anteprima-titolo span {
  display: block; margin-top: 2px;
  font-size: .74rem; font-weight: 600; opacity: .78;
}
.anteprima-chiudi {
  appearance: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14); color: #fff;
  font-size: 1.5rem; line-height: 1;
}
.anteprima-body { position: relative; flex: 1; min-height: 0; background: #fff; }
.anteprima-frame {
  width: 100%; height: 100%; border: 0; display: block;
  background: #fff;
}
.anteprima-stato,
.anteprima-errore {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
  background: rgba(248,250,252,.94); color: var(--ink);
}
.anteprima-stato[hidden],
.anteprima-errore[hidden] { display: none; }
.anteprima-stato p,
.anteprima-errore p { margin: 0; color: var(--ink-soft); max-width: 360px; }
.anteprima-spinner {
  width: 34px; height: 34px; border-radius: 999px;
  border: 3px solid #d9e3f7; border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.anteprima-azioni {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  width: min(360px, 100%); margin-top: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form ---------- */
.campo { margin-top: 14px; }
.campo > label:not(.switch) { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.campo input[type=text], .campo textarea {
  width: 100%; font: inherit; color: var(--ink);
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); min-height: var(--tap);
}
.campo textarea { min-height: 92px; resize: vertical; }
.campo input:focus, .campo textarea:focus { outline: none; border-color: var(--accent); }
.campo .hint { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }

/* campo FOTO */
.foto-box { margin-top: 2px; }
.foto-preview {
  border: 1.5px dashed var(--line); border-radius: 12px; background: var(--surface-2);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  min-height: 150px; aspect-ratio: 16 / 10;
}
.foto-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-vuota {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-soft); font-size: .9rem;
}
.foto-vuota .ic { width: 30px; height: 30px; opacity: .55; }
.foto-azioni { display: flex; gap: 8px; margin-top: 10px; }
.foto-btn { width: auto; flex: 1; min-height: 44px; padding: 0 12px; font-size: .92rem; }
.foto-link { margin-top: 10px; }

/* interruttore */
.switch { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 52px; height: 30px; border-radius: 999px; background: #d6ccbd;
  position: relative; transition: background .18s ease; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s ease;
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Login ---------- */
.login-wrap { padding: 8vh 20px 24px; }
.login-card { max-width: 380px; margin: 0 auto; padding: 26px 22px; }
.login-logo { width: 60px; height: 60px; display: block; margin: 0 auto 14px; }
.login-card h1 { text-align: center; }
.login-card p.sub { text-align: center; margin: 6px 0 18px; }

/* ---------- Vari ---------- */
.errore-box {
  background: #fbeaea; color: #8f2d2d; border: 1px solid #eecaca;
  border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin-top: 12px;
}
.vuoto { text-align: center; color: var(--ink-soft); padding: 40px 20px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

/* Editor traduzioni (correzione manuale del testo tradotto dall'IA) */
.tab-lingua {
  border: 1px solid var(--linea, #e0dcd3); background: var(--superficie, #fff); color: var(--ink-soft, #6b6459);
  font-size: .82rem; font-weight: 600; padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.tab-lingua.is-attiva { background: var(--ink, #1a1a22); border-color: var(--ink, #1a1a22); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn:active, .mini:active, .iconbtn:active, .blocco-link:active { transform: none; }
}

/* ============================================================
   SCHERMI LARGHI (tablet e computer) - SOLO ESTETICA
   ------------------------------------------------------------
   Il pannello nasce mobile-first e sotto gli 820px NON cambia nulla:
   tutte le regole qui sotto vivono dentro media query.
   Sopra quella soglia la colonna si allarga e gli elenchi passano a due
   colonne, cosi' su iPad e PC non resta una striscia stretta in mezzo
   allo schermo (a 1440px si usava il 44% della larghezza).
   Non cambiano comportamento, bersagli di tocco (48px) ne' JavaScript.
   `:has()` non e' supportato dai browser molto vecchi: in quel caso resta
   semplicemente il layout a colonna singola di prima. Nessuna rottura.
   ============================================================ */
@media (min-width: 820px) {
  :root { --maxw: 980px; }

  /* --- Home: le tessere dei blocchi affiancate --- */
  .content:has(> .blocco-link) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
  }
  /* in griglia la spaziatura la da' gap: azzero quella della pila verticale */
  .content:has(> .blocco-link) > * + * { margin-top: 0; }
  /* i titoli di sezione prendono la riga intera */
  .content:has(> .blocco-link) > .sez-tit { grid-column: 1 / -1; margin-top: 10px; }
  .content:has(> .blocco-link) > .sez-tit:first-child { margin-top: 0; }

  /* --- Elenco menu: le voci affiancate, le categorie a tutta riga --- */
  .content:has(> .piatto) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
  }
  .content:has(> .piatto) > * + * { margin-top: 0; }
  .content:has(> .piatto) > .piatto { margin-top: 0; }
  .content:has(> .piatto) > .cat-titolo,
  .content:has(> .piatto) > .ricerca-collezione,
  .content:has(> .piatto) > .barra-azione { grid-column: 1 / -1; }
  /* la categoria ha bisogno di respiro sopra, che il reset qui sopra toglieva */
  .content:has(> .piatto) > .cat-titolo { margin-top: 16px; }
  .content:has(> .piatto) > .cat-titolo:first-of-type { margin-top: 0; }

  /* --- Moduli di modifica: restano in colonna stretta ---
     Allargare un campo di testo a 950px lo rende meno leggibile, non piu'.
     Le schermate di modifica hanno un <form> e un div .sezione dentro .content. */
  .content > form,
  .content > .sezione { max-width: 620px; margin-left: auto; margin-right: auto; }
}

/* Su schermi molto larghi un filo di respiro in piu', senza esagerare:
   oltre non si guadagna leggibilita', si perde soltanto. */
@media (min-width: 1280px) {
  :root { --maxw: 1080px; }
}
