/* ============================================================================
   cart.css — ESTRATTO da style.css il 21 ott 2026 (split per area, misurato: 471 KB in un
   foglio solo, un quarto usato per pagina). PAGINA CARRELLO /cart/ (Cart block): layout, sidebar, tablet due colonne. Caricato su is_cart().
   Caricato DOPO dvd-style (dipendenza) solo dove serve: vedi functions.php.
   REGOLA MADRE invariata: solo token di theme.json.
   ========================================================================= */

/* ============================================================================
 * PAGINA CARRELLO (Cart block, React) — scope .cgtv-cart. RISCRITTO 2026-07-12
 * (audit team UX Revolut/Amazon + optometristi): CONSISTENTE col checkout/order-pay.
 * Bonifica totale del drift: ZERO token --ct-* paralleli, ZERO hex/px una-tantum →
 * solo preset theme.json (REGOLA MADRE). Font sulla scala φ (over-45 ≥ small 16px).
 * Card riepilogo = card canonica (surface + bordo line-2 + raggio 16 + ombra); totale
 * DOMINANTE 31px come il checkout; CTA 60px/24px identica alla CTA "Paga".
 * Layout 2 colonne (prodotti + riepilogo sticky), mobile colonna unica.
 * ========================================================================== */
.cgtv-cart{ background:var(--wp--preset--color--base); }

/* titolo pagina "Carrello" */
.cgtv-cart__title,
.cgtv-cart h1,
.cgtv-cart .wp-block-woocommerce-cart .wc-block-cart__main > h1{
  font-family:var(--wp--preset--font-family--heading)!important;
  color:var(--wp--preset--color--contrast)!important;
  font-size:var(--wp--preset--font-size--x-large)!important; font-weight:600!important;
  margin:0 0 clamp(1.25rem,3vw,1.75rem)!important; letter-spacing:-.015em;
}

/* ---- LAYOUT 2 colonne FULL-WIDTH (dentro il padding del main). Il cart è in
   .entry-content is-layout-flow → forzo la catena a larghezza piena; il blocco cart
   riempie tutto lo spazio del main (niente cap 1100px → era quello che lo restringeva). ---- */
.cgtv-cart.is-layout-constrained > *,
.cgtv-cart .entry-content{ max-width:none!important; width:100%!important; }
.cgtv-cart .entry-content{ margin-left:0!important; margin-right:0!important; }
.cgtv-cart .wp-block-woocommerce-cart{
  /* full-width ma con un cap ampio: senza cap le righe prodotto si stirano a dismisura
     (illeggibile) e la sidebar sembra sproporzionata. 1320px riempie bene i desktop
     grandi senza stirare, centrato. */
  width:100%!important; max-width:1320px!important; margin-left:auto!important; margin-right:auto!important;
}
.cgtv-cart .wc-block-components-sidebar-layout{ gap:clamp(28px,3.5vw,56px)!important; }
.cgtv-cart .wc-block-components-sidebar-layout .wc-block-components-main{
  flex:1 1 auto!important; width:auto!important; min-width:0!important; padding-right:0!important;
}
.cgtv-cart .wc-block-cart__sidebar{
  flex:0 0 360px!important; width:360px!important; max-width:360px!important;
  position:sticky!important; top:96px!important;
}

/* ---- TABLET / COLLASSO (fix sidebar stretta quando va sotto) ----
   Il PLUGIN decide il collasso via CONTAINER query → classe .is-medium/.is-small sul
   .wc-block-cart (verificato con inspector: a 764px = is-medium, sidebar-layout in
   flex-direction:column). I miei width:360px la inchiodavano → restava stretta.
   FIX ancorato alla CLASSE del plugin (non al viewport): quando è collassata, la
   sidebar diventa FULL-WIDTH, ma il CONTENUTO (card + CTA) è cappato e centrato per
   leggibilità (una card riepilogo larga 672px con 3 righe è sgraziata). */
.cgtv-cart .wc-block-cart.is-medium .wc-block-cart__sidebar,
.cgtv-cart .wc-block-cart.is-small .wc-block-cart__sidebar{
  flex:1 1 100%!important; width:100%!important; max-width:100%!important;
  position:static!important; top:auto!important; padding-left:0!important;
}
/* contenuto interno cappato a 560px centrato (card-superficie full-width fa da fascia,
   ma righe totali + CTA respirano centrate, non stirate per tutta la larghezza) */
