/* ============================================================
   CantinApp — Global Styles
   Palette: bordeaux + oro + avorio
   ============================================================ */

:root {
  --bordeaux:     #8B2635;
  --bordeaux-dk:  #6a1b27;
  --bordeaux-lt:  #f5eaec;
  --oro:          #C9A84C;
  --oro-lt:       #f7f0e0;
  --nero:         #1a0608;
  --avorio:       #faf7f4;
  --avorio-dk:    #f0ebe4;
  --testo:        #1a0608;
  --testo-2:      #9a7a6a;
  --testo-3:      #c0a898;
  --bordo:        #e0d0c0;
  --bordo-dk:     #c8b8a8;
  --bianco:       #ffffff;
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-pill:  24px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: #0F0405;
  min-height: 100vh;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--avorio);
  color: var(--testo);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
}

/* ---- TOPBAR ---- */
.topbar {
  background: var(--nero);
  padding: 16px 20px 14px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.topbar-title {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
}
.topbar-sub {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  font-style: italic;
  margin-bottom: 10px;
}
.topbar-back {
  font-size: 13px;
  color: var(--oro);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-icon {
  color: var(--oro);
  font-size: 22px;
  text-decoration: none;
}

/* barra progresso wizard */
.progress-track {
  height: 3px;
  background: rgba(201,168,76,.2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--oro);
  border-radius: 2px;
  transition: width .4s ease;
}

/* ---- PAGINA GENERICA ---- */
.page { padding: 16px 20px 100px; max-width: 480px; margin: 0 auto; }

/* ---- CARD ---- */
.card {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- FIELD LABEL ---- */
.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--bordeaux);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 7px;
  margin-top: 16px;
  display: block;
}
.field-label:first-child { margin-top: 0; }

/* ---- INPUT / TEXTAREA / SELECT ---- */
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--testo);
  font-size: 15px;
  font-family: inherit;
  appearance: none;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--bordeaux);
}
textarea { resize: none; }
input::placeholder, textarea::placeholder { color: var(--testo-3); }

