/* ============================================================
   tin-cart :: Carrello B2B — stile brand (mobile-first)
   Prefisso html body#top dove serve battere gli override Enfold.
   ============================================================ */

/* ---- Reset tabella carrello: da tabella a blocchi/card ---- */
html body#top .tin-cart-table,
html body#top .tin-cart-table tbody,
html body#top .tin-cart-table tr,
html body#top .tin-cart-table td {
    display: block;
    width: 100%;
    border: 0 !important;
    padding: 0;
    margin: 0;
    background: transparent;
}
html body#top .tin-cart-table { border-collapse: collapse; margin: 0 0 8px; }

html body#top .tin-cart-titlebar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin: 4px 0 14px;
}
html body#top .tin-cart-title {
    font-size: 20px;
    color: var(--tin-cart-ink);
    margin: 0 0 0 8px;
}
html body#top .tin-cart-titlebar .tin-cart-continue { flex-shrink: 0; white-space: nowrap; }

/* ---- Card articolo ---- */
html body#top .tin-cart-card {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    margin-bottom: 10px;
}
html body#top .tin-cart-thumb { flex-shrink: 0; line-height: 0; }
html body#top .tin-cart-thumb img {
    width: 68px; height: 68px;
    border-radius: 10px;
    object-fit: cover;
    margin: 0;
}
html body#top .tin-cart-main { flex: 1 1 190px; min-width: 0; }

html body#top .tin-cart-head { display: flex; }
html body#top .tin-cart-name { font-size: 15px; line-height: 1.3; color: var(--tin-cart-ink); }
html body#top .tin-cart-name a { color: var(--tin-cart-ink); text-decoration: none; }
html body#top a.tin-cart-remove.remove,
html body#top .tin-cart-remove {
    position: absolute !important; top: 8px !important; left: 8px !important; z-index: 3;
    width: 22px !important; height: 22px !important; min-width: 22px !important;
    border-radius: 50% !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    background: #fff !important; background-color: #fff !important; color: #4a4741 !important;
    font-size: 16px !important; font-weight: 700 !important; line-height: 1 !important;
    text-indent: 0 !important; overflow: visible !important; text-decoration: none !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25) !important; padding: 0 !important; border: 0 !important;
}
html body#top a.tin-cart-remove.remove:hover,
html body#top .tin-cart-remove:hover { background: #c0392b !important; background-color: #c0392b !important; color: #fff !important; }

/* Attributi (Size/Qty ecc.) come pillole */
html body#top .tin-cart-attrs dl.variation,
html body#top .tin-cart-attrs .wc-item-meta {
    display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none;
}
html body#top .tin-cart-attrs dl.variation dt,
html body#top .tin-cart-attrs .wc-item-meta .wc-item-meta-label { display: none; }
html body#top .tin-cart-attrs dl.variation dd,
html body#top .tin-cart-attrs .wc-item-meta li {
    margin: 0; padding: 2px 9px;
    background: var(--tin-cart-pill-bg); color: var(--tin-cart-pill-ink);
    border-radius: 20px; font-size: 11px; line-height: 1.5;
}
html body#top .tin-cart-attrs dl.variation dd p { margin: 0; }

html body#top .tin-cart-qty { flex-shrink: 0; }
html body#top .tin-cart-qty .quantity { margin: 0; display: inline-flex; align-items: center; }
html body#top .tin-cart-subtotal {
    /* Nascosto: il prezzo è già sotto la descrizione (prezzo unitario). */
    display: none !important;
}

/* MOBILE: card articolo su UNA riga sola — il nome si accorcia con "…" così
   quantità e prezzo NON vanno a capo occupando una riga inutile. */
@media (max-width: 820px) {
    /* Enfold stringe il contenuto a 85% (≈28px per lato): sulla pagina carrello
       allarghiamo al 94% (≈11px per lato) per dare più spazio alle card. */
    html body#top.woocommerce-cart #main .container { width: 94% !important; max-width: 94% !important; }
    /* Barra pagamento SEMPRE visibile su mobile (fissa in basso, non dipende dallo scroll). */
    html body#top .tin-cart-sticky[hidden] { display: flex !important; }
    /* Su mobile il CTA è la barra fissa → nascondi il pulsante dentro il box totali (resta su desktop). */
    html body#top .tin-cart-summary .wc-proceed-to-checkout { display: none !important; }
    html body#top .tin-cart-card { flex-wrap: nowrap; gap: 8px; }
    html body#top .tin-cart-thumb img { width: 56px; height: 56px; }
    html body#top .tin-cart-main { flex: 1 1 auto; min-width: 0; }
    html body#top .tin-cart-name {
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    html body#top .tin-cart-name a {
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
    }
    html body#top .tin-cart-subtotal { min-width: 0; margin-left: 6px; font-size: 14px; }
}

