/* ===== Base ===== */
:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(17, 24, 39, .10);
  --border-2: rgba(17, 24, 39, .14);
  --shadow: 0 10px 30px rgba(17, 24, 39, .08);
  --shadow-sm: 0 6px 16px rgba(17, 24, 39, .06);
  --radius: 16px;
  --radius-sm: 12px;
  --accent: #111827;
  /* neutro (poi lo brandizziamo) */
  --danger: #e53935;
  --shop-topbar-height: 56px;
}


.shop-topbar {
  height: var(--shop-topbar-height);
}

body {
  padding-top: var(--shop-topbar-height);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

h1,
h2,
h3 {
  margin: 0 0 10px 0;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 20px;
  margin-top: 18px;
}

h3 {
  font-size: 16px;
}

a {
  color: inherit;
}

/* ===== Helpers ===== */
.muted {
  color: var(--muted);
  opacity: 1;
}

.hidden {
  display: none !important;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}


.shop-topbar {
  position: fixed;
  /* 👈 non sticky */
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  /* più alto del resto */
  display: flex;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.98);
}


.shop-brand {
  font-weight: 800;
  text-decoration: none;
}

/* Carrello button */
.shop-cart-btn {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .08s ease, box-shadow .15s ease;
}

.shop-cart-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.shop-cart-btn img {
  display: block;
}

/* Badge: ancorato “fuori” dall’icona, sempre uguale */
.shop-cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 2px solid #fff;
  /* stacca dal bottone */
}

/* ===== Layout pagina ===== */
.shop-page {
  max-width: 100%;
  width: calc(100% - 10px);
  margin: 0 auto;
  padding: 18px 16px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
}

@media (max-width: 900px) {
  .shop-page {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.shop-sidebar {
  position: sticky;
  top: 74px;
  align-self: start;

  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.shop-cat-link {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}

.shop-cat-link:hover {
  background: rgba(17, 24, 39, .04);
  border-color: var(--border);
}

/* ===== Griglia prodotti ===== */
.shop-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 320px);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

@media (max-width: 900px) {
  .shop-grid {
    grid-template-columns: 1fr;
  }
}

/* Card prodotto */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.shop-product h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.shop-product p {
  margin: 0 0 12px 0;
}



/* ===== Bottoni ===== */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== Drawer carrello ===== */
.shop-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  z-index: 9998;
  background: rgba(17, 24, 39, .45);
}

.shop-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: #fff;
  z-index: 9999;

  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.shop-cart-drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-cart-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
}

.shop-cart-items {
  padding: 10px 16px;
  overflow: auto;
  flex: 1;
}

.shop-cart-summary {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(17, 24, 39, .02);
}

.shop-cart-summary .row {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
}

.shop-cart-summary .row.total {
  font-size: 18px;
  font-weight: 900;
}

/* Riga item */
.shop-cart-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 10px 0;
  background: #fff;
}

.shop-cart-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.shop-cart-remove {
  border: 0;
  background: transparent;
  color: #c62828;
  cursor: pointer;
  font-weight: 700;
}

.shop-cart-qty {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.shop-cart-qty button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}

/* ===== Modern polish ===== */
.shop-page {
  align-items: start;
}

.shop-page h1 {
  font-size: 42px;
  letter-spacing: -0.03em;
  margin: 12px 0 18px;
}

.shop-sidebar {
  padding: 16px;
}

.shop-sidebar h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(17, 24, 39, .55);
  margin: 0 0 10px;
}

.shop-cat-link {
  font-weight: 700;
  padding: 10px 12px;
}

.shop-cat-link .count {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .06);
  border: 1px solid rgba(17, 24, 39, .10);
  font-size: 12px;
  color: rgba(17, 24, 39, .75);
}

/* Card più “premium” */
.card {
  border-radius: 18px;
  padding: 18px;
}

.shop-grid {
  gap: 18px;
}

.shop-product h3 {
  font-size: 18px;
  font-weight: 800;
}

.shop-product p {
  color: rgba(17, 24, 39, .72);
  line-height: 1.5;
}

/* Riga prezzo + badge */
.shop-product .price-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 12px;
}

.badge {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0369a1;
  font-weight: 700;
}

/* Pulsanti consistenti */
.btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
}

.btn-primary {
  background: linear-gradient(180deg, #0f172a, #020617);
  border: none;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .45);
}

/* Fix “broken image” (se hai <img> senza src valido) */
img {
  color: transparent;
}

.shop-main {
  min-width: 0;
}





.shop-section h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.shop-main h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 10px 0 18px;
}

.shop-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shop-section-head {
  display: flex;
  align-items: center;
  justify-content: start;
  margin: 0 0 10px;
  background-color: var(--colore-primario);
  color: white;
  padding: 10px;
  border-radius: 8px;
  gap: 5px;
}

.shop-section-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.shop-section-count {
  font-size: 12px;
  opacity: .6;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
  color: black;
  font-weight: 900;
}

.shop-row-scroll {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 12px;
scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  padding: 10px;
}

/* ogni card deve avere una larghezza "da carousel" */
.shop-row-scroll>.shop-product {
  flex: 0 0 320px;
  /* ✅ larghezza fissa per scroll */
  scroll-snap-align: start;
}

.shop-row-scroll::-webkit-scrollbar {
  height: 10px;
}

.shop-row-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .12);
  border-radius: 999px;
}

.shop-row-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, .04);
  border-radius: 999px;
}



.shop-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  background: #eee;
}


.shop-card-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.shop-product .row strong {
  font-size: 18px;
  font-weight: 900;
}