/* ---- CHIPS ---- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--bordeaux-dk);
  transition: all .15s;
  user-select: none;
}
.chip.sel, .chip:active {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: #fff;
}
.chip-oro.sel {
  background: var(--oro);
  border-color: var(--oro);
  color: var(--nero);
}

/* Chip non compatibile con la tipologia in degustazione */
.chip-disabled {
  opacity: 0.32;
  background: var(--avorio) !important;
  color: var(--testo-3, #999) !important;
  border-color: var(--bordo) !important;
  border-style: dashed !important;
  cursor: not-allowed !important;
  text-decoration: line-through;
  text-decoration-thickness: 0.5px;
  text-decoration-color: var(--testo-3, #999);
}
.chip-disabled .color-dot {
  opacity: 0.4;
}
.chip-disabled:active {
  background: var(--avorio) !important;
  color: var(--testo-3, #999) !important;
}

/* Box intera non applicabile (es. Densità per bianchi) */
.box-non-applicabile {
  position: relative;
}
.box-non-applicabile::after {
  content: 'Non applicabile a questa tipologia';
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  color: var(--testo-3, #999);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}
.box-non-applicabile .field-label::after {
  content: ' · non applicabile';
  color: var(--testo-3, #999);
  font-size: 10px;
  font-weight: 400;
  font-style: italic;
}

/* ---- SCALE BUTTONS (punteggi) ---- */
.scale-row { display: flex; gap: 5px; }
.scale-btn {
  flex: 1;
  padding: 10px 3px;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--bordeaux-dk);
  line-height: 1.3;
  transition: all .15s;
  user-select: none;
}
.scale-btn .num { font-size: 16px; font-weight: 600; display: block; }
.scale-btn.sel {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: #fff;
}

/* ---- DESC GRID (descrittori olfattivi) ---- */
.desc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.desc-chip {
  padding: 11px 8px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--bordeaux-dk);
  text-align: center;
  transition: all .15s;
  user-select: none;
}
.desc-chip i { font-size: 15px; display: block; margin-bottom: 3px; }
.desc-chip.sel {
  background: var(--oro);
  border-color: var(--oro);
  color: var(--nero);
}

/* ---- RUOTA AROMI: famiglie e sentori ---- */
.famiglie-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

/* Modalità sticky: una singola riga orizzontale scrollabile, fissa sotto il wizard-header */
.famiglie-grid.sticky-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 8px;
  padding: 8px 16px;
  margin: 0 -20px 12px;       /* sborda padding del wizard-body (20px) per andare edge-to-edge */
  position: sticky;
  top: 100px;                 /* sotto il wizard-header che ora include logo + brand-row */
  z-index: 50;
  background: var(--nero, #1a0608);
  border-bottom: 1px solid rgba(201,168,76,0.25);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.famiglie-grid.sticky-row::-webkit-scrollbar { height: 4px; }
.famiglie-grid.sticky-row::-webkit-scrollbar-thumb {
  background: rgba(201,168,76,0.4);
  border-radius: 2px;
}
.famiglie-grid.sticky-row .fam-chip {
  flex: 0 0 auto;             /* mantiene la dimensione naturale */
  min-width: 110px;           /* minimo accettabile per tap accuracy + icona ⓘ */
  flex-direction: row;        /* invece di column → più compatta in altezza */
  text-align: left;
  padding: 10px 12px;
  scroll-snap-align: start;
}
.famiglie-grid.sticky-row .fam-chip .fam-count {
  position: static;
  margin-left: auto;
}

.fam-chip {
  padding: 14px 10px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bianco);
  color: var(--testo);
  text-align: center;
  transition: all .15s;
  user-select: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fam-chip .fam-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}
.fam-chip .fam-count {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--bordeaux);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.fam-chip.sel {
  border-color: var(--bordeaux);
  background: var(--avorio);
  box-shadow: 0 2px 6px rgba(139,38,53,.15);
}
.fam-chip.has-sentori {
  border-color: var(--oro);
  background: rgba(201, 168, 76, 0.08);
}
.fam-chip.has-sentori.sel {
  border-color: var(--bordeaux);
  background: var(--avorio);
}

.fam-expanded {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  animation: slideDown .2s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fam-expanded-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--bordeaux);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.subcat-block { margin-bottom: 10px; }
.subcat-block:last-child { margin-bottom: 0; }
.subcat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--testo-2);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 6px;
}
.sentori-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.sentore-chip {
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--testo);
  user-select: none;
  transition: all .15s;
  white-space: nowrap;
}
.sentore-chip.tipico {
  border-color: var(--oro);
  background: linear-gradient(135deg, #FFFBF0, #FCF4DA);
  position: relative;
}
.sentore-chip.tipico::before {
  content: '★';
  color: var(--oro);
  margin-right: 4px;
  font-size: 10px;
}
.sentore-chip.sel {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: #fff;
}
.sentore-chip.sel.tipico {
  background: linear-gradient(135deg, var(--bordeaux), var(--bordeaux-dk));
  border-color: var(--bordeaux-dk);
}

.sentore-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bordeaux);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}
.sentore-tag i {
  cursor: pointer;
  font-size: 13px;
  opacity: .8;
}
.sentore-tag i:hover { opacity: 1; }

/* ---- STELLE ---- */
.stars { display: flex; gap: 10px; justify-content: center; margin: 12px 0; }
.star {
  font-size: 38px;
  cursor: pointer;
  color: var(--bordo);
  transition: color .15s;
  user-select: none;
  line-height: 1;
}
.star.lit { color: var(--oro); }
.star.sel { color: var(--oro); }

