:root {
  --viola: #6a1b9a;
  --viola-scuro: #4a148c;
  --teal: #17a2b8;
  --giallo: #ffc107;
  --rosa: #e91e8c;
  --arancio: #ff7a00;
  --blu: #1b3a6a;
  --bg: #f7f5fb;
  --card: #ffffff;
  --testo: #26202e;
  --grigio: #6b6577;
  --bordo: #ece7f2;
  --ok: #2e7d32;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(74, 20, 140, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--testo);
  line-height: 1.5;
}
a { color: var(--viola); }

/* ---------- Header ---------- */
.topbar {
  background: linear-gradient(120deg, var(--viola) 0%, var(--viola-scuro) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(0,0,0,.15);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand .promo { font-size: 12px; letter-spacing: 3px; opacity: .85; font-weight: 600; }
.brand .name { font-size: 22px; font-weight: 800; }
.brand .name span { color: var(--giallo); }
.topbar .spacer { flex: 1; }
.search {
  flex: 1 1 240px; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); border-radius: 999px; padding: 8px 16px;
}
.search input {
  border: none; background: transparent; color: #fff; outline: none; width: 100%; font-size: 15px;
}
.search input::placeholder { color: rgba(255,255,255,.7); }
.cart-btn {
  background: var(--giallo); color: var(--blu); border: none; cursor: pointer;
  font-weight: 700; font-size: 15px; padding: 10px 18px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px; position: relative;
}
.cart-btn .badge {
  background: var(--rosa); color: #fff; border-radius: 999px; font-size: 12px;
  min-width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1180px; margin: 22px auto 8px; padding: 0 20px;
}
.hero-card {
  background: linear-gradient(120deg, var(--teal), var(--viola));
  color: #fff; border-radius: var(--radius); padding: 22px 26px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.hero-card h1 { margin: 0; font-size: 26px; }
.hero-card p { margin: 6px 0 0; opacity: .95; }
.hero-gift {
  background: rgba(255,255,255,.18); border-radius: 12px; padding: 12px 18px; font-weight: 600;
  display: inline-block;
}
.hero-photo {
  width: 300px; max-width: 42%; border-radius: 12px; object-fit: cover;
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}
@media (max-width: 640px) {
  .hero-photo { max-width: 100%; width: 100%; margin-top: 14px; }
}

/* ---------- Sezioni home (design volantino) ---------- */
.cart-btn { text-decoration: none; }

/* Banner consenso cookie */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  background: var(--blu); color: #fff; padding: 14px 18px;
  display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap;
  box-shadow: 0 -2px 14px rgba(0,0,0,.22);
}
.cookie-text { font-size: 14px; max-width: 720px; line-height: 1.5; }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn { border: none; border-radius: 8px; padding: 10px 20px; font-weight: 700; cursor: pointer; font-size: 14px; }
.cookie-btn.accept { background: var(--giallo); color: var(--viola-scuro); }
.cookie-btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); }

/* Sezioni composte da una sola immagine (testata, Legami, coperture) */
.img-band { padding: 20px 16px; text-align: center; }
.sec-img { display: block; width: 100%; max-width: 1120px; height: auto; margin: 0 auto; border-radius: 14px; }
.fred, .section-title, .eco-hero h1, .step h3, .feat h3 { font-family: 'Fredoka', system-ui, sans-serif; }

.eco-band { padding: 46px 20px; }
.eco-inner { max-width: 1120px; margin: 0 auto; }
.section-title { font-weight: 700; font-size: 30px; text-align: center; margin: 0 0 6px; color: var(--viola-scuro); }
.lead { text-align: center; font-size: 16px; max-width: 560px; margin: 4px auto 18px; }
.kicker-pill { display: inline-block; background: var(--blu); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; letter-spacing: 1px; }