/* ---- Riga azioni (coupon + aggiorna) ---- */
html body#top .tin-cart-actions-row td { padding: 0; }
html body#top .tin-cart-actions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 0;
}
html body#top .tin-cart-coupon { flex: 1 1 100%; min-width: 0; margin: 28px 0; }
/* Barra codice sconto SEMPRE aperta: icona + input inline + pulsante Applica */
html body#top .tin-cart-coupon-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--tin-cart-pill-bg); border-radius: 12px; padding: 8px 10px 8px 16px;
    float: none !important;   /* la classe .coupon di WC lo mette float:left → parent a 0 */
    width: 100%; box-sizing: border-box;
}
html body#top .tin-cart-coupon,
html body#top .tin-cart-actions,
html body#top .tin-cart-actions-row td { float: none !important; }
html body#top .tin-cart-coupon-ic { display: inline-flex; flex-shrink: 0; }
html body#top .tin-cart-coupon-ic .tin-cart-ic { width: 18px; height: 18px; color: var(--tin-cart-beige); }
html body#top .tin-cart-coupon-input {
    flex: 1; min-width: 0;
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    font-size: 16px !important; color: var(--tin-cart-pill-ink) !important;
    padding: 6px 0 !important; min-height: 34px; margin: 0 !important;
}
html body#top .tin-cart-coupon-input::placeholder { color: #a98d5e; opacity: 1; }
html body#top .tin-cart-coupon-apply {
    flex-shrink: 0; background: var(--tin-cart-green) !important; color: #fff !important;
    border: 0 !important; border-radius: 20px !important; padding: 9px 18px !important;
    font-size: 13px !important; line-height: 1 !important; cursor: pointer; min-height: 0 !important;
}
html body#top .tin-cart-coupon-apply:hover { background: #3c463a !important; }
html body#top .tin-cart-update {
    background: #fff; color: var(--tin-cart-ink);
    border: 1px solid var(--tin-cart-border); border-radius: 10px;
    padding: 0 16px; min-height: 44px;
}

/* ---- Sottobarra: continua a comprare + MOQ ---- */
html body#top .tin-cart-subbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin: 14px 0; flex-wrap: wrap;
}
html body#top .tin-cart-continue {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--tin-cart-pill-ink); font-size: 12.5px; text-decoration: none; line-height: 1;
    background: var(--tin-cart-pill-bg); border: 1px solid var(--tin-cart-pill-bg); border-radius: 20px;
    padding: 8px 15px;
}
html body#top .tin-cart-continue:hover { background: #ecdfca; border-color: #ecdfca; }
html body#top .tin-cart-moq {
    font-size: 12px; background: #fff; border: 1px solid var(--tin-cart-border);
    color: var(--tin-cart-muted); border-radius: 20px; padding: 5px 12px;
}

/* ---- Riepilogo ordine ---- */
html body#top .cart-collaterals { width: 100%; float: none; }
html body#top .tin-cart-summary {
    background: #fff; border-radius: 12px; padding: 16px; width: 100%;
    border: 1px solid var(--tin-cart-beige);   /* bordino marrone a contrasto sul totale */
    float: none !important;          /* il tema mette float:left su .cart_totals */
    text-align: left !important;     /* ...e text-align:right → collassa i flex figli */
    box-sizing: border-box;
}
html body#top .tin-cart-trust { width: 100%; }
html body#top .tin-cart-summary-title {
    font-size: 15px; color: var(--tin-cart-ink); margin: 0 0 12px; padding: 0;
}
html body#top .tin-cart-totals-table,
html body#top .tin-cart-totals-table tbody,
html body#top .tin-cart-totals-table tr,
html body#top .tin-cart-totals-table th,
html body#top .tin-cart-totals-table td {
    display: block; width: 100%; border: 0 !important; padding: 0; background: transparent;
}
html body#top .tin-cart-totals-table tr {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 7px 0; border-bottom: 1px solid #eee7db !important;
}
html body#top .tin-cart-totals-table th {
    width: auto; font-weight: 400; color: #6a655c; font-size: 13px; text-align: left;
}
html body#top .tin-cart-totals-table td { width: auto; text-align: right; color: #6a655c; font-size: 13px; }
html body#top .tin-cart-totals-table tr.order-total { border-bottom: 0 !important; padding-top: 11px; }
html body#top .tin-cart-totals-table tr.order-total th,
html body#top .tin-cart-totals-table tr.order-total td { font-size: 16px; color: var(--tin-cart-ink); }