.cgtv-cart .wc-block-cart.is-medium .wc-block-cart__sidebar > *,
.cgtv-cart .wc-block-cart.is-small .wc-block-cart__sidebar > *{
  max-width:560px!important; margin-left:auto!important; margin-right:auto!important;
}

/* TABLET 2 COLONNE (768–1023px, quando c'è ancora spazio): sidebar più SNELLA (320px)
   + gap ridotto → le 2 colonne reggono più a lungo (es. iPad landscape) invece di
   collassare presto. Se il plugin collassa comunque, vince il ramo .is-medium sopra. */
@media (min-width:768px) and (max-width:1023.98px){
  .cgtv-cart .wc-block-components-sidebar-layout:not(.is-medium):not(.is-small){ gap:28px!important; }
  .cgtv-cart .wc-block-cart:not(.is-medium):not(.is-small) .wc-block-cart__sidebar{
    flex:0 0 320px!important; width:320px!important; max-width:320px!important;
  }
}

/* ---- RIGHE PRODOTTO — grid [cover 72px | dettagli 1fr | totale auto] ---- */
.cgtv-cart table.wc-block-cart-items{ width:100%!important; display:block!important; }
.cgtv-cart table.wc-block-cart-items thead,
.cgtv-cart .wc-block-cart-items__header{ display:none!important; }
.cgtv-cart table.wc-block-cart-items tbody{ display:block!important; }
.cgtv-cart .wc-block-cart-items__row{
  display:grid!important; grid-template-columns:72px minmax(0,1fr) max-content!important;
  gap:20px!important; align-items:start!important;
  padding:20px 0!important; margin:0!important;
  border:0!important; border-bottom:1px solid var(--wp--preset--color--line)!important;
  background:transparent!important; border-radius:0!important;
}
.cgtv-cart .wc-block-cart-items__row > td{ padding:0!important; border:0!important; display:block!important; min-width:0!important; }
/* cover locandina 72px, aspect 5/7 come order-pay/account/catalogo (era 2/3 = drift) */
.cgtv-cart .wc-block-cart-item__image{ width:72px!important; grid-column:1!important; }
.cgtv-cart .wc-block-cart-item__image img{
  width:72px!important; height:auto!important; aspect-ratio:5/7!important; object-fit:cover!important;
  border-radius:var(--wp--custom--radius--micro)!important;
  border:1px solid var(--wp--preset--color--line-2)!important; display:block!important;
}
.cgtv-cart .wc-block-cart-item__product{ grid-column:2!important; min-width:0!important; }
/* totale riga: colonna 3, larghezza naturale (max-content del grid) — NON 0 */
.cgtv-cart .wc-block-cart-item__total{ grid-column:3!important; text-align:right!important; white-space:nowrap!important; min-width:max-content!important; }

/* dettagli riga (nome, prezzo unit, formato, stepper) impilati */
.cgtv-cart .wc-block-cart-item__wrap{ display:flex!important; flex-direction:column!important; gap:6px!important; }
.cgtv-cart .wc-block-cart-item__prices{ margin:0!important; }
.cgtv-cart .wc-block-cart-item__quantity{ display:flex!important; align-items:center!important; gap:16px!important; margin-top:10px!important; }
/* nome prodotto: heading, base 20px (over-45), off-white; hover ACCENT (non primary) */
.cgtv-cart .wc-block-components-product-name,
.cgtv-cart a.wc-block-components-product-name{
  color:var(--wp--preset--color--contrast)!important; text-decoration:none!important;
  font-family:var(--wp--preset--font-family--heading)!important;
  font-weight:600!important; font-size:var(--wp--preset--font-size--base)!important; line-height:1.3!important;
}
@media (hover:hover){ .cgtv-cart a.wc-block-components-product-name:hover{ color:var(--wp--preset--color--accent)!important; } }
/* metadati variante (Formato): muted, small 16px (era 12.5px = illeggibile over-45) */
.cgtv-cart .wc-block-components-product-metadata,
.cgtv-cart .wc-block-components-product-metadata *{
  color:var(--wp--preset--color--muted)!important; font-size:var(--wp--preset--font-size--small)!important;
}
/* prezzo unitario: muted, small, tabular */
.cgtv-cart .wc-block-cart-item__prices .wc-block-components-product-price{
  color:var(--wp--preset--color--muted)!important; font-family:var(--wp--preset--font-family--heading)!important;
  font-size:var(--wp--preset--font-size--small)!important; font-variant-numeric:tabular-nums;
}
/* totale riga (colonna destra): contrast, heading, base 20px, tabular */
.cgtv-cart .wc-block-cart-item__total .wc-block-components-product-price,
.cgtv-cart .wc-block-cart-item__total-price-and-sale-badge-wrapper{
  color:var(--wp--preset--color--contrast)!important; font-family:var(--wp--preset--font-family--heading)!important;
  font-weight:600!important; font-size:var(--wp--preset--font-size--base)!important; font-variant-numeric:tabular-nums;
  text-align:right!important;
}

