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

:root {
  --bg: #FFF8F0;
  --bg2: #FFF3E8;
  --card: #FFFFFF;
  --primary: #E07B2A;
  --primary-dark: #C46820;
  --primary-light: #FFF0E0;
  --secondary: #5B3E31;
  --text: #2C2020;
  --text-muted: #7A6A62;
  --border: #EEE0D0;
  --border-light: #F5EDE5;
  --green: #2E9B5E;
  --green-bg: #E8F7EF;
  --blue: #2563EB;
  --blue-bg: #EFF6FF;
  --gold: #B07D00;
  --gold-bg: #FFF8E0;
  --purple: #7C3AED;
  --purple-bg: #F5F0FF;
  --teal: #0D9488;
  --teal-bg: #E6FAFA;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --gray: #6B7280;
  --gray-bg: #F9FAFB;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(100,60,20,0.09);
  --shadow-lg: 0 6px 32px rgba(100,60,20,0.13);
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--primary-dark); }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
ul { list-style: none; }

/* ===== NAV ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,248,240,0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1.5px solid var(--border);
  padding: 0 1.5rem;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 56px;
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-links {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav-links a {
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}
.nav-links a:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #FFF3E8 0%, #FDE8CC 60%, #FAF0FF 100%);
  border-bottom: 1.5px solid var(--border);
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
}
.hero-content { max-width: 720px; margin: 0 auto; }
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.15;
  margin-bottom: 0.6rem;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}
.tldr {
  background: white;
  border: 1.5px solid var(--border);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-align: left;
  box-shadow: var(--shadow);
}
.tldr strong { color: var(--primary-dark); }
.tldr p { font-size: 0.97rem; line-height: 1.7; margin-bottom: 0.5rem; }
.tldr p:last-child { margin-bottom: 0; }

/* ===== SECTIONS ===== */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.section-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-sub {
  color: var(--text-muted);
  font-size: 0.97rem;
  margin-bottom: 2rem;
}
.section-divider {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 0;
}

/* ===== QUIZ ===== */
#quiz-section { background: var(--bg2); }
#quiz-section .section {  }

.quiz-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
}
.quiz-progress {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
}
.quiz-progress-dot {
  height: 6px;
  flex: 1;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.3s;
}
.quiz-progress-dot.active { background: var(--primary); }
.quiz-progress-dot.done { background: var(--green); }

.quiz-step { display: none; }
.quiz-step.active { display: block; }