/* Apertura */
.eco-hero { background: linear-gradient(135deg, var(--viola), var(--viola-scuro)); color: #fff; text-align: center; }
.eco-hero .kicker { font-size: 13px; letter-spacing: 3px; font-weight: 600; opacity: .85; }
.eco-hero h1 { font-size: clamp(42px, 9vw, 76px); font-weight: 700; line-height: 1; margin: 8px 0 4px; }
.eco-hero h1 .g { color: var(--giallo); }
.eco-hero h1 .r { color: var(--rosa); }
.eco-hero p { font-size: 18px; max-width: 520px; margin: 12px auto 0; opacity: .96; }
.eco-cta { display: inline-flex; align-items: center; gap: 8px; background: var(--giallo); color: var(--viola-scuro); font-weight: 700; font-size: 18px; padding: 13px 26px; border-radius: 999px; text-decoration: none; margin-top: 18px; }
.eco-cta:hover { filter: brightness(.96); }

/* Passi */
.eco-steps { background: #f2eef8; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 14px; }
.step { background: #fff; border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.step .top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.step .num { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 19px; }
.step i { font-size: 26px; }
.step h3 { font-weight: 600; font-size: 19px; color: var(--viola); margin: 0; }
.step p { font-size: 14.5px; color: var(--grigio); margin: 4px 0 0; line-height: 1.5; }

/* Feature card generiche */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 8px; }
.feat { background: #fff; border-radius: 14px; padding: 16px; }
.feat i { font-size: 26px; }
.feat h3 { font-weight: 600; font-size: 17px; margin: 6px 0 2px; color: var(--viola-scuro); }
.feat p { font-size: 14px; color: var(--grigio); margin: 0; line-height: 1.45; }

/* Passa in negozio */
.eco-shop { background: #0f6e56; color: #fff; }
.eco-shop .section-title, .eco-shop .lead { color: #fff; }
.eco-shop .feat h3 { color: #04342c; }

/* Legami */
.eco-legami { background: linear-gradient(135deg, var(--rosa), var(--arancio)); color: #fff; }
.eco-legami .lead { color: #fff; }
.badge-brand { background: #fff; color: var(--rosa); padding: 0 10px; border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.92); color: #993556; font-weight: 600; padding: 9px 16px; border-radius: 999px; }

/* Coperture libri */
.eco-covers { background: #e1f5ee; }
.eco-covers .section-title { color: #0f6e56; }
.eco-covers .feat h3 { color: #0f6e56; }

/* Social */
.eco-social { background: var(--blu); color: #fff; }
.eco-social .section-title { color: #fff; }
.social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 8px; }
.social-grid a { display: flex; align-items: center; gap: 10px; background: #fff; color: var(--blu); border-radius: 12px; padding: 14px 16px; text-decoration: none; font-weight: 600; }
.social-grid a:hover { filter: brightness(.97); }
.social-grid a i { font-size: 24px; }

/* Intestazione del catalogo (titolo + ricerca) */
.catalog-head {
  max-width: 1180px; margin: 30px auto 0; padding: 0 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.catalog-head h2 { margin: 0; font-size: 26px; color: var(--viola-scuro); flex: 1 1 auto; }
.catalog-head .search {
  background: #fff; border: 1px solid var(--bordo); flex: 1 1 260px; max-width: 420px;
}
.catalog-head .search input { color: var(--testo); }
.catalog-head .search input::placeholder { color: var(--grigio); }
.catalog-head .search span { color: var(--viola); }

/* ---------- Layout catalogo ---------- */
.wrap { max-width: 1180px; margin: 20px auto; padding: 0 20px; display: flex; gap: 24px; align-items: flex-start; }
.catalog { flex: 1; min-width: 0; }
.group-title {
  font-size: 20px; font-weight: 800; color: var(--viola-scuro);
  margin: 26px 0 12px; display: flex; align-items: center; gap: 10px;
}
.group-title::before { content: ""; width: 6px; height: 22px; background: var(--giallo); border-radius: 3px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.product {
  background: var(--card); border: 1px solid var(--bordo); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.product:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(74,20,140,.14); }
.product .img {
  height: 140px; background: #faf8fd center/contain no-repeat;
  display: flex; align-items: center; justify-content: center; color: #c9bfd6; font-size: 40px;
  border-bottom: 1px solid var(--bordo);
}
.product .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product .code { font-family: monospace; font-size: 12px; color: var(--grigio); }
.product .desc { font-weight: 600; font-size: 14px; flex: 1; }
.product .price { font-size: 18px; font-weight: 800; color: var(--viola); }
.product .price small { font-weight: 500; font-size: 11px; color: var(--grigio); }
.add {
  margin-top: 4px; border: none; background: var(--viola); color: #fff; font-weight: 700;
  padding: 9px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.add:hover { background: var(--viola-scuro); }
.qty-inline { display: flex; align-items: center; gap: 8px; }
.qty-inline button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--bordo);
  background: #fff; font-size: 18px; cursor: pointer; color: var(--viola);
}
.qty-inline .n { flex: 1; text-align: center; font-weight: 700; }

/* ---------- Carrello ---------- */
.cart {
  width: 340px; flex-shrink: 0; background: var(--card); border: 1px solid var(--bordo);
  border-radius: var(--radius); box-shadow: var(--shadow); position: sticky; top: 92px;
  max-height: calc(100vh - 110px); display: flex; flex-direction: column;
}
.cart h2 { margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--bordo); font-size: 17px; }
.cart-items { overflow-y: auto; padding: 8px 12px; flex: 1; }
.cart-empty { color: var(--grigio); text-align: center; padding: 30px 12px; font-size: 14px; }
.ci { display: flex; gap: 8px; padding: 10px 6px; border-bottom: 1px solid var(--bordo); align-items: center; }
.ci .info { flex: 1; min-width: 0; }
.ci .info .d { font-size: 13px; font-weight: 600; }
.ci .info .c { font-size: 11px; color: var(--grigio); font-family: monospace; }
.ci .qty { display: flex; align-items: center; gap: 4px; }
.ci .qty button { width: 26px; height: 26px; border: 1px solid var(--bordo); background: #fff; border-radius: 6px; cursor: pointer; }
.ci .qty span { min-width: 22px; text-align: center; font-weight: 700; font-size: 13px; }
.ci .line { font-weight: 700; font-size: 13px; min-width: 58px; text-align: right; color: var(--viola); }
.cart-foot { padding: 14px 18px; border-top: 1px solid var(--bordo); }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; margin-bottom: 12px; }
.cart-total .v { color: var(--viola); }
.btn-primary {
  width: 100%; border: none; background: var(--giallo); color: var(--blu); font-weight: 800;
  padding: 13px; border-radius: 10px; cursor: pointer; font-size: 16px;
}
.btn-primary:hover { filter: brightness(.96); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* Pulsante flottante "Concludi l'ordine" (sempre raggiungibile) */
.fab-checkout {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  background: var(--giallo); color: var(--viola-scuro); border: none;
  border-radius: 999px; padding: 13px 22px; font-weight: 800; font-size: 15px;
  cursor: pointer; box-shadow: 0 10px 26px rgba(74,20,140,.30);
}
.fab-checkout:hover { filter: brightness(.97); }
.fab-checkout .fab-count {
  background: var(--rosa); color: #fff; border-radius: 999px;
  min-width: 24px; height: 24px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 13px; padding: 0 6px;
}
.fab-checkout .fab-total { font-weight: 800; }
@media (max-width: 640px) {
  .fab-checkout { left: 12px; right: 12px; bottom: 12px; justify-content: center; padding: 15px; font-size: 16px; }
}

/* ---------- Modal checkout ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(38,20,60,.55); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 30px 16px;
}
.overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); max-width: 560px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head {
  background: var(--viola); color: #fff; padding: 18px 22px; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-head .x { background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; line-height: 1; }
.modal-body { padding: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--grigio); }
.field label .req { color: var(--rosa); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--bordo); border-radius: 9px;
  font-size: 15px; font-family: inherit; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--viola); }
.row2 { display: flex; gap: 12px; }
.row2 .field { flex: 1; }
.prefs { display: flex; gap: 10px; flex-wrap: wrap; }
.prefs label {
  flex: 1; min-width: 100px; border: 1px solid var(--bordo); border-radius: 9px; padding: 10px;
  text-align: center; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--testo);
}
.prefs input { display: none; }
.prefs input:checked + span { color: var(--viola); }
.prefs label:has(input:checked) { border-color: var(--viola); background: #f5f0fa; }
.hint { font-size: 12px; color: var(--grigio); margin-top: 4px; }
.msg { padding: 11px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; display: none; }
.msg.err { background: #fdecec; color: #c62828; display: block; }
.summary-line { display: flex; justify-content: space-between; font-size: 15px; padding: 6px 0; }
.summary-tot { border-top: 1px solid var(--bordo); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 18px; }

/* ---------- Conferma ---------- */
.success { text-align: center; padding: 20px; }
.success .check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff;
  font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.success h2 { margin: 0 0 8px; color: var(--ok); }

/* ---------- Footer ---------- */
.footer {
  background: var(--blu); color: rgba(255,255,255,.85); text-align: center;
  padding: 22px; margin-top: 40px; font-size: 14px;
}
.footer strong { color: #fff; }

@media (max-width: 860px) {
  .wrap { flex-direction: column; }
  .cart { width: 100%; position: static; max-height: none; }
}
@media (max-width: 640px) {
  .eco-band { padding: 22px 12px; }
  .img-band { padding: 12px 8px; }
  .catalog-head { margin-top: 18px; gap: 10px; }
  .catalog-head h2 { font-size: 22px; flex-basis: 100%; }
  .section-title { font-size: 23px; }
  .wrap { margin-top: 14px; }
}