/* ---- SCORE BOX ---- */
.score-box {
  background: var(--nero);
  border: 1px solid rgba(201,168,76,.25);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  margin: 8px 0 14px;
}
.score-box .label {
  font-size: 11px;
  color: rgba(201,168,76,.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.score-box .numero {
  font-size: 52px;
  font-weight: 600;
  color: var(--oro);
  line-height: 1;
}
.score-box .max { font-size: 18px; color: rgba(255,255,255,.3); }
.score-box .fascia {
  display: inline-block;
  margin-top: 8px;
  border: 1px solid var(--oro);
  color: var(--oro);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 16px;
  border-radius: var(--radius-pill);
  letter-spacing: .5px;
}

/* ---- BOTTONI ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
  font-family: inherit;
  touch-action: manipulation;        /* evita il delay 300ms del double-tap-zoom su mobile */
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .85; transform: scale(.98); }
.btn-primary { background: var(--bordeaux); color: #fff; }
.btn-oro { background: var(--nero); color: var(--oro); border: 1px solid var(--oro); }
.btn-outline {
  background: var(--bianco);
  color: var(--bordeaux);
  border: 1px solid var(--bordo);
}
.btn-back-sm {
  width: 48px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--bordo);
  background: var(--bianco);
  color: var(--bordeaux);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-sm {
  height: 38px;
  width: auto;
  padding: 0 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* ---- BOTTOM BAR (wizard) ---- */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 12px 20px 20px;
  background: var(--avorio);
  border-top: 1px solid var(--bordo);
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 150;
}

/* Quando la bottom-bar è dentro il wizard-body, NON fixed: appare in linea
   alla fine dello step attivo. Più chiaro per l'utente: il "Continua" si vede
   solo quando ha effettivamente finito di compilare e raggiunge il fondo. */
.wizard-body .bottom-bar {
  position: static;
  background: transparent;
  border-top: none;
  padding: 24px 0 0;
  max-width: none;
  margin: 0;
  z-index: auto;
}

/* ---- FAB ---- */
.fab {
  position: fixed;
  bottom: 24px; right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bordeaux);
  color: #fff;
  border: none;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(139,38,53,.35);
  text-decoration: none;
  transition: transform .15s;
}
.fab:active { transform: scale(.93); }

/* ---- BADGE ---- */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.badge-rosso   { background: #f5eaec; color: #8B2635; }
.badge-bianco  { background: var(--oro-lt); color: #7a5a10; }
.badge-rosato  { background: #fce8ee; color: #9e3060; }
.badge-spumante{ background: #e8f5ea; color: #2a6e3a; }
.badge-anno    { background: var(--avorio-dk); color: var(--testo-2); }
.badge-qty     { background: #f0e8ee; color: var(--bordeaux); }

/* ---- WIZARD STEP: card-box per ogni categoria ----
   Crea separazione visiva tra le sezioni della scheda (Colore, Riflesso,
   Limpidezza, ecc.). Ogni field-label diventa l'header di una scatola
   visivamente collegata al contenuto sotto tramite bordo dorato laterale. */

/* Field-label come "intestazione" di categoria */
body.dark .step > .field-label,
body.dark .step > div:not(.step-icon):not(.step-title):not(.step-sub) > .field-label {
  background: linear-gradient(135deg, rgba(201,168,76,0.10), rgba(139,38,53,0.08));
  border-left: 3px solid var(--oro);
  color: var(--oro);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 12px;
  margin: 20px 0 0;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
body.dark .step > .field-label:first-of-type {
  margin-top: 0;
}

/* Contenuto subito DOPO un field-label diretto dello step:
   sfondo sottile + bordo sinistro dorato per "continuità visiva" con l'header */
body.dark .step > .field-label + .chips,
body.dark .step > .field-label + .scale-row,
body.dark .step > .field-label + .famiglie-grid,
body.dark .step > .field-label + textarea,
body.dark .step > .field-label + .stars,
body.dark .step > .field-label + .yesno-row {
  background: rgba(255,255,255,0.025);
  border-left: 3px solid rgba(201,168,76,0.3);
  padding: 12px;
  margin-top: 0;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Eccezione: .famiglie-grid in modalità sticky-row gestisce da sé layout/padding */
body.dark .step > .field-label + .famiglie-grid.sticky-row {
  background: var(--nero, #1a0608);
  border-left: none;
  padding: 8px 16px;
  border-radius: 0;
}

/* Le scale-row hanno già il loro look (rounded buttons): manteniamo solo
   il background della scatola, senza padding ulteriore che le schiaccia */
body.dark .step > .field-label + .scale-row {
  padding: 14px 12px;
}

/* Field-label dentro griglie a 2 colonne (annata+tipologia, denominazione+nazione…)
   restano come prima, senza card */
body.dark .step [style*="grid-template-columns"] .field-label {
  background: transparent;
  border-left: none;
  padding: 0 0 6px;
  margin: 0 0 4px;
  border-radius: 0;
  display: block;
}

/* ---- COLOR DOT (colori vino) ---- */
.color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(0,0,0,.25);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}

/* Chip "colore vino": layout flex per allineamento dot + nome,
   border-color leggermente più visibile in dark theme */
.chip-color {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding-left: 10px;
}
body.dark .chip-color {
  border-color: rgba(255,255,255,0.22);
}
body.dark .chip-color.sel {
  background: var(--bordeaux);
  border-color: var(--oro);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(201,168,76,0.5);
}
body.dark .chip-color .color-dot {
  border-color: rgba(255,255,255,0.4);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

/* Tutti gli altri chip della degustazione (riflesso, limpidezza, perlage, ecc):
   visivamente distinti quando selezionati con bordo dorato + glow */
body.dark .chip.sel {
  background: var(--bordeaux);
  border-color: var(--oro);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(201,168,76,0.4);
}

/* ---- DIVIDER ---- */
.divider { height: 1px; background: var(--bordo); margin: 16px 0; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 90px; left: 20px; right: 20px;
  background: var(--nero);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s;
  pointer-events: none;
  z-index: 200;
  max-width: 440px;
  margin: 0 auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--bordeaux); }

/* ---- SLIDER ---- */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bordo);
  outline: none;
  border: none;
  padding: 0;
  accent-color: var(--bordeaux);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bordeaux);
  cursor: pointer;
}

/* ---- EMPTY STATE ---- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--testo-2);
}
/* Reset: se .empty viene usato accidentalmente su uno span inline (es. dentro
   .stars-big o card di lista) NON deve applicare padding/text-align */
span.empty {
  text-align: inherit;
  padding: 0;
  display: inline;
}
.empty i { font-size: 48px; color: var(--bordo); display: block; margin-bottom: 12px; }
.empty h3 { font-size: 17px; font-weight: 500; margin-bottom: 6px; color: var(--testo); }
.empty p { font-size: 14px; line-height: 1.6; }

/* ---- STEP ICON ---- */
.step-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
  background: var(--bordeaux-lt);
}
.step-icon i { color: var(--bordeaux); }

/* ---- LOGO MINI nei header ---- */
.logo-mini {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}
.logo-mini-lg {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bianco);
  border-top: 1px solid var(--bordo);
  display: flex;
  width: 100%;
  max-width: 480px;
  z-index: 90;
}
.nav-item {
  flex: 1;
  padding: 10px 4px 12px;
  text-align: center;
  color: var(--testo-2);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: color .15s;
}
.nav-item i {
  display: block;
  font-size: 22px;
  margin-bottom: 2px;
}
.nav-item.active { color: var(--bordeaux); }
.nav-item.active i { color: var(--bordeaux); }

/* Pulsante centrale Aggiungi nella bottom-nav */
.nav-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px !important;
  color: var(--bordeaux) !important;
  font-weight: 600;
}
.nav-add-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bordeaux);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px rgba(139,38,53,0.4);
}
.nav-add-circle i {
  font-size: 22px !important;
  color: #fff !important;
  margin: 0 !important;
  display: block !important;
}

