/* Semantic aliases mapped to the Arber design tokens (arber-tokens.css). */
:root {
  --bg: var(--paper-2);            /* warm cream */
  --surface: var(--paper-1);       /* white */
  --ink: var(--ink-1);             /* soil brown, near-black */
  --ink-soft: var(--ink-2);
  --muted: var(--ink-3);
  --line: var(--line-2);
  --green: var(--arber-green-700); /* leaf green */
  --green-dark: var(--arber-green-800);
  --green-soft: var(--arber-green-100);
  --tan: var(--arber-brown-200);
  --amber: var(--warning);
  --brown: var(--arber-brown-700);
  --radius: var(--radius-lg);
  --shadow: var(--shadow-md);
  font-family: var(--font-sans);   /* Mulish */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; color: var(--green-dark); }
.leaf { font-size: 26px; }
.brand-name { letter-spacing: 0.3px; }
/* Big, unmistakable state badge — the customer must always see what the totem is
   doing (listening / thinking / speaking), especially during a slow turn. */
.status { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-dark); font-weight: 800; font-size: 22px;
  letter-spacing: 0.2px; transition: background .2s ease, color .2s ease; white-space: nowrap; }
.status .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--muted); }
.status[data-state="listening"] { background: var(--green-soft); color: var(--green-dark); }
.status[data-state="listening"] .dot { background: var(--green); animation: pulse 1.2s infinite; }
/* THINKING = the one users wait on: filled amber, bigger, gently pulsing + animated dots. */
.status[data-state="thinking"] { background: var(--amber); color: #3C2414; box-shadow: var(--shadow-md);
  animation: think-pulse 1s ease-in-out infinite; }
.status[data-state="thinking"] .dot { background: #3C2414; animation: pulse 0.6s infinite; }
.status[data-state="thinking"] #statusText::after { content: ""; animation: dots 1.2s steps(1,end) infinite; }
.status[data-state="speaking"] { background: var(--green); color: #fff; }
.status[data-state="speaking"] .dot { background: #fff; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes think-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes dots { 0%{content:"";} 25%{content:".";} 50%{content:"..";} 75%{content:"...";} }
.actions { margin-left: auto; display: flex; gap: 10px; }
.btn { font-size: 15px; font-weight: 700; padding: 11px 22px; border-radius: var(--radius-pill); border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--brown); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }

/* ---- Layout grid ---- */
.grid { flex: 1; display: grid; grid-template-columns: 340px 1fr 380px; gap: 20px; padding: 22px 28px; align-items: start; }
/* Wayfinding off for this store: drop the "Dove si trova" column, reflow to 2. */
body[data-wayfinding="off"] .col-right { display: none; }
body[data-wayfinding="off"] .grid { grid-template-columns: 340px 1fr; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.panel-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--ink); }
.col-center > .panel-title, .col-right > .panel-title { padding-left: 2px; }
.muted { color: var(--muted); margin: 4px 0; }
.small { font-size: 13px; }
.hidden { display: none; }
.empty { color: var(--muted); font-size: 15px; padding: 28px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); }

/* ---- Assistant line ---- */
.assistant-line { font-size: 19px; line-height: 1.5; color: var(--ink); margin: 0; }

