/* ============================================================
   POKÉ BUILDER — style.css
   Tema: Food-magazine dark, accenti arancio/corallo caldi
   Font: Fraunces (display) + DM Sans (body)
   ============================================================ */

/* ---------- VARIABILI ---------- */
:root {
  --bg:          #141210;
  --surface:     #1e1b18;
  --surface-2:   #272320;
  --border:      #332e29;
  --accent:      #f97316;       /* arancio vibrante */
  --accent-soft: #fb923c;
  --accent-glow: rgba(249,115,22,0.18);
  --green:       #4ade80;
  --text:        #f0ebe4;
  --text-muted:  #a09080;
  --danger:      #ef4444;
  --radius:      14px;
  --radius-sm:   8px;
  --transition:  0.2s ease;
}

/* ---------- RESET BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Texture sottile: puntini su sfondo scuro */
  background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- HEADER ---------- */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}
.logo-bowl { font-size: 1.5rem; line-height: 1; }
.logo-text {
  font-family: 'Fraunces', serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-text em {
  font-style: italic;
  color: var(--accent);
}

/* Badge prezzo */
#price-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}
.price-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
#current-price {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  transition: color 0.3s;
}

/* Reset button */
#reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
#reset-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Nota Glovo */
#glovo-note {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.5rem 1.2rem 0.6rem;
  font-size: 0.8rem;
  color: #c9a84c;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
}
.glovo-icon { font-size: 1rem; }

/* Barra progresso */
#progress-bar-wrap {
  height: 3px;
  background: var(--border);
}
#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 2px 2px 0;
}

/* ---------- MINI SUMMARY BAR ---------- */
#mini-summary-bar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  min-height: 2.4rem;
  display: flex;
  align-items: center;
}
#mini-summary {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.4rem 1.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ---------- MAIN ---------- */
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
  flex: 1;
  width: 100%;
}

/* ---------- STEP CONTAINER ---------- */
#step-container {}

/* Titolo step */
.step-title {
  font-family: 'Fraunces', serif;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.3rem;
  line-height: 1.1;
}
.step-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

/* Badge step counter */
.step-counter {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.25rem 0.7rem;
  border-radius: 99px;
  margin-bottom: 0.7rem;
  border: 1px solid rgba(249,115,22,0.3);
}

/* ---------- CARD GRIGLIA INGREDIENTI ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

/* Card singolo ingrediente */
.card-item {
  position: relative;
}
.card-item input[type="checkbox"],
.card-item input[type="radio"] {
  /* nascosto ma accessibile */
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.card-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.8rem 0.6rem;
  min-height: 72px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition);
  user-select: none;
  line-height: 1.3;
  gap: 0.3rem;
}
.card-label .card-extra {
  font-size: 0.7rem;
  color: var(--accent-soft);
  font-weight: 400;
}
.card-item input:checked + .card-label {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.card-label:hover {
  border-color: var(--accent-soft);
  background: rgba(249,115,22,0.07);
  transform: translateY(-1px);
}

/* Grandezza: card più grandi orizzontali */
.card-grid.size-grid {
  grid-template-columns: 1fr 1fr;
}
.size-grid .card-label {
  min-height: 90px;
  font-size: 1rem;
}
.size-grid .card-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
}
.size-grid .card-price {
  font-size: 0.85rem;
  color: var(--accent);
}

/* ---------- STEP BUTTONS ---------- */
.step-buttons {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
}
.step-buttons button {
  flex: 1;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
#btn-next {
  background: var(--accent);
  color: #fff;
}
#btn-next:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249,115,22,0.35);
}
#btn-prev {
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  flex: 0 0 auto;
  padding: 0.85rem 1.2rem;
}
#btn-prev:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Avviso errore validazione */
.validation-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  margin-top: 0.8rem;
  display: none;
}
.validation-error.visible { display: block; }

/* ---------- RIEPILOGO FINALE ---------- */
#final-summary {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: 1rem;
  animation: fadeUp 0.4s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.summary-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.summary-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

#summary-text {
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', monospace;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.summary-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.summary-actions button {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 140px;
}
#copy-btn {
  background: var(--accent);
  color: #fff;
}
#copy-btn:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249,115,22,0.3);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1.5px solid var(--border) !important;
}
.btn-secondary:hover {
  border-color: var(--text-muted) !important;
  color: var(--text);
}