/* ---- LOGIN SPECIFICO ---- */
.login-logo {
  text-align: center;
  padding: 48px 0 32px;
}
.login-logo i { font-size: 52px; color: var(--bordeaux); display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 28px; font-weight: 600; color: var(--nero); }
.login-logo p { font-size: 14px; color: var(--testo-2); margin-top: 4px; }
.login-card {
  background: var(--bianco);
  border: 1px solid var(--bordo);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
}
.login-switch {
  text-align: center;
  font-size: 14px;
  color: var(--testo-2);
}
.login-switch a {
  color: var(--bordeaux);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

/* ============================================================
   TEORIA - icona ⓘ e bottom-sheet
   ============================================================ */
.teoria-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  font-size: 14px;
  color: var(--accent, #C9A84C);
  background: rgba(201, 168, 76, 0.15);
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
  line-height: 1;
  transition: all 0.15s;
}
.teoria-info-icon:active {
  background: rgba(201, 168, 76, 0.4);
  transform: scale(0.92);
}
.field-label .teoria-info-icon {
  font-size: 13px;
  width: 16px;
  height: 16px;
}

/* Overlay scuro */
.teoria-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.teoria-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Sheet che sale dal basso */
.teoria-sheet {
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  background: #1a0608;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  border-top: 2px solid var(--accent, #C9A84C);
}
.teoria-overlay.open .teoria-sheet {
  transform: translateY(0);
}

.teoria-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 28px;
  cursor: grab;
  flex-shrink: 0;
}
.teoria-handle::before {
  content: '';
  width: 42px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.teoria-content {
  padding: 0 20px 16px;
  overflow-y: auto;
  flex: 1;
  color: #faf7f4;
  -webkit-overflow-scrolling: touch;
}

.teoria-content h3 {
  font-size: 20px;
  margin: 0 0 16px 0;
  color: var(--accent, #C9A84C);
  font-weight: 600;
}

.teoria-sezione {
  margin-bottom: 18px;
}
.teoria-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(250, 247, 244, 0.5);
  margin-bottom: 6px;
  font-weight: 600;
}
.teoria-testo {
  font-size: 14.5px;
  line-height: 1.55;
  color: #faf7f4;
}

.teoria-pagina {
  font-size: 11px;
  color: rgba(250, 247, 244, 0.4);
  font-style: italic;
  margin-top: 12px;
}

.teoria-close {
  margin: 0 20px 20px;
  padding: 14px;
  background: var(--accent, #C9A84C);
  color: #1a0608;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.teoria-close:active {
  opacity: 0.85;
}

/* Elenchi e tabelle nelle voci di teoria (abbinamento cibo-vino) */
.teoria-punti {
  margin: 0 0 4px 18px;
  font-size: 14px;
  line-height: 1.5;
  color: #faf7f4;
}
.teoria-punti li { margin-bottom: 5px; }
.teoria-tab-titolo { margin-top: 14px; }
.teoria-tab-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.teoria-tab {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.4;
  color: #faf7f4;
}
.teoria-tab th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent, #C9A84C);
  background: rgba(201, 168, 76, 0.1);
  padding: 8px 10px;
  white-space: nowrap;
}
.teoria-tab td {
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  vertical-align: top;
  min-width: 90px;
}
.teoria-tab td:first-child { font-weight: 600; }

/* Pulsante Teoria nell'header */
.btn-teoria-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(201, 168, 76, 0.15);
  color: var(--accent, #C9A84C);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-teoria-header:active {
  background: rgba(201, 168, 76, 0.3);
}

/* Pagina Teoria — lista voci */
.teoria-pagina-sezione {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  margin-bottom: 10px;
  margin-top: 0;
  overflow: hidden;
}
.teoria-pagina-sezione-titolo {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent, #C9A84C);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(201, 168, 76, 0.08);
}
.teoria-voce {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.12s;
}
.teoria-voce:active {
  background: rgba(255, 255, 255, 0.05);
}
.teoria-voce-titolo {
  font-size: 15px;
  color: #faf7f4;
  font-weight: 500;
  margin-bottom: 4px;
}
.teoria-voce-preview {
  font-size: 12.5px;
  color: rgba(250, 247, 244, 0.55);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.teoria-search {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #faf7f4;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 16px;
  -webkit-appearance: none;
}
.teoria-search:focus {
  outline: none;
  border-color: var(--accent, #C9A84C);
}
.teoria-search::placeholder {
  color: rgba(250, 247, 244, 0.4);
}

/* ============================================================
   CantinApp — DARK THEME (applicato via body.dark)
   Override globali per coerenza visiva su tutte le pagine
   ============================================================ */

body.dark {
  background: var(--nero);
  color: var(--avorio);
}

/* Container generici */
body.dark .container,
body.dark .page-content,
body.dark .content,
body.dark main {
  background: var(--nero);
  color: var(--avorio);
}

/* Topbar */
body.dark .topbar {
  background: var(--nero);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
body.dark .topbar-title,
body.dark .topbar h1 {
  color: var(--oro);
}
body.dark .topbar-subtitle,
body.dark .topbar-sub {
  color: rgba(255,255,255,0.55);
}
body.dark .topbar-icon,
body.dark .topbar-action {
  color: var(--oro);
}

/* Card generiche */
body.dark .card,
body.dark .info-card,
body.dark .form-card,
body.dark .step-card,
body.dark .panel {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  color: var(--avorio);
}
body.dark .card-title,
body.dark .info-card-title,
body.dark .form-card-title,
body.dark .section-title {
  color: var(--avorio);
}

/* Etichette campi */
body.dark .field-label,
body.dark label {
  color: rgba(255,255,255,0.7);
}

/* Sezioni con titolo small caps */
body.dark .info-card-title i,
body.dark .section-title i {
  color: var(--oro);
}

/* Input, textarea, select */
body.dark input[type="text"],
body.dark input[type="number"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark input[type="date"],
body.dark input[type="tel"],
body.dark input[type="url"],
body.dark input[type="search"],
body.dark textarea,
body.dark select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--avorio);
}
body.dark input::placeholder,
body.dark textarea::placeholder {
  color: rgba(255,255,255,0.35);
}
body.dark input:focus,
body.dark textarea:focus,
body.dark select:focus {
  border-color: var(--oro);
  background: rgba(255,255,255,0.06);
  outline: none;
}

/* Option del menu select (il browser non eredita dal parent: 
   forziamo sfondo scuro e testo chiaro) */
body.dark select option {
  background: #1a0608;
  color: var(--avorio);
}

/* Bottoni */
body.dark .btn-outline,
body.dark .btn-secondary {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--avorio);
}
body.dark .btn-outline:active {
  background: rgba(255,255,255,0.08);
}

/* Chip / Filter */
body.dark .chip {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.15);
  color: var(--avorio);
}
body.dark .chip.sel,
body.dark .chip:active {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: #fff;
}

body.dark .filter-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.65);
}
body.dark .filter-btn.active {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: #fff;
}

