/**
 * sidecart.css — Weshopping, wssidecart 1.1.0
 * 1.1.0: --wssc-accent arriva dal guscio (impostazione WSSC_ACCENT); la versione scura si calcola.
 * Carrello laterale: 440px a destra su desktop, schermo intero sotto i 576px.
 * Colori e caratteri nelle variabili qui sotto (il carattere è quello del tema).
 */
.wssc {
  --wssc-accent: #bfa46f; /* sostituito dallo style del guscio */
  --wssc-accent-dark: #a88c58;
  --wssc-accent-dark: color-mix(in srgb, var(--wssc-accent) 82%, #000);
  --wssc-text: #222;
  --wssc-muted: #6f6f6f;
  --wssc-line: #e6e6e6;
  --wssc-bg: #fff;
  --wssc-soft: #f7f5f1;
  --wssc-sale: #b0413e;
  --wssc-w: 440px;
  position: fixed;
  inset: 0;
  z-index: 100000;
  font-size: 14px;
  line-height: 1.4;
  color: var(--wssc-text);
}
.wssc[hidden] { display: none; }
html.wssc-lock, html.wssc-lock body { overflow: hidden; }

.wssc-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  opacity: 0;
  transition: opacity .25s ease;
}
.wssc-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--wssc-w);
  max-width: 100%;
  height: 100%;
  background: var(--wssc-bg);
  box-shadow: -8px 0 30px rgba(0, 0, 0, .15);
  transform: translateX(100%);
  transition: transform .3s ease;
  outline: none;
  overflow: hidden;
}
.wssc.is-open .wssc-overlay { opacity: 1; }
.wssc.is-open .wssc-panel { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .wssc-overlay, .wssc-panel { transition: none; }
}
@media (max-width: 575px) {
  .wssc { --wssc-w: 100%; }
}

/* colonna: testata e spedizione fisse, centro scorrevole, totali e pulsante sempre in basso */
.wssc-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.wssc-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--wssc-line);
}
.wssc-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--wssc-text);
}
.wssc-x {
  display: inline-flex;
  padding: 6px;
  margin: -6px -6px -6px 0;
  border: 0;
  background: none;
  color: var(--wssc-text);
  cursor: pointer;
}
.wssc-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* spedizione gratuita */
.wssc-ship {
  flex: 0 0 auto;
  padding: 12px 20px 14px;
  border-bottom: 1px solid var(--wssc-line);
  text-align: center;
}
.wssc-ship p { margin: 0 0 8px; font-size: 13px; }
.wssc-ship-bar { height: 4px; background: var(--wssc-line); border-radius: 2px; overflow: hidden; }
.wssc-ship-bar span { display: block; height: 100%; background: var(--wssc-accent); transition: width .4s ease; }
.wssc-ship.is-reached p { font-weight: 600; }

/* messaggi ed errori */
.wssc-msg {
  margin: 14px 20px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--wssc-sale);
  background: #fbf0ef;
  font-size: 13px;
}
.wssc-msg p { margin: 0; }
.wssc-msg p + p { margin-top: 4px; }

/* carrello vuoto */
.wssc-empty { padding: 48px 20px; text-align: center; }
.wssc-empty p { margin: 0 0 18px; font-size: 15px; }

/* righe prodotto */
.wssc-lines { list-style: none; margin: 0; padding: 0; }
.wssc-line {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--wssc-line);
}
.wssc-line-img img { display: block; width: 96px; height: 96px; object-fit: cover; background: var(--wssc-soft); }
.wssc-line-info { min-width: 0; }
.wssc-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 6px;
  border: 1px solid var(--wssc-sale);
  color: var(--wssc-sale);
  font-size: 11px;
  font-weight: 700;
}
.wssc-line-name {
  display: block;
  color: var(--wssc-text);
  font-weight: 600;
  text-decoration: none;
}
.wssc-line-name:hover { text-decoration: underline; color: var(--wssc-text); }
.wssc-line-attr { margin: 6px 0 0; color: var(--wssc-muted); font-size: 12px; }
.wssc-line-attr strong { font-weight: 600; color: var(--wssc-text); }
.wssc-sep { margin: 0 6px; color: var(--wssc-line); }
.wssc-gift { margin: 8px 0 0; font-size: 12px; font-weight: 700; color: var(--wssc-accent-dark); text-transform: uppercase; }
.wssc-line-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.wssc-qty { display: inline-flex; align-items: center; border: 1px solid var(--wssc-line); }
.wssc-qty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--wssc-text);
  cursor: pointer;
}
.wssc-qty-btn:hover { background: var(--wssc-soft); }
.wssc-qty-val { min-width: 28px; text-align: center; font-weight: 600; }
.wssc-line-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; }
.wssc-price { font-weight: 700; }
.wssc-old { color: var(--wssc-muted); text-decoration: line-through; font-size: 12px; }
.wssc-old:empty { display: none; }
.wssc-off { color: var(--wssc-sale); font-size: 12px; font-weight: 700; }
.wssc-unit { color: var(--wssc-muted); font-size: 11px; }