.shop-card-desc {
  font-size: 13px;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
}

.shop-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #111;
}

.shop-cat-link:hover {
  background: rgba(0, 0, 0, .04);
}

.shop-pill {
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* === Associazione (select) dentro card shop === */

/* evita overflow che rompe la riga orizzontale */
.shop-product {
  min-width: 0;
}

.shop-card-body {
  padding: 12px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* wrapper della select (consigliato) */
.shop-assoc-wrap {
  width: 100%;
  min-width: 0;
}

/* la select vera */
.shop-assoc-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;

  height: 40px;
  padding: 0 10px;

  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 10px;

  background: #fff;
  color: inherit;

  font-size: 14px;
  line-height: 40px;

  /* evita che su iOS zoomi la pagina */
  -webkit-appearance: none;
  appearance: none;
}

/* stato disabilitato: visivo ma stabile */
.shop-assoc-select:disabled {
  opacity: .6;
  cursor: not-allowed;
  background: rgba(0, 0, 0, .03);
}

/* piccola label sopra la select (se la usi) */
.shop-assoc-label {
  display: block;
  font-size: 12px;
  opacity: .75;
  margin: 0 0 6px 2px;
}

/* se vuoi un'icona freccia a destra senza rompere */
.shop-assoc-wrap {
  position: relative;
}

.shop-assoc-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: .55;
  font-size: 14px;
}

/* spazio extra al testo per non sovrapporsi alla freccia */
.shop-assoc-select {
  padding-right: 30px;
}

/* Preview associazione: layout stabile */
.shop-assoc-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.03);
  overflow: hidden;
  /* evita che qualcosa sfondi */
}

/* Thumb: dimensione fissa, non può mai allargare la card */
.shop-assoc-thumb {
  width: 100px;
  height: 56px;
  flex: 0 0 100px;
  display: block;
  object-fit: cover;
  border-radius: 2px;
  max-width: 100px;
  max-height: 56px;
}

/* Testo a destra: non deve spingere */
.shop-assoc-meta {
  flex: 1;
  min-width: 0;
  /* fondamentale per ellipsis in flex */
}

.shop-assoc-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-assoc-link {
  display: inline-block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.shop-assoc-thumb[hidden] {
  display: none !important;
}

.shop-assoc-preview[hidden] {
  display: none !important;
}



/*Patch Css style 1 */
.shop-product.card {
  border: none;
  border-radius: 20px;
  background: #ffffff;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, .08),
    0 1px 0 rgba(255, 255, 255, .8) inset;
  transition: transform .2s ease, box-shadow .25s ease;
  will-change: transform;
  transform: translateZ(0);
}

.shop-product.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0,0,0,.12);
}

.shop-card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #e5e7eb, #f9fafb);
}

.shop-card-body {
  padding: 6px 2px 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-card-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -.01em;
}

.shop-card-desc {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(17, 24, 39, .65);
  max-height: 2.8em;
  overflow: hidden;
}

.shop-product .row strong {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.badge {
  background: rgba(15, 23, 42, .06);
  border: none;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
}

.btn-primary {
  background: linear-gradient(180deg, #0f172a, #020617);
  border: none;
  color: #fff;
  font-weight: 900;
  letter-spacing: .02em;
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(2, 6, 23, .35);
  text-align: center;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(2, 6, 23, .5);
}

.shop-assoc-select {
  border-radius: 12px;
  background: rgba(0, 0, 0, .02);
  border: 1px solid rgba(0, 0, 0, .08);
  font-size: 13px;
}

.shop-account-box {
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 10px;
  gap: 10px;
}

.shop-subtitle {
  font-size: 0.9rem;
  /* margin-bottom: 12px; */
  opacity: 0.8;
}

.shop-account-email {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 8px;
  word-break: break-all;
}

.shop-account-credits {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.shop-account-credits strong {
  font-size: 1.2rem;
}

@media (max-width: 520px) {
  .shop-row-scroll>.shop-product {
    flex-basis: 85vw;
    /* card grande su mobile */
  }
}

/* ===========================
   SIDEBAR TOGGLE (DESKTOP/MOBILE)
   =========================== */

/* titolo desktop */
.shop-sidebar-heading {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(17, 24, 39, .55);
  margin: 0 0 10px;
}

/* toggle nascosto su desktop */
.shop-sidebar-toggle {
  display: none;
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.shop-sidebar-dots {
  font-size: 20px;
  line-height: 1;
  transition: transform .25s ease;
}

/* desktop: contenuto sempre visibile */
.shop-sidebar-content {
  max-height: none;
  opacity: 1;
  transform: none;
  overflow: visible;
}

/* mobile */
@media (max-width: 768px) {
  .shop-sidebar-toggle {
    display: flex;
  }

  /* su mobile NON vogliamo doppio titolo */
  .shop-sidebar-heading {
    display: none;
  }

  .shop-sidebar-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-6px);
    transition:
      max-height .35s cubic-bezier(.4, 0, .2, 1),
      opacity .25s ease,
      transform .25s ease;
  }

  .shop-sidebar.is-open .shop-sidebar-content {
    max-height: 1400px;
    /* abbastanza per categorie+account */
    opacity: 1;
    transform: translateY(0);
  }

  .shop-sidebar.is-open .shop-sidebar-dots {
    transform: rotate(90deg);
  }
}

/* (opzionale) riduce “scatto” sticky in mobile */
@media (max-width: 768px) {
  .shop-sidebar {
    position: relative;
    /* invece di sticky */
    top: auto;
  }
}