/* Divisori */
body.dark hr,
body.dark .divider {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.08);
}

/* Empty state */
body.dark .empty,
body.dark .empty-state {
  color: rgba(255,255,255,0.5);
}
body.dark .empty h3,
body.dark .empty-state h3 {
  color: rgba(255,255,255,0.75);
}
body.dark .empty i,
body.dark .empty-state i {
  color: rgba(255,255,255,0.18);
}

/* Modal overlay */
body.dark .modal-overlay {
  background: rgba(0,0,0,0.7);
}
body.dark .modal-content {
  background: var(--nero);
  color: var(--avorio);
  border: 1px solid rgba(255,255,255,0.1);
}
body.dark .modal-title {
  color: var(--oro);
}
body.dark .modal-close {
  color: rgba(255,255,255,0.6);
}

/* Bottom nav scura */
body.dark .bottom-nav {
  background: var(--nero);
  border-top: 1px solid rgba(255,255,255,0.08);
}
body.dark .nav-item {
  color: rgba(255,255,255,0.5);
}
body.dark .nav-item.active,
body.dark .nav-item.active i {
  color: var(--oro);
}
body.dark .nav-add {
  color: var(--bordeaux) !important;
}

/* Step indicator / progress bar */
body.dark .step-dot {
  background: rgba(255,255,255,0.15);
}
body.dark .step-dot.active {
  background: var(--oro);
}
body.dark .progress-bar-track {
  background: rgba(255,255,255,0.08);
}

