/* ============================================================
   IL MIO INVITO — CARRELLO (2026-10-25)
   Icona fissa in basso a sinistra (a destra c'è la live chat) + pannello laterale da destra.
   Richiede main.css (variabili colore/font). Logica in assets/js/cart.js.
   ============================================================ */

/* Icona fissa */
.wl-cart-fab {
  position: fixed;
  left: var(--sp-6);
  bottom: var(--sp-6);
  z-index: 95;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--c-gold-lt);
  background: var(--c-white);
  color: var(--c-dark);
  box-shadow: 0 8px 24px rgba(26,18,8,0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), bottom .3s ease;
}
.wl-cart-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(26,18,8,0.2); }
.wl-cart-fab:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 3px; }
.wl-cart-fab.has-items { background: var(--c-dark); color: var(--c-gold-lt); border-color: var(--c-dark); }
.wl-cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--c-gold);
  color: var(--c-dark);
  font: 700 0.72rem/22px var(--f-body);
  text-align: center;
  box-shadow: 0 0 0 2px var(--c-white);
}
.wl-cart-count[hidden] { display: none; }

/* Pannello laterale */
.wl-cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26,18,8,0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.wl-cart-overlay[hidden] { display: none; }
.wl-cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  width: min(420px, 100vw);
  background: var(--c-white);
  box-shadow: -12px 0 40px rgba(26,18,8,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform .3s ease, visibility 0s linear .3s;
}
.wl-cart-panel.is-open { transform: none; visibility: visible; transition: transform .3s ease; }
body.wl-cart-lock { overflow: hidden; }

.wl-cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--c-ivory-dark);
}
.wl-cart-head h2 { font-family: var(--f-title); font-size: 1.35rem; color: var(--c-dark); margin: 0; }
.wl-cart-close {
  width: 40px; height: 40px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--c-text-lt);
  font-size: 1.1rem; cursor: pointer;
}
.wl-cart-close:hover { background: var(--c-ivory); color: var(--c-dark); }

.wl-cart-body { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.wl-cart-empty { text-align: center; padding: var(--sp-12) 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); color: var(--c-text-lt); }

.wl-cart-item { display: flex; gap: var(--sp-4); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--c-ivory-dark); }
.wl-cart-item:last-child { border-bottom: none; }
.wl-cart-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: var(--r); flex-shrink: 0; background: var(--c-ivory); }
.wl-cart-info { flex: 1; min-width: 0; }
.wl-cart-kicker { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-gold-dk); margin: 0; }
.wl-cart-name { font-family: var(--f-title); font-size: 1.05rem; color: var(--c-dark); margin: 2px 0; }
.wl-cart-plan, .wl-cart-extras { font-size: 0.8rem; color: var(--c-text-lt); margin: 0; line-height: 1.5; }
.wl-cart-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-2); flex-wrap: wrap; }
.wl-cart-price { font-weight: 700; color: var(--c-dark); }
.wl-cart-actions { display: flex; gap: var(--sp-3); }
.wl-cart-link { background: none; border: none; padding: 4px 0; font: 600 0.78rem var(--f-body); color: var(--c-gold-dk); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wl-cart-link.is-danger { color: #B4442F; }

.wl-cart-foot { padding: var(--sp-5) var(--sp-6) calc(var(--sp-5) + env(safe-area-inset-bottom)); border-top: 1px solid var(--c-ivory-dark); background: var(--c-ivory); display: flex; flex-direction: column; gap: 6px; }
.wl-cart-foot:empty { display: none; }
.wl-cart-sum { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--c-text-lt); }
.wl-cart-sum.is-total { font-size: 1.05rem; font-weight: 700; color: var(--c-dark); margin-top: 4px; }
.wl-cart-cta { width: 100%; justify-content: center; margin-top: var(--sp-3); min-height: 48px; }
.wl-cart-more { background: none; border: none; padding: var(--sp-2); text-align: center; font: 600 0.82rem var(--f-body); color: var(--c-text-lt); cursor: pointer; text-decoration: none; }
.wl-cart-more:hover { color: var(--c-gold-dk); }

/* Mobile: icona più piccola; sale sopra il CTA fisso della landing quando è visibile */
@media (max-width: 768px) {
  .wl-cart-fab { left: var(--sp-4); bottom: calc(var(--sp-4) + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  body.has-sticky-cta .wl-cart-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .nav-mobile.open ~ .wl-cart-fab { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wl-cart-panel, .wl-cart-fab { transition: none; }
}

/* Checkout su mobile: l'icona in basso copriva testi e caselle (Termini) durante lo scroll.
   Lì sta nella barra in alto a destra, dove la nav del checkout (solo logo centrato) ha spazio. */
@media (max-width: 768px) {
  body:has(#wizard-main) .wl-cart-fab {
    top: calc((var(--nav-solid-h, 64px) - 42px) / 2);
    bottom: auto;
    left: auto;
    right: var(--sp-4);
    width: 42px;
    height: 42px;
    z-index: 110;
    box-shadow: none;
  }
}