/* ---- STEPPER QUANTITÀ ---- (DOM reale WC 10.9.3: input, button--minus, button--plus
   in QUEST'ordine). Layout esplicito con `order`: [− | input | +]. UN solo bordo sul
   container (i button/input SENZA bordo → niente "pieni di bordi"). Tap ≥48px. */
.cgtv-cart .wc-block-components-quantity-selector{
  display:flex!important; align-items:center!important; width:fit-content!important;
  background:var(--wp--preset--color--field)!important;
  border:1px solid var(--wp--preset--color--line-2)!important;
  border-radius:var(--wp--custom--radius--control)!important;
  overflow:visible!important;
}
/* input al CENTRO (order 2) */
.cgtv-cart .wc-block-components-quantity-selector__input{
  order:2!important;
  background:transparent!important; color:var(--wp--preset--color--contrast)!important;
  font-family:var(--wp--preset--font-family--heading)!important; font-weight:600!important;
  font-size:var(--wp--preset--font-size--base)!important;
  border:0!important; box-shadow:none!important; outline:none!important;
  min-height:48px!important; width:44px!important; min-width:44px!important; max-width:44px!important; padding:0!important;
  text-align:center!important; font-variant-numeric:tabular-nums;
  -moz-appearance:textfield!important;
}
.cgtv-cart .wc-block-components-quantity-selector__input::-webkit-outer-spin-button,
.cgtv-cart .wc-block-components-quantity-selector__input::-webkit-inner-spin-button{ -webkit-appearance:none!important; margin:0!important; }
/* bottoni: − a sinistra (order 1), + a destra (order 3). Quadrati 48px, bordo laterale
   di separazione, testo grande e visibile. */
.cgtv-cart .wc-block-components-quantity-selector__button{
  display:flex!important; align-items:center!important; justify-content:center!important;
  color:var(--wp--preset--color--contrast)!important; background:transparent!important;
  border:0!important; box-shadow:none!important;
  width:48px!important; min-width:48px!important; height:48px!important; min-height:48px!important;
  padding:0!important; margin:0!important; cursor:pointer!important;
  font-size:var(--wp--preset--font-size--medium)!important; line-height:1!important;
  transition:color .2s ease, background .2s ease!important;
}
.cgtv-cart .wc-block-components-quantity-selector__button--minus{ order:1!important; border-right:1px solid var(--wp--preset--color--line-2)!important; }
.cgtv-cart .wc-block-components-quantity-selector__button--plus{ order:3!important; border-left:1px solid var(--wp--preset--color--line-2)!important; }
.cgtv-cart .wc-block-components-quantity-selector__button[disabled]{ color:var(--wp--preset--color--muted-2)!important; opacity:.5!important; cursor:default!important; }
@media (hover:hover){ .cgtv-cart .wc-block-components-quantity-selector__button:not([disabled]):hover{ color:var(--wp--preset--color--accent)!important; background:var(--wp--preset--color--surface-2)!important; } }

/* rimuovi articolo: small, muted-2 → hover accent; icona sarà nel testo nativo */
.cgtv-cart .wc-block-cart-item__remove-link{
  color:var(--wp--preset--color--muted-2)!important; text-decoration:none!important;
  font-size:var(--wp--preset--font-size--small)!important; letter-spacing:.01em!important;
  transition:color .2s ease!important; min-height:44px; display:inline-flex; align-items:center;
}
@media (hover:hover){ .cgtv-cart .wc-block-cart-item__remove-link:hover{ color:var(--wp--preset--color--accent)!important; } }

/* ---- RIEPILOGO (sidebar): CARD CANONICA solo sul SUMMARY block ----
   NB: NON usare `.wc-block-cart__sidebar > div` (greedy): colpirebbe anche il
   proceed-to-checkout-block e il nudge, dando loro bordo+ombra+raggio (era il "bordo
   intorno al pulsante"). Solo il summary block è la card. */