/* Toast (mantiene il suo stile ma compatibile) */
body.dark .toast {
  background: rgba(0,0,0,0.85);
  color: var(--avorio);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Links generici */
body.dark a {
  color: var(--oro);
}
body.dark a:visited {
  color: var(--oro);
}

/* Sezione danger zone (elimina) */
body.dark .danger-zone {
  border-top: 1px solid rgba(255,255,255,0.08);
}
body.dark .btn-danger {
  background: rgba(196,86,50,0.15);
  border: 1px solid rgba(196,86,50,0.4);
  color: #e89685;
}

/* Wine info nel dettaglio */
body.dark .info-row {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
body.dark .info-key {
  color: rgba(255,255,255,0.55);
}
body.dark .info-value {
  color: var(--avorio);
}

/* Image placeholder e wine-thumb scuri */
body.dark .wine-thumb,
body.dark .image-placeholder {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
body.dark .wine-thumb i {
  color: rgba(255,255,255,0.3);
}

/* Login card scura */
body.dark .login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--avorio);
}
body.dark .tabs {
  background: rgba(255,255,255,0.04);
}
body.dark .tab {
  color: rgba(255,255,255,0.6);
}
body.dark .tab.tab-active {
  background: var(--bordeaux);
  color: #fff;
}

/* Wizard degustazione: card step e progress */
body.dark .step-card {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.1);
}
body.dark .step-title,
body.dark .wizard-title {
  color: var(--oro);
}
body.dark .step-counter {
  color: rgba(255,255,255,0.5);
}