/* ---------- MESSAGGIO COMPLETAMENTO ---------- */
.completion-message {
  text-align: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, rgba(74,222,128,0.07), rgba(74,222,128,0.03));
  border: 1px solid rgba(74,222,128,0.25);
  border-radius: var(--radius);
  animation: fadeUp 0.4s ease;
}
.completion-message .check-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.8rem;
}
.completion-message h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--green);
  margin-bottom: 0.5rem;
}
.completion-message p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto 1.2rem;
}
.completion-message button {
  background: rgba(74,222,128,0.15);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.4);
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}
.completion-message button:hover {
  background: rgba(74,222,128,0.25);
}

/* ---------- UTILITY ---------- */
.hidden { display: none !important; }

/* ---------- FOOTER ---------- */
footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1.2rem;
  border-top: 1px solid var(--border);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .header-inner { padding: 0.8rem 1rem; }
  .logo-text { font-size: 1.2rem; }
  main { padding: 1rem 0.9rem 3rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .card-grid.size-grid { grid-template-columns: 1fr 1fr; }
  .step-title { font-size: 1.4rem; }
  .summary-actions { flex-direction: column; }
}

/* ---------- MENU PRESET (Sushi Burrito) ---------- */

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.preset-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all var(--transition);
  position: relative;
}
.preset-card:hover {
  border-color: var(--accent-soft);
  background: rgba(249,115,22,0.05);
  transform: translateY(-2px);
}
.preset-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--accent);
}
.preset-card.selected::after {
  content: "✓";
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
}

.preset-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}
.preset-emoji  { font-size: 1.3rem; line-height: 1; }
.preset-price  {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}
.preset-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  display: block;
}
.preset-ingredients {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: block;
}

/* Box mancia preset */
.preset-mancia-box {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

/* Bottone conferma preset — stesso stile di btn-next */
#btn-preset-confirm {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
#btn-preset-confirm:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249,115,22,0.35);
}

@media (max-width: 420px) {
  .preset-grid { grid-template-columns: 1fr; }
}

/* ---------- ANIMAZIONE FADE STEP ---------- */
@keyframes stepIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}
.step-animate { animation: stepIn 0.25s ease; }

/* ============================================================
   HOME PAGE
   ============================================================ */

/* Header home minimale */
.home-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.home-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
}

/* Layout home */
.home-main {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 1.2rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

/* Headline */
.home-headline h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 0.6rem;
}
.home-headline h1 em {
  font-style: italic;
  color: var(--accent);
}
.home-headline p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Griglia prodotti */
.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

/* Card prodotto */
.product-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.1rem 1.2rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
}
.product-card::before {
  /* Bagliore accent sull'hover */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 60% 40%, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(249,115,22,0.18);
}
.product-card:hover::before { opacity: 1; }

.product-emoji {
  font-size: 2.2rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.2rem;
}
.product-name {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.product-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.4;
}
.product-arrow {
  font-size: 1.1rem;
  color: var(--accent);
  margin-top: 0.5rem;
  display: block;
  transition: transform 0.2s;
}
.product-card:hover .product-arrow { transform: translateX(4px); }

/* ---------- SEZIONE RIPRENDI / ULTIMO ORDINE ---------- */
#resume-section {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

/* Banner generico (in sospeso o ultimo ordine) */
.resume-banner {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.resume-banner:hover {
  border-color: var(--accent-soft);
  background: rgba(249,115,22,0.05);
}
.resume-banner-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.resume-banner-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.resume-banner-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.resume-banner-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}
.resume-banner-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Etichetta tipo (Pokè / Sushi Burrito) */
.resume-tag {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: var(--accent-glow);
  color: var(--accent-soft);
  border: 1px solid rgba(249,115,22,0.25);
  margin-bottom: 0.1rem;
  width: fit-content;
}

/* Footer home */
.home-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1.2rem;
  border-top: 1px solid var(--border);
}

/* Bottone back to home nel configuratore */
#back-home-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
#back-home-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Transizione pagine */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
#page-home, #page-configurator {
  animation: pageIn 0.3s ease;
}

@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr; }
  .home-headline h1 { font-size: 2rem; }
}