/* Bottone checkout reale */
html body#top .wc-proceed-to-checkout { margin-top: 14px; padding: 0; }
html body#top .wc-proceed-to-checkout a.checkout-button {
    display: block; width: 100%; text-align: center;
    float: none !important; /* il tema lo mette float:left → usciva dal box senza la barra fiducia */
    background: var(--tin-cart-green); color: #fff;
    border-radius: 24px; padding: 13px 0; font-size: 14px; margin: 0;
}
html body#top .wc-proceed-to-checkout a.checkout-button:hover { background: #3c463a; }

/* ---- Barra sticky (mobile) ---- */
.tin-cart-sticky {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
    background: #fff; border-top: 1px solid var(--tin-cart-border);
    padding: 10px 14px; display: flex; align-items: center; justify-content: center; gap: 12px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.tin-cart-sticky[hidden] { display: none; }
.tin-cart-sticky-total { display: none; } /* prezzo rimosso: solo il bottone, centrato */
html body#top .tin-cart-sticky-btn {
    flex: 0 1 auto; width: 82%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    text-align: center; background: var(--tin-cart-green); color: #fff;
    border-radius: 22px; padding: 12px 0; font-size: 14px; text-decoration: none;
}
html body#top .tin-cart-sticky-btn .tin-cart-lock { width: 15px; height: 15px; flex-shrink: 0; }

/* ---- Mobile: spazio per la barra fissa ---- */
@media (max-width: 820px) {
    body.woocommerce-cart .tin-cart-wrap { padding-bottom: 84px; }
    /* Più spazio SOTTO la fascia consegna/pagamento sicuro su mobile. */
    html body#top .tin-cart-trust { margin-bottom: 20px; }
}

/* Titoli sezione UNIFORMI (desktop + mobile): "Your cart", "Cart totals" e
   "I tuoi soliti" — stessa grandezza (15px), stesso font (Lato), grassetto. */
html body#top .tin-cart-title { font-size: 18px; font-weight: 700; font-family: lato, Helvetica, Arial, sans-serif; }
html body#top .tin-cart-summary-title { font-size: 18px; font-weight: 700; }
html body#top .tin-cart-shelf-title { font-size: 18px; font-weight: 700; }
html body#top .tin-cart-shelf-title .tin-cart-ic { width: 18px; height: 18px; stroke-width: 2; }

/* ---- Desktop: 2 colonne + riepilogo sticky, barra fissa nascosta ---- */
@media (min-width: 821px) {
    html body#top .tin-cart-wrap {
        display: flex; align-items: flex-start; gap: 24px;
    }
    html body#top .tin-cart-wrap .woocommerce-cart-form { flex: 1.6; min-width: 0; margin: 0; }
    html body#top .tin-cart-wrap .cart-collaterals {
        flex: 1; min-width: 0; position: sticky; top: calc(var(--tin-menu-h, 90px) + 12px);
    }
    html body#top .tin-cart-card { padding: 14px; }
    html body#top .tin-cart-thumb img { width: 70px; height: 70px; }
    .tin-cart-sticky { display: none !important; }
}

/* ============================================================
   Rifiniture (v1.0.1)
   ============================================================ */

/* Card: bordo sottile + hover morbido */
html body#top .tin-cart-card {
    border: 1px solid #efe9dd;
    transition: box-shadow .18s ease, border-color .18s ease;
}
html body#top .tin-cart-card:hover {
    border-color: var(--tin-cart-border);
    box-shadow: 0 4px 14px rgba(71, 81, 65, .07);
}