/* Famiglie aromatiche chip */
body.dark .fam-chip {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  color: var(--avorio);
}
body.dark .fam-chip.sel {
  background: rgba(201,168,76,0.15);
  border-color: var(--oro);
  color: var(--avorio);
}
body.dark .fam-chip.has-sentori {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.5);
}
body.dark .fam-chip .fam-count {
  background: var(--oro);
  color: var(--nero);
}
body.dark .fam-expanded {
  background: rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.08);
}
body.dark .fam-expanded-header {
  color: var(--avorio);
}
body.dark .subcat-label {
  color: rgba(255,255,255,0.55);
}
body.dark .sentore-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--avorio);
}
body.dark .sentore-chip.sel {
  background: var(--bordeaux);
  color: #fff;
  border-color: var(--bordeaux);
}
body.dark .sentore-chip.tipico {
  border-color: var(--oro);
}

/* Chip disabilitati su tema scuro */
body.dark .chip-disabled {
  background: rgba(255,255,255,0.02) !important;
  color: rgba(255,255,255,0.25) !important;
  border-color: rgba(255,255,255,0.1) !important;
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.25);
}

/* Box "non applicabile" su tema scuro */
body.dark .box-non-applicabile .field-label::after {
  color: rgba(255,255,255,0.35);
}

/* Stelle voto */
body.dark .star {
  color: rgba(255,255,255,0.2);
}
body.dark .star.sel {
  color: var(--oro);
}

/* Scale numeriche/punteggio */
body.dark .scale-num {
  color: var(--avorio);
}

/* Wine card (dettaglio bottiglia) */
body.dark .wine-detail-card,
body.dark .info-section {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
body.dark .wine-detail-title {
  color: var(--oro);
}