/* ---- Diagnosis ---- */
.diag-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.diag-row:last-child { border-bottom: none; }
.diag-name { font-weight: 600; }
.diag-prob { color: var(--green-dark); font-variant-numeric: tabular-nums; }
.diag-advice { margin-top: 10px; font-size: 15px; color: var(--ink-soft); background: var(--green-soft); padding: 10px 12px; border-radius: 10px; }
.diag-advice.caution { background: #fbf0dc; color: #7a5111; }

/* ---- Photo / QR ---- */
.photo-panel { text-align: center; }
.qr { width: 150px; height: 150px; margin: 12px auto; border-radius: 12px; background: var(--green-soft);
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.qr img, .qr svg { width: 100%; height: 100%; border-radius: 12px; }

/* ---- Product cards ---- */
.cards { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); display: grid; grid-template-columns: 120px 1fr auto; gap: 20px; align-items: center; }
.card.is-pick { border-color: var(--green); border-width: 2px; }
.card-thumb { width: 120px; height: 140px; border-radius: 14px; background: var(--green-soft); display: flex;
  align-items: center; justify-content: center; font-size: 48px; }
.card-main { min-width: 0; }
.card-name { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.card-why { color: var(--ink-soft); font-size: 14px; margin: 0 0 6px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--bg); color: var(--ink-soft); }
.tag.ok { background: var(--green-soft); color: var(--green-dark); }
.tag.warn { background: #fbf0dc; color: #7a5111; }
.card-side { text-align: right; }
.card-price { font-size: 20px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.card-loc { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Per-format price list (multi-size products: terricci 10/20/50/80 L, …) */
.price-formats { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.price-formats .pf-row { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.price-formats .pf-size { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.price-formats .pf-price { font-size: 17px; font-weight: 700; color: var(--ink); min-width: 64px; text-align: right; }
.reco .price-formats .pf-price { font-size: 22px; color: var(--green-dark); }
.reco .price-formats .pf-size { font-size: 13px; }
/* Per-format availability (each size is stocked separately) */
.price-formats .pf-right { display: inline-flex; align-items: baseline; gap: 8px; }
.price-formats .pf-note { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.price-formats .pf-note.low { background: #FDEFD0; color: var(--warning); }
.price-formats .pf-note.out { background: #F7E0DF; color: var(--danger); }
.price-formats .pf-row.pf-out .pf-size,
.price-formats .pf-row.pf-out .pf-price { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
/* In the big reco card, push the per-format prices to the right like .reco-price */
.reco-head > .price-formats { margin-left: auto; align-self: flex-start; flex: none; }
.cards.reco-compare .reco-head > .price-formats { margin-left: 0; align-self: flex-start; }

/* ---- Map ---- */
.map-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-hint { font-size: 16px; color: var(--ink-soft); margin: 12px 2px 0; min-height: 22px; }

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

/* ===== Attract / welcome screen ===== */
.attract { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px; }
.attract.hidden { display: none; }
#session.hidden { display: none; }
.attract-inner { text-align: center; max-width: 900px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.attract-brand { font-size: 40px; font-weight: 700; color: var(--green-dark); display: flex; align-items: center; gap: 12px; }
.attract-brand .leaf { font-size: 42px; }
.attract-title { font-size: 42px; font-weight: 700; margin: 6px 0 0; color: var(--ink); }
.attract-sub { font-size: 22px; color: var(--ink-soft); margin: 0 0 10px; }
.paths { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; margin: 6px 0; }
.path { width: 330px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 30px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center;
  gap: 8px; cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.path:hover { transform: translateY(-3px); border-color: var(--green); }
.path-ico { font-size: 48px; line-height: 1; }
.path-t { font-size: 22px; font-weight: 700; color: var(--ink); }
.path-d { font-size: 16px; color: var(--muted); }
.btn-xl { font-size: 22px; padding: 18px 44px; border-radius: 16px; margin-top: 10px; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--ink-soft); }
.attract-privacy { font-size: 14px; color: var(--muted); max-width: 560px; line-height: 1.45; margin: 14px 0 0; }

/* ===== Session polish ===== */
.assistant-line { font-size: 21px; }
.card { animation: rise .25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Session: captions docked at the bottom ===== */
#session { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Live captions bar (what the assistant is saying) ===== */
.captions { background: var(--green-dark); color: #fff; display: flex; align-items: center; gap: 14px;
  padding: 18px 28px; font-size: 22px; line-height: 1.4; min-height: 64px; }
.cap-ico { font-size: 22px; opacity: .9; }
#captionText { font-weight: 500; }

/* ===== Final recommendation (1-2 products, in evidence) ===== */
.reco { display: flex; flex-direction: column; background: var(--surface);
  border: 2px solid var(--green); border-radius: 22px; box-shadow: var(--shadow);
  overflow: hidden; position: relative; }
.reco + .reco { margin-top: 16px; }
.reco-head { display: flex; align-items: center; gap: 28px; padding: 28px; flex-wrap: wrap; }
.reco-thumb { width: 300px; height: 360px; border-radius: 20px; background: var(--green-soft);
  display: flex; align-items: center; justify-content: center; font-size: 120px; flex: none; }
.reco-thumb .thumb-img { padding: 10px; }
/* keep a sane min so the text never collapses next to image + per-format prices
   on a narrow screen; the price block wraps below instead of overlapping. */
.reco-main { min-width: 180px; flex: 1; }
.reco-name { font-size: 28px; font-weight: 700; margin: 0 0 6px; }
.reco-desc { font-size: 17px; color: var(--ink-soft); margin: 0 0 10px; }
.reco-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reco-price { font-size: 32px; font-weight: 700; color: var(--green-dark);
  margin-left: auto; white-space: nowrap; align-self: flex-start; }

/* "Altra opzione" ribbon on the second card */
.reco-altlabel { position: absolute; top: 0; left: 0; background: var(--brown); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 14px; border-bottom-right-radius: 14px; }
.reco-altlabel.reco-complement { background: var(--green-dark); }   /* "Da abbinare" = green */
.reco + .reco .reco-head { padding-top: 36px; }

/* Head-to-head compare: two cards side-by-side instead of stacked */
.cards.reco-compare { grid-template-columns: 1fr 1fr; align-items: start; }
.cards.reco-compare .reco + .reco { margin-top: 0; }
.cards.reco-compare .reco-head { flex-direction: column; align-items: stretch; gap: 16px; padding-top: 40px; }
.cards.reco-compare .reco-thumb { width: 100%; height: 240px; }
.cards.reco-compare .reco-price { margin-left: 0; align-self: flex-start; }

/* "Da abbinare": complements in a compact column BESIDE the chosen product (no scroll) */
.cards.reco-withcomp { display: flex; flex-direction: row; gap: 18px; align-items: flex-start; }
.cards.reco-withcomp .reco-mains { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cards.reco-withcomp .reco-mains .reco + .reco { margin-top: 0; }
.reco-comps { flex: 0 0 280px; display: flex; flex-direction: column; gap: 12px; }
.reco-comps-title { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--green-dark); margin: 4px 0 2px; }
.reco-comp { display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--green-dark); border-radius: 14px;
  padding: 12px; box-shadow: var(--shadow); }
.comp-thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--green-soft); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 30px; overflow: hidden; }
.comp-thumb .thumb-img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.comp-main { min-width: 0; flex: 1; }
.comp-name { font-size: 16px; font-weight: 700; margin: 0 0 2px; }
.comp-size { font-size: 13px; color: var(--ink-soft); margin: 0 0 4px; }
.comp-price { font-size: 18px; font-weight: 700; color: var(--green-dark); white-space: nowrap; }
/* per-format prices inside the compact "Da abbinare" complement card */
.reco-comp .price-formats { flex: none; }
.reco-comp .price-formats .pf-size { font-size: 11px; }
.reco-comp .price-formats .pf-price { font-size: 14px; min-width: 52px; color: var(--green-dark); }

/* Progressive disclosure: "come si usa" / "perché sceglierlo" */
.reco-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; border: none; border-top: 1px solid var(--line); background: var(--green-soft);
  padding: 16px 28px; font-size: 17px; font-weight: 600; color: var(--green-dark);
  cursor: pointer; font-family: inherit; text-align: left; }
.rt-chev { font-size: 22px; transition: transform .2s ease; }
.reco.open .rt-chev { transform: rotate(180deg); }
.reco-detail { display: none; padding: 8px 28px 26px; }
.reco.open .reco-detail { display: block; }
.reco-section { margin-top: 18px; }
.reco-sec-title { font-size: 14px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 10px; }
.reco-steps { margin: 0; padding-left: 24px; font-size: 17px; color: var(--ink-soft); line-height: 1.7; }
.reco-dose { margin: 12px 0 0; font-family: var(--font-mono); font-size: 14px; color: var(--ink-2);
  background: var(--paper-3); border-radius: var(--radius-sm); padding: 12px 16px; line-height: 1.5; }
.reco-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.reco-chip { background: var(--green-soft); color: var(--arber-green-800); font-size: 15px;
  padding: 7px 14px; border-radius: var(--radius-pill); }

/* ===== Stage emphasis ===== */
/* Keep the photo QR available at every stage (incl. after a recommendation) so a
   customer can always send ANOTHER photo — hiding it here was a dead-end. */

/* ===== Legibility bumps (kiosk, viewed standing) ===== */
.panel-title { font-size: 18px; }
.card-name { font-size: 19px; }

/* ===== Attract QR (no-touch start) ===== */
.qr-start { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 10px 0; }
.qr-frame { background: #fff; padding: 22px; border-radius: 26px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.start-qr { width: 300px; height: 300px; display: block; image-rendering: pixelated; }
.qr-cap { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--green-dark); margin: 0; }

/* ===== Arber design-system alignment (logo, display font) ===== */
.brand-logo { height: 60px; width: auto; display: block; }
.brand-logo-sm { height: 30px; width: auto; display: block; }
.attract-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 48px; }
.card-name, .reco-name { font-family: var(--font-display); letter-spacing: -0.01em; }

/* Product photos (packshots) in the thumbnails */
.card-thumb, .reco-thumb { background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.thumb-img { width: 100%; height: 100%; object-fit: contain; padding: 4px; box-sizing: border-box; }

/* ===== Design-system tags / badges / inventory status ===== */
.card-tags { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.ds-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill); color: #fff; }
.ds-bio { background: var(--tag-bio); color: var(--arber-brown-900); }
.ds-badge { font-family: var(--font-mono); font-size: 12px; padding: 4px 10px;
  border-radius: var(--radius-sm); background: var(--paper-3); color: var(--ink-2); }
.ds-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  padding: 4px 11px; border-radius: var(--radius-pill); }
.ds-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ds-status.in  { background: var(--arber-green-100); color: var(--arber-green-800); }
.ds-status.low { background: #FDEFD0; color: var(--warning); }
.ds-status.out { background: #F7E0DF; color: var(--danger); }

/* Lucide stroke icons in the welcome tiles */
.path-ico svg { width: 46px; height: 46px; color: var(--green); }

/* ===== Spacing pass — Arber 4px grid ===== */
.grid { gap: var(--space-5); padding: var(--space-5) var(--space-6); }
.col { gap: var(--space-5); }
.panel { padding: var(--space-5); }
.card { padding: var(--space-5); }
.captions { padding: var(--space-4) var(--space-6); }