.cgtv-cart .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block{
  background:var(--wp--preset--color--surface)!important;
  border:var(--wp--custom--card--border)!important;
  border-radius:var(--wp--custom--radius--surface)!important;
  box-shadow:var(--wp--custom--card--shadow)!important;
  padding:24px!important;
}
/* il proceed-block NON è una card: trasparente, niente bordo/ombra/raggio */
.cgtv-cart .wc-block-cart__sidebar .wp-block-woocommerce-proceed-to-checkout-block{
  background:transparent!important; border:0!important; border-radius:0!important; box-shadow:none!important; padding:0!important;
}
/* titolo "Riepilogo ordine": medium 24px, come il checkout */
.cgtv-cart .wc-block-components-order-summary__title,
.cgtv-cart .wc-block-cart-order-summary-heading-block{
  color:var(--wp--preset--color--contrast)!important;
  font-family:var(--wp--preset--font-family--heading)!important;
  font-size:var(--wp--preset--font-size--medium)!important; font-weight:600!important; letter-spacing:-.01em;
}
/* righe totali: label muted / valore contrast. NIENTE border sulle voci (evita il
   pile-up di linee: WooCommerce annida ogni voce in un .totals-wrapper → i border-bottom
   si sommavano = "3 bordi"). La sola linea è il border-top del footer (sotto). */
.cgtv-cart .wc-block-components-totals-item{
  color:var(--wp--preset--color--contrast)!important; padding:8px 0!important;
  border:0!important;
  font-family:var(--wp--preset--font-family--body)!important; font-size:var(--wp--preset--font-size--small)!important;
}
.cgtv-cart .wc-block-components-totals-wrapper{ border:0!important; padding:0!important; margin:0!important; }
.cgtv-cart .wc-block-components-totals-item__label{ color:var(--wp--preset--color--muted)!important; }
.cgtv-cart .wc-block-components-totals-item__value{
  color:var(--wp--preset--color--contrast)!important; font-family:var(--wp--preset--font-family--heading)!important;
  font-variant-numeric:tabular-nums;
}
/* spedizione gratis → success token */
.cgtv-cart .wc-block-components-totals-shipping .wc-block-components-totals-item__value{ color:var(--wp--preset--color--success)!important; }
/* riga TOTALE finale: DOMINANTE + UNICA linea di separazione (border-top) */
.cgtv-cart .wc-block-components-totals-footer-item{
  border:0!important; border-top:1px solid var(--wp--preset--color--line)!important;
  padding-top:14px!important; margin-top:8px!important;
}
.cgtv-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label{
  color:var(--wp--preset--color--contrast)!important; font-weight:700!important; font-size:var(--wp--preset--font-size--base)!important;
}
.cgtv-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
.cgtv-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value span{
  color:var(--wp--preset--color--contrast)!important; font-family:var(--wp--preset--font-family--heading)!important;
  font-size:var(--wp--preset--font-size--large)!important; font-weight:700!important; letter-spacing:-.02em;
}

/* il contenitore "proceed-to-checkout-block" del core ha background color-mix 5% +
   border-radius → si vede come un BOX/bordo sopra il pulsante. Neutralizzato. */
.cgtv-cart .wp-block-woocommerce-proceed-to-checkout-block,
.cgtv-cart .wc-block-cart__submit{
  background:transparent!important; border:0!important; border-radius:0!important;
  overflow:visible!important; margin:0!important; min-height:0!important;
}
.cgtv-cart .wc-block-cart__submit-container{ background:transparent!important; border:0!important; }
/* variante STICKY del submit-container (WooCommerce la aggiunge scrollando): il core la
   rende una barra FISSA con background:#fff + ::before box-shadow → il "bordo/box bianco
   + ombra superiore". La disattiviamo: resta inline nel flusso, niente barra bianca. */
.cgtv-cart .wc-block-cart__submit-container--sticky{
  position:static!important; background:transparent!important; box-shadow:none!important;
  padding:0!important; width:auto!important; z-index:auto!important;
}
.cgtv-cart .wc-block-cart__submit-container--sticky::before{ display:none!important; content:none!important; }
/* payment-options vuoto: niente padding/bordo che crei spazio-fantasma */
.cgtv-cart .wc-block-cart__payment-options{ padding:0!important; border:0!important; }