/* Prezzo unitario sotto gli attributi */
html body#top .tin-cart-unit { margin-top: 6px; font-size: 12px; color: var(--tin-cart-muted); }
html body#top .tin-cart-unit .amount { color: var(--tin-cart-muted); }
html body#top .tin-cart-subtotal { font-weight: 500; }

/* Stepper quantità a pillola */
html body#top .tin-cart-qty .quantity {
    border: 1px solid var(--tin-cart-border);
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    padding: 0;
    /* Il tema Enfold forza width:130px → ~20px vuoti a destra dopo il "+".
       Stringiamo al contenuto così "+" è a filo come "-". */
    width: auto !important;
    min-width: 0 !important;
}
html body#top .tin-cart-qty .quantity input.qty {
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    width: 32px; text-align: center; font-size: 14px; color: var(--tin-cart-ink); padding: 0; height: 32px;
}
html body#top .tin-cart-qty .quantity input.minus,
html body#top .tin-cart-qty .quantity input.plus {
    border: 0 !important; background: transparent !important;
    color: var(--tin-cart-green); width: 28px; height: 32px;
    font-size: 15px; line-height: 1; cursor: pointer; padding: 0; box-shadow: none !important;
}
html body#top .tin-cart-qty .quantity input.minus:hover,
html body#top .tin-cart-qty .quantity input.plus:hover { background: #f5efe4 !important; }

/* Titolo riepilogo in stile brand (no maiuscolo forzato dal tema) */
html body#top .tin-cart-summary-title {
    text-transform: none !important;
    letter-spacing: 0;
    color: var(--tin-cart-ink);
}

/* Barra fiducia sotto il riepilogo */
html body#top .tin-cart-trust {
    margin-top: 2px; display: flex; flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: center; gap: 8px 16px;
}
html body#top .tin-cart-trust-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--tin-cart-muted); text-decoration: none;
}
html body#top .tin-cart-trust-row .tin-cart-ic {
    width: 16px; height: 16px; color: var(--tin-cart-green); flex-shrink: 0;
}
html body#top a.tin-cart-trust-row:hover { color: var(--tin-cart-green); }

/* ============================================================
   Blocchi "scaffale": I tuoi soliti / Completa l'ordine (v1.2.0)
   ============================================================ */
html body#top .tin-cart-shelf { margin: 18px 0 8px; padding-top: 16px; border-top: 1px solid #efe9dd; }
html body#top .tin-cart-shelf + .tin-cart-shelf { margin-top: 8px; }
/* Il riordino segue la barra coupon (già divisore): niente bordo doppio. */
html body#top .tin-cart-reorder { border-top: 0; padding-top: 2px; margin-top: 10px; }
html body#top .tin-cart-shelf-title {
    display: flex; align-items: center; gap: 7px;
    font-size: 18px; font-weight: 700; color: var(--tin-cart-ink); margin: 0 0 24px; padding: 0;
    text-transform: none; letter-spacing: 0;
}
html body#top .tin-cart-shelf-title .tin-cart-ic { width: 18px; height: 18px; color: var(--tin-cart-green); }
html body#top .tin-cart-hscroll {
    display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; scrollbar-width: thin;
}
html body#top .tin-cart-mini {
    flex: 0 0 148px; background: #fff; border: 1px solid #efe9dd; border-radius: 10px;
    padding: 10px; display: flex; flex-direction: column; gap: 6px; text-align: center;
}
html body#top .tin-cart-mini-thumb { line-height: 0; display: block; }
html body#top .tin-cart-mini-thumb img {
    width: 100%; height: 84px; object-fit: cover; border-radius: 8px; margin: 0;
}
html body#top .tin-cart-mini-name {
    font-size: 12px; color: var(--tin-cart-ink); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 30px;
}
html body#top .tin-cart-mini-price { font-size: 12px; color: var(--tin-cart-muted); }
html body#top .tin-cart-mini-price .amount { color: var(--tin-cart-muted); }
html body#top .tin-cart-addbtn {
    display: block; background: var(--tin-cart-green); color: #fff; text-decoration: none;
    border: 0; border-radius: 18px; padding: 7px 0; font-size: 12px; cursor: pointer; text-align: center;
}
html body#top .tin-cart-addbtn:hover { background: #3c463a; color: #fff; }
html body#top .tin-cart-addbtn.is-loading { opacity: .6; pointer-events: none; }