/* link e pulsanti */
.wssc-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--wssc-text);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.wssc-link:hover { color: var(--wssc-accent-dark); }
.wssc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--wssc-accent);
  background: var(--wssc-accent);
  color: #fff;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.wssc-btn:hover, .wssc-btn:focus { background: var(--wssc-accent-dark); border-color: var(--wssc-accent-dark); color: #fff; text-decoration: none; }
.wssc-btn--outline { background: #fff; color: var(--wssc-text); border-color: var(--wssc-text); }
.wssc-btn--outline:hover, .wssc-btn--outline:focus { background: var(--wssc-text); border-color: var(--wssc-text); color: #fff; }
.wssc-btn--small { min-height: 40px; padding: 8px 14px; font-size: 12px; }

/* codice sconto */
.wssc-voucher { border-bottom: 1px solid var(--wssc-line); }
.wssc-voucher-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border: 0;
  background: none;
  color: var(--wssc-text);
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.wssc-voucher-toggle svg { transition: transform .2s ease; }
.wssc-voucher.is-open .wssc-voucher-toggle svg { transform: rotate(180deg); }
.wssc-voucher-body { display: none; padding: 0 20px 16px; }
.wssc-voucher.is-open .wssc-voucher-body { display: block; }
.wssc-voucher-form { display: flex; gap: 8px; }
.wssc-voucher-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--wssc-line);
  font-size: 16px; /* 16px: iPhone non ingrandisce la pagina */
}
.wssc-vouchers { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.wssc-vouchers li { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.wssc-vouchers li span:first-child { flex: 1 1 auto; font-weight: 600; }

/* spesso acquistati insieme */
.wssc-acc { padding: 22px 0 24px; }
.wssc-acc-head { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 14px; }
.wssc-acc-head h3 { margin: 0; font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--wssc-text); }
.wssc-acc-nav { display: flex; gap: 6px; }
.wssc-acc-nav button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--wssc-line);
  border-radius: 50%;
  background: #fff;
  color: var(--wssc-text);
  cursor: pointer;
}
.wssc-acc-nav button:hover { border-color: var(--wssc-text); }
.wssc-acc-track {
  display: flex;
  gap: 12px;
  padding: 0 20px 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.wssc-card {
  flex: 0 0 62%;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-snap-align: start;
}
@media (max-width: 575px) {
  .wssc-card { flex-basis: 58%; }
}
.wssc-card-img img { display: block; width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; background: var(--wssc-soft); }
.wssc-card-name {
  color: var(--wssc-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wssc-card-name:hover { text-decoration: underline; color: var(--wssc-text); }
.wssc-card-price { margin: 0; }
.wssc-card-select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--wssc-line);
  background: #fff;
  color: var(--wssc-text);
  font-size: 14px;
}
.wssc-card-add { margin-top: auto; width: 100%; }

/* in basso: totali e acquisto */
.wssc-foot {
  flex: 0 0 auto;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--wssc-line);
  background: var(--wssc-bg);
  box-shadow: 0 -6px 16px rgba(0, 0, 0, .05);
}
.wssc-totals { margin: 0 0 12px; font-size: 13px; }
.wssc-totals div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.wssc-totals dt { font-weight: 400; color: var(--wssc-muted); }
.wssc-totals dd { margin: 0; }
.wssc-totals .wssc-total { padding-top: 6px; font-size: 16px; }
.wssc-totals .wssc-total dt, .wssc-totals .wssc-total dd { color: var(--wssc-text); font-weight: 700; }
.wssc-btn--checkout { width: 100%; min-height: 52px; font-size: 15px; }
.wssc-viewcart { display: block; margin: 10px auto 0; text-align: center; font-size: 13px; }

/* caricamento */
.wssc-spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .55);
}
.wssc.is-busy .wssc-spinner { display: flex; }
.wssc-spinner span {
  width: 32px;
  height: 32px;
  border: 3px solid var(--wssc-line);
  border-top-color: var(--wssc-accent);
  border-radius: 50%;
  animation: wssc-spin .8s linear infinite;
}
@keyframes wssc-spin { to { transform: rotate(360deg); } }