/* ---- CTA "Procedi al checkout": IDENTICA alla CTA "Paga" del checkout (60px/24px) ---- */
.cgtv-cart .wc-block-cart__submit-button,
.cgtv-cart .wc-block-components-button.contained{
  background:var(--wp--preset--color--primary)!important; color:#fff!important; border:0!important;
  border-radius:var(--wp--custom--radius--control)!important;
  min-height:60px!important; width:100%!important;
  font-family:var(--wp--preset--font-family--heading)!important; font-weight:600!important;
  font-size:var(--wp--preset--font-size--medium)!important; letter-spacing:-.005em;
  transition:filter .18s ease, transform .12s ease!important;
}
@media (hover:hover){ .cgtv-cart .wc-block-cart__submit-button:hover{ filter:brightness(1.06); } }
.cgtv-cart .wc-block-cart__submit-button:active{ transform:scale(.99); }

/* NB: il NUDGE spedizione gratis è già .dvd-shipbar (header.js) — NON duplicare qui. */

/* ---- TRUST signal sotto la CTA (iniettato) ---- */
.cgtv-cart .cgtv-cart-trust{
  display:flex; align-items:center; justify-content:center; gap:.5rem;
  margin-top:14px; font-size:var(--wp--preset--font-size--x-small);
  color:var(--wp--preset--color--muted-2); text-align:center; line-height:1.4;
}
.cgtv-cart .cgtv-cart-trust svg{ width:15px; height:15px; flex:none; }

/* ---- EMPTY CART: card centrata curata (stesso pattern di .cgtv-dash-empty account),
   SENZA suggerimenti prodotti (rimossi dal post_content). Icona carrello neutra +
   copy IT + CTA rossa "Sfoglia il catalogo". ---- */
.cgtv-cart .wp-block-woocommerce-empty-cart-block{
  padding:0!important; margin:0!important; text-align:center!important;
}
/* nascondo l'eventuale heading nativo (ora usiamo la card .cgtv-cart-empty) */
.cgtv-cart .wp-block-woocommerce-empty-cart-block > h2,
.cgtv-cart .wp-block-woocommerce-empty-cart-block .wp-block-separator{ display:none!important; }
.cgtv-cart .cgtv-cart-empty{
  max-width:480px; margin:clamp(1rem,4vh,2rem) auto 0;
  padding:clamp(28px,4vw,44px) clamp(20px,3vw,32px);
  background:var(--wp--preset--color--surface);
  border:var(--wp--custom--card--border); border-radius:var(--wp--custom--radius--surface);
  box-shadow:var(--wp--custom--card--shadow);
  display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px;
}
.cgtv-cart .cgtv-cart-empty__ico{
  width:56px; height:56px; display:flex; align-items:center; justify-content:center;
  border-radius:var(--wp--custom--radius--control); margin-bottom:4px;
  background:var(--wp--preset--color--surface-2); color:var(--wp--preset--color--muted);
}
.cgtv-cart .cgtv-cart-empty__ico svg{ width:26px; height:26px; }
.cgtv-cart .cgtv-cart-empty__title{
  font-family:var(--wp--preset--font-family--heading); font-weight:600;
  color:var(--wp--preset--color--contrast); font-size:var(--wp--preset--font-size--medium);
}
.cgtv-cart .cgtv-cart-empty__sub{
  color:var(--wp--preset--color--muted); font-size:var(--wp--preset--font-size--small);
  max-width:42ch; line-height:1.55;
}
.cgtv-cart .cgtv-cart-empty__cta{
  margin-top:8px; display:inline-flex; align-items:center; justify-content:center;
  min-height:48px; padding:0 1.6rem; border-radius:var(--wp--custom--radius--control);
  background:var(--wp--preset--color--primary); color:#fff!important;
  font-family:var(--wp--preset--font-family--heading); font-weight:700;
  font-size:var(--wp--preset--font-size--small); text-decoration:none!important;
  box-shadow:0 8px 30px color-mix(in srgb, var(--wp--preset--color--primary) 22%, transparent);
  transition:filter .18s ease, transform .12s ease;
}
@media (hover:hover){ .cgtv-cart .cgtv-cart-empty__cta:hover{ filter:brightness(1.06); } }
.cgtv-cart .cgtv-cart-empty__cta:active{ transform:scale(.99); }

/* MOBILE: i container query del plugin impilano le colonne; qui disattivo solo lo sticky */
@media (max-width:781px){
  .cgtv-cart .wc-block-cart__sidebar{ position:static!important; top:auto!important; }
}