@media (min-width: 821px) {
    html body#top .tin-cart-mini { flex-basis: 160px; }
}

/* ============================================================
   "I tuoi soliti" a ELENCO con pulsante icona (v1.3.0)
   ============================================================ */
html body#top .tin-cart-reorder-list { display: flex; flex-direction: column; gap: 8px; }
html body#top .tin-cart-rerow {
    display: flex; align-items: center; gap: 12px; position: relative;
    background: #fff; border: 1px solid #efe9dd; border-radius: 10px; padding: 8px 10px;
}
/* × per togliere il prodotto dai suggeriti: identica alla × degli articoli del
   carrello (.tin-cart-remove) — cerchio bianco, diventa rossa al passaggio. */
html body#top .tin-cart-rerow-x {
    position: absolute !important; top: 4px !important; left: 4px !important; z-index: 3;
    width: 22px !important; height: 22px !important; min-width: 22px !important;
    border-radius: 50% !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    background: #fff !important; background-color: #fff !important; color: #4a4741 !important;
    font-size: 16px !important; font-weight: 700 !important; line-height: 1 !important;
    text-indent: 0 !important; overflow: visible !important; text-decoration: none !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .25) !important; padding: 0 !important; border: 0 !important; margin: 0 !important;
    cursor: pointer; -webkit-appearance: none; appearance: none; box-sizing: border-box;
    transition: background .15s, color .15s;
}
html body#top .tin-cart-rerow-x:hover { background: #c0392b !important; background-color: #c0392b !important; color: #fff !important; }
html body#top .tin-cart-rerow-x.is-loading { opacity: .5; pointer-events: none; }
html body#top .tin-cart-rerow-thumb { flex-shrink: 0; line-height: 0; }
html body#top .tin-cart-rerow-thumb img {
    width: 46px; height: 46px; border-radius: 8px; object-fit: cover; margin: 0;
}
html body#top .tin-cart-rerow-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
html body#top .tin-cart-rerow-name {
    font-size: 13px; color: var(--tin-cart-ink); line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
html body#top .tin-cart-rerow-price { font-size: 12px; color: var(--tin-cart-muted); }
html body#top .tin-cart-rerow-price .amount { color: var(--tin-cart-muted); }
html body#top .tin-cart-addbtn-icon {
    flex-shrink: 0; width: 36px; height: 36px; min-width: 36px; padding: 0;
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
}
html body#top .tin-cart-addbtn-icon .tin-cart-ic { width: 18px; height: 18px; color: #fff; }

/* ============================================================
   Carrello VUOTO — è la STESSA cart.php: quando non ci sono articoli,
   nell'AREA PRODOTTI (dentro la tabella articoli) compare questo messaggio.
   Il box "Totale carrello" resta quello reale (฿0) e si aggiorna da solo. (v1.9.x)
   ============================================================ */
html body#top .tin-cart-empty {
    text-align: center;
    background: transparent;
    border: 0;
    padding: 22px 16px 26px;
    margin: 4px 0 0;
}
html body#top .tin-cart-empty-ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 66px; height: 66px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 10px rgba(71, 81, 65, .08);
    margin-bottom: 14px;
}
html body#top .tin-cart-empty-ic .tin-cart-ic {
    width: 30px; height: 30px; color: var(--tin-cart-green); stroke-width: 1.6;
}
html body#top .tin-cart-empty-title {
    font-size: 21px; font-weight: 700; font-family: lato, Helvetica, Arial, sans-serif;
    color: var(--tin-cart-ink); margin: 0 0 6px; padding: 0; text-transform: none; letter-spacing: 0;
}
html body#top .tin-cart-empty-sub {
    font-size: 14px; line-height: 1.5; color: var(--tin-cart-muted);
    max-width: 340px; margin: 0 auto 18px;
}
html body#top .tin-cart-empty-btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--tin-cart-green); color: #fff; text-decoration: none;
    border-radius: 24px; padding: 12px 30px; font-size: 14px; font-weight: 500;
    transition: background .18s ease;
}
html body#top .tin-cart-empty-btn:hover { background: #3c463a; color: #fff; }
