:root {
  --nero: #1a1512;
  --crema: #fdf8f0;
  --crema-2: #f5ecdb;
  --arancio: #e87b1e;
  --arancio-scuro: #c85f0f;
  --rosso: #d1322f;
  --verde: #2fa84f;
  --testo: #2b241c;
  --bianco: #ffffff;
  --bordo: #e8ddc8;
  --ombra: 0 8px 24px rgba(26, 21, 18, 0.12);
  --radius: 14px;
  --font-titoli: "Poppins", sans-serif;
  --font-testo: "Nunito Sans", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-testo);
  background: var(--crema);
  color: var(--testo);
  padding-bottom: 90px;
}
h1, h2, h3, h4 { font-family: var(--font-titoli); margin: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.menu-topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--nero); color: var(--crema);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.menu-topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.menu-topbar-brand img { width: 36px; height: 36px; border-radius: 50%; background: var(--crema); }
.menu-topbar-brand a { color: inherit; text-decoration: none; }
.btn-carrello {
  position: relative; background: var(--arancio); color: var(--bianco); border: none;
  padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 0.95rem;
  display: flex; align-items: center; gap: 8px;
}
.btn-carrello .badge {
  position: absolute; top: -8px; right: -8px; background: var(--rosso); color: white;
  border-radius: 50%; width: 22px; height: 22px; font-size: 0.75rem; display: flex;
  align-items: center; justify-content: center; font-weight: 800;
}

.categorie-tabs {
  position: sticky; top: 56px; z-index: 39;
  background: var(--crema); border-bottom: 1px solid var(--bordo);
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
  -webkit-overflow-scrolling: touch;
}
.categorie-tabs::-webkit-scrollbar { display: none; }
.tab-categoria {
  flex: 0 0 auto; background: var(--bianco); border: 1px solid var(--bordo); color: var(--testo);
  padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 0.88rem;
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab-categoria.attiva { background: var(--arancio); border-color: var(--arancio); color: white; }

.menu-container { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; }
.categoria-sezione { margin-bottom: 34px; }
.categoria-titolo { font-size: 1.3rem; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }

.prodotti-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .prodotti-grid { grid-template-columns: 1fr 1fr; } }

.prodotto-card {
  background: var(--bianco); border: 1px solid var(--bordo); border-radius: var(--radius);
  display: flex; gap: 12px; padding: 12px; align-items: center;
}
.prodotto-card img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--crema-2); }
.prodotto-card-info { flex: 1; min-width: 0; }
.prodotto-card-info h3 { font-size: 1rem; margin-bottom: 4px; }
.prodotto-card-info p { margin: 0 0 8px; font-size: 0.85rem; opacity: 0.7; }
.prodotto-prezzo { font-weight: 800; color: var(--arancio-scuro); }
.prodotto-prezzo .da { font-weight: 600; font-size: 0.8rem; opacity: 0.7; }
.btn-aggiungi-rapido {
  background: var(--nero); color: white; border: none; border-radius: 999px;
  width: 36px; height: 36px; font-size: 1.1rem; flex-shrink: 0;
}

/* Modal prodotto */
.overlay {
  position: fixed; inset: 0; background: rgba(26,21,18,0.55); z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
}
.overlay.aperto { display: flex; }
@media (min-width: 720px) { .overlay { align-items: center; } }

.modal {
  background: var(--crema); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 0 0 20px;
}
@media (min-width: 720px) { .modal { border-radius: 20px; } }

.modal-img { width: 100%; height: 220px; object-fit: cover; border-radius: 20px 20px 0 0; }
.modal-body { padding: 18px 22px 0; }
.modal-chiudi {
  position: absolute; top: 14px; right: 14px; background: rgba(26,21,18,0.7); color: white;
  border: none; border-radius: 50%; width: 34px; height: 34px; font-size: 1.1rem;
}
.modal-header-wrap { position: relative; }
.modal-body h2 { font-size: 1.35rem; margin-bottom: 6px; }
.modal-body .descrizione { font-size: 0.9rem; opacity: 0.75; margin-bottom: 16px; }

.gruppo-scelta { margin-bottom: 20px; }
.gruppo-scelta-titolo {
  font-weight: 800; font-size: 0.95rem; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center;
}
.gruppo-scelta-hint { font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.gruppo-scelta-hint.obbligatorio { background: #fde3e0; color: var(--rosso); }
.gruppo-scelta-hint.opzionale { background: #e6f4ea; color: var(--verde); }
.opzione-riga {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--bordo); font-size: 0.92rem;
}
.opzione-riga:last-child { border-bottom: none; }
.opzione-riga label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.opzione-riga input[type="radio"], .opzione-riga input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--arancio); }
.opzione-supplemento { font-weight: 700; opacity: 0.7; font-size: 0.85rem; white-space: nowrap; }
.rimuovi-ingrediente label { color: #8a6d3b; }

.qta-select { display: flex; align-items: center; gap: 14px; margin: 10px 0 20px; }
.qta-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--bordo); background: white; font-size: 1.1rem; }
.qta-valore { font-weight: 800; font-size: 1.1rem; min-width: 24px; text-align: center; }

.modal-footer { padding: 14px 22px 4px; position: sticky; bottom: 0; background: var(--crema); }
.btn-aggiungi-carrello {
  width: 100%; padding: 15px; border: none; border-radius: 999px; background: var(--arancio);
  color: white; font-weight: 800; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-aggiungi-carrello:disabled { background: #cbbfa8; cursor: not-allowed; }

/* Carrello drawer */
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 100%; max-width: 420px;
  background: var(--crema); z-index: 110; transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,0.2);
}
.drawer.aperto { transform: translateX(0); }
.drawer-header { padding: 18px 20px; background: var(--nero); color: white; display: flex; justify-content: space-between; align-items: center; }
.drawer-header h2 { font-size: 1.15rem; }
.drawer-chiudi { background: none; border: none; color: white; font-size: 1.3rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drawer-footer { padding: 16px 20px; border-top: 1px solid var(--bordo); background: var(--bianco); }

.riga-carrello { border-bottom: 1px solid var(--bordo); padding: 12px 0; }
.riga-carrello-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.riga-carrello .dettagli { font-size: 0.8rem; opacity: 0.7; margin: 4px 0; }
.riga-carrello-azioni { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.riga-carrello-qta { display: flex; align-items: center; gap: 8px; }
.riga-carrello-rimuovi { background: none; border: none; color: var(--rosso); font-weight: 700; font-size: 0.85rem; }

.carrello-vuoto { text-align: center; opacity: 0.6; padding: 40px 20px; }

.form-checkout label { display: block; font-weight: 700; font-size: 0.85rem; margin: 12px 0 4px; }
.form-checkout input, .form-checkout select, .form-checkout textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bordo); font-family: inherit; font-size: 0.95rem;
}
.tipo-consegna { display: flex; gap: 10px; margin-top: 6px; }
.tipo-consegna button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--bordo); background: white; font-weight: 700;
}
.tipo-consegna button.attivo { background: var(--nero); color: white; border-color: var(--nero); }

.totale-riga { display: flex; justify-content: space-between; font-size: 0.92rem; margin: 4px 0; }
.totale-riga.finale { font-weight: 800; font-size: 1.15rem; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--bordo); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--nero); color: white; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 0.9rem; z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.toast.visibile { opacity: 1; }

.errore-form { color: var(--rosso); font-size: 0.85rem; margin-top: 6px; display: none; }
.errore-form.visibile { display: block; }