.quiz-q {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--secondary);
}
.quiz-hint { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 1.25rem; }

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}
.quiz-opt {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  transition: all var(--transition);
  cursor: pointer;
  line-height: 1.4;
}
.quiz-opt:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-opt.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(224,123,42,0.12);
}
.quiz-opt .opt-icon { display: block; font-size: 1.5rem; margin-bottom: 0.3rem; }
.quiz-opt .opt-sub { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.quiz-nav-step { font-size: 0.85rem; color: var(--text-muted); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: 99px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(224,123,42,0.3); }
.btn-secondary { background: var(--bg2); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* Quiz Result */
.quiz-result { display: none; }
.quiz-result.visible { display: block; }
.result-box {
  background: linear-gradient(135deg, var(--primary-light) 0%, #FFF3E8 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}
.result-title { font-size: 1rem; color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 600; }
.result-name { font-size: 1.6rem; font-weight: 800; color: var(--secondary); margin-bottom: 0.75rem; }
.result-motivazione { font-size: 0.96rem; line-height: 1.7; color: var(--text); }
.result-secondary {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.result-secondary-title { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.25rem; font-weight: 600; }
.result-secondary-name { font-size: 1.15rem; font-weight: 700; color: var(--secondary); }
.quiz-reset { font-size: 0.88rem; color: var(--text-muted); text-decoration: underline; cursor: pointer; background: none; border: none; margin-top: 0.5rem; }
.quiz-reset:hover { color: var(--primary); }

/* ===== FILTERS ===== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.filter-label { font-size: 0.83rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.filter-select, .filter-sort {
  padding: 0.4rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A6A62' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.8rem;
}
.filter-select:focus, .filter-sort:focus { outline: none; border-color: var(--primary); }
.filter-divider { width: 1px; height: 24px; background: var(--border); }

/* ===== CARDS GRID ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card.highlighted {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(224,123,42,0.18), var(--shadow-lg);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  background: var(--bg2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
}
.card-img-placeholder {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 3.5rem;
  background: var(--bg2);
}

.card-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.badge-gold { background: var(--gold-bg); color: var(--gold); border: 1.5px solid #F0D060; }
.badge-blue { background: var(--blue-bg); color: var(--blue); border: 1.5px solid #BFDBFE; }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1.5px solid #DDD6FE; }
.badge-green { background: var(--green-bg); color: var(--green); border: 1.5px solid #A7F3D0; }
.badge-teal { background: var(--teal-bg); color: var(--teal); border: 1.5px solid #99F6E4; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1.5px solid #FCD34D; }
.badge-gray { background: var(--gray-bg); color: var(--gray); border: 1.5px solid #E5E7EB; }
.badge-red { background: var(--red-bg); color: var(--red); border: 1.5px solid #FCA5A5; }

.card-body {
  padding: 1.1rem 1.25rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-brand { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.card-name { font-size: 1.1rem; font-weight: 800; color: var(--secondary); margin: 0.1rem 0 0.7rem; line-height: 1.3; }
.card-prezzo { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-bottom: 0.75rem; }

.ratings { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.9rem; }
.rating-row { display: flex; align-items: center; gap: 0.5rem; }
.rating-label { font-size: 0.8rem; color: var(--text-muted); width: 90px; flex-shrink: 0; }
.rating-dots { display: flex; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.dot.filled { background: var(--primary); }
.dot.filled-green { background: var(--green); }

.card-note-it {
  font-size: 0.78rem;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.75rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}
.btn-details {
  flex: 1;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-details:hover { background: var(--primary); color: white; }
.btn-amazon {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  background: #FF9900;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--transition);
}
.btn-amazon:hover { background: #E88900; text-decoration: none; }

/* Card expanded details */
.card-details {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1.5px solid var(--border-light);
  margin-top: 0.75rem;
  padding-top: 1rem;
}
.card-details.open { display: block; }

.details-section { margin-bottom: 1rem; }
.details-section:last-child { margin-bottom: 0; }
.details-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.4rem; }
.details-text { font-size: 0.9rem; line-height: 1.6; color: var(--text); }

.pro-contro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.pro-list, .contro-list { font-size: 0.87rem; }
.pro-list li, .contro-list li {
  padding: 0.2rem 0;
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.5;
  color: var(--text);
}
.pro-list li::before { content: '✓'; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.contro-list li::before { content: '✗'; position: absolute; left: 0; color: var(--red); font-weight: 700; }

.links-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  transition: all var(--transition);
}
.link-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.link-chip.amazon { background: #FFF8F0; border-color: #FF9900; color: #CC7700; }
.link-chip.amazon:hover { background: #FF9900; color: white; }

.nota-it-box {
  background: var(--warning-bg);
  border: 1.5px solid #FCD34D;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.87rem;
  color: var(--text);
  margin-top: 0.75rem;
}

/* No results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ===== TABLE ===== */
#tabella-section { background: var(--bg2); }
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
  min-width: 700px;
}
thead { background: linear-gradient(to bottom, #FFF0E0, #FFE8CC); }
th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--transition);
  border-bottom: 2px solid var(--border);
}
th:hover { background: #FFE0CC; }
th .sort-icon { display: inline-block; margin-left: 0.3rem; opacity: 0.4; font-size: 0.75rem; }
th.sort-asc .sort-icon::after { content: ' ↑'; opacity: 1; }
th.sort-desc .sort-icon::after { content: ' ↓'; opacity: 1; }
th:not(.sort-asc):not(.sort-desc) .sort-icon::after { content: ' ↕'; }

tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-light); }
td { padding: 0.75rem 1rem; vertical-align: middle; }
.td-nome { font-weight: 700; color: var(--secondary); }
.td-marca { font-size: 0.82rem; color: var(--text-muted); display: block; font-weight: 400; }
.td-prezzo { font-weight: 700; color: var(--primary); white-space: nowrap; }
.td-dots { display: flex; gap: 3px; }
.td-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.td-dot.on { background: var(--primary); }
.td-dot.on-green { background: var(--green); }
.td-note { font-size: 0.83rem; color: var(--text-muted); max-width: 220px; }
.td-badge { }

/* ===== DA EVITARE ===== */
.evitare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.evitare-card {
  background: var(--red-bg);
  border: 1.5px solid #FCA5A5;
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.evitare-nome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--red);
  margin-bottom: 0.5rem;
}
.evitare-motivo { font-size: 0.88rem; color: #6B2222; line-height: 1.6; }
.evitare-tipo { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; font-style: italic; }

/* ===== CAVEATS ===== */
.caveats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.caveat-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.caveat-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 0.1rem; }
.caveat-title { font-size: 0.93rem; font-weight: 700; color: var(--secondary); margin-bottom: 0.25rem; }
.caveat-text { font-size: 0.87rem; color: var(--text-muted); line-height: 1.6; }

/* ===== FOOTER ===== */
footer {
  background: var(--secondary);
  color: #D4C0B8;
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.7;
}
footer a { color: #E8C9A8; }
footer strong { color: white; }
.footer-note { opacity: 0.7; margin-top: 0.5rem; font-size: 0.8rem; }

/* ===== SCROLL TO TOP ===== */
#scrollTop {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(224,123,42,0.35);
  cursor: pointer;
  border: none;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 200;
}
#scrollTop.visible { opacity: 1; transform: translateY(0); pointer-events: all; }
#scrollTop:hover { background: var(--primary-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .hero { padding: 2rem 1rem 1.75rem; }
  .section { padding: 2rem 1rem; }
  .quiz-options { grid-template-columns: 1fr 1fr; }
  .pro-contro { grid-template-columns: 1fr; }
  .evitare-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: flex-start; }
  .filter-divider { display: none; }
  .quiz-card { padding: 1.25rem 1rem; }
}
@media (max-width: 400px) {
  .quiz-options { grid-template-columns: 1fr; }
}

/* ===== UTILITY ===== */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
