/* Basket page (Concept B §4.5). */

/* ---------- Head ---------- */
.bb-cart__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.bb-cart__title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0; }
.bb-cart__count { font-family: var(--bb-font-body); font-size: .9375rem; font-weight: 600; color: var(--bb-muted); }
.bb-cart__continue { flex: none; }
/* Slot for the bbt_cart_actions hook (e.g. a future "Share basket" button)
   next to "Continue shopping" - see woocommerce/cart/cart.php. */
.bb-cart__head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Savings banner ---------- */
.bb-cart__savings { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.bb-cart__savings-main { display: flex; align-items: center; gap: 16px; }
.bb-cart__savings-amount { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 72px; height: 48px; padding: 0 12px; border-radius: var(--bb-r-small); background: var(--bb-yellow); color: var(--bb-ink); font-size: 1.375rem; font-weight: 800; }
.bb-cart__savings-text { display: grid; gap: 2px; }
.bb-cart__savings-text strong { font-size: 1rem; }
.bb-cart__savings-text p { margin: 0; font-size: .875rem; color: #ddd; }
.bb-cart__savings-cutoff { margin: 0; font-size: .8125rem; color: #ccc; white-space: normal; }

/* ---------- Two-column layout ---------- */
.bb-cart__layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; align-items: start; }
.bb-cart__main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.bb-cart__side { min-width: 0; }
/* Summary rail stays in view while the (often longer) items/fulfilment/rail
   column scrolls past it, as in B-Cart. Only on the two-column (desktop)
   layout - the max-width:1024px block below switches this off for the
   stacked layout, where a sticky side column would float over later content. */
@media (min-width: 1025px) {
	.bb-cart__side { position: sticky; top: 20px; }
}

/* Root cause of the "form floats left, panel wastes space" defect: a global
   sitewide Custom CSS & JS snippet (uploads/custom-css-js/7573.css, "Style
   CSS and home page", still active and inlined in <head> on every page)
   carries two leftover rules from the old single-column Woo cart layout -
   `.woocommerce-cart .woocommerce .woocommerce-cart-form { float: left; }`
   and the equivalent for `.cart-collaterals` - with no width set. Woo's own
   `<div class="woocommerce">` shortcode wrapper still exists around this
   page's markup, so the selector matches: the real <form class=
   "woocommerce-cart-form"> (woocommerce/cart/cart.php) becomes a shrink-to-
   fit floated box instead of filling this panel (confirmed via computed
   style: float:left, width ~688px inside an 848px panel). A second snippet
   (10085.css, "Products") repeats the same float, scoped to a max-width:480px
   media query, with `width:100%!important` that would otherwise still beat a
   plain override at that breakpoint. Can't edit the global snippet from this
   page area, so both rules are neutralised here with equal-or-higher
   specificity and !important on every property they set (not just margin,
   as the previous partial fix below did for the summary rail only). */
.woocommerce-cart .bb-cart__main .woocommerce-cart-form,
.woocommerce-cart .bb-cart__side .cart-collaterals {
	float: none !important;
	width: 100% !important;
	margin: 0 !important;
}
.bb-cart__collaterals { display: flex; flex-direction: column; gap: 20px; width: 100%; }

/* ---------- Line items ---------- */
.bb-cart__items { padding: 0; overflow: hidden; width: 100%; }
.bb-cart-lines { display: flex; flex-direction: column; width: 100%; }
/* Fixed-width qty/total tracks (matching B-Cart's 140px quantity column) so
   every row's stepper and line total line up vertically - each .bb-cart-line
   is its own grid, so plain `auto` columns sized to that row's own content
   (e.g. whether it has a "Save R..." chip) drifted by 10-15px row to row. */
.bb-cart-line { display: grid; grid-template-columns: 96px minmax(0, 1fr) 140px 128px; align-items: start; gap: 16px; padding: 20px clamp(18px, 2.4vw, 28px); border-bottom: 1px solid var(--bb-border); }
.bb-cart-lines .bb-cart-line:last-child { border-bottom: 0; }
.bb-cart-line__media { display: block; flex: none; width: 96px; height: 96px; padding: 6px; border: 1px solid var(--bb-border); border-radius: var(--bb-r-tile); background: var(--bb-surface); }
.bb-cart-line__media img { width: 100%; height: 100%; object-fit: contain; }
.bb-cart-line__info { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-top: 2px; }
.bb-cart-line__brand { font-size: .75rem; font-weight: 600; color: var(--bb-muted); }
.bb-cart-line__name { margin: 0; font-size: .9375rem; font-weight: 600; color: var(--bb-ink); }
.bb-cart-line__name a { color: inherit; text-decoration: none; }
.bb-cart-line__name a:hover { text-decoration: underline; }
.bb-cart-line__meta { margin: 2px 0 0; font-size: .8125rem; color: var(--bb-muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.bb-cart-line .variation { margin: 2px 0 0; font-size: .8125rem; color: var(--bb-muted); }
.bb-cart-line .backorder_notification { margin: 2px 0 0; font-size: .75rem; color: var(--bb-urgency); }
/* B4: ink, underlined, with a × glyph - not red/no-icon. */
.bb-cart-line__remove {
	display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
	min-height: 32px; margin-top: 4px; padding: 0 12px 0 10px;
	border: 1px solid var(--bb-border); border-radius: var(--bb-r-pill);
	background: var(--bb-surface); color: var(--bb-muted);
	font-size: .8125rem; font-weight: 600; text-decoration: none;
	transition: color .15s, border-color .15s, background-color .15s;
}
.bb-cart-line__remove-icon { flex: none; }
.bb-cart-line__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.bb-cart-line__actions .bb-cart-line__remove { margin-top: 0; }
.bb-cart-line__save {
	display: inline-flex; align-items: center; gap: 6px;
	min-height: 32px; padding: 0 12px 0 10px;
	border: 1px solid var(--bb-border); border-radius: var(--bb-r-pill);
	background: var(--bb-surface); color: var(--bb-muted);
	font: 600 .8125rem var(--bb-font-body); cursor: pointer;
	transition: color .15s, border-color .15s, background-color .15s;
}
.bb-cart-line__save:hover { border-color: var(--bb-ink); color: var(--bb-ink); }
.bb-cart-line__save:focus-visible { outline: 3px solid var(--bb-ink); outline-offset: 2px; }
.bb-cart-line__save[aria-busy="true"] { opacity: .6; cursor: progress; }
.bb-cart-line__remove:hover { border-color: #e7b4b4; background: #fdf2f2; color: #b42318; }
.bb-cart-line__remove:focus-visible { outline: 3px solid var(--bb-ink); outline-offset: 2px; }
/* Bigger tap area on touch screens without a bigger look. */
@media (pointer: coarse) { .bb-cart-line__remove { position: relative; } .bb-cart-line__remove::after { content: ""; position: absolute; inset: -6px; } }

.bb-cart-line__qty { padding-top: 2px; }
.bb-cart-line__qty .quantity { display: inline-flex; align-items: center; gap: 0; height: var(--bb-touch); padding: 0 2px; border: 1.5px solid var(--bb-border-2); border-radius: var(--bb-r-control); background: var(--bb-surface); }
.bb-cart-line__qty .quantity .qty { width: 34px; min-height: 0; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 1rem; padding: 0; }
.bb-cart-line__qty .quantity .qty:focus-visible { outline: 3px solid var(--bb-ink); outline-offset: 1px; border-radius: 6px; } /* QA A11Y-03 */
.bb-cart-line__qty .bb-qty__btn { display: grid; place-items: center; width: 34px; height: 40px; border: 0; border-radius: var(--bb-r-small); background: transparent; color: var(--bb-ink); cursor: pointer; }
.bb-cart-line__qty .bb-qty__btn:hover { background: var(--bb-ground); }
.bb-cart-line__qty .bb-qty__btn:disabled { opacity: .35; cursor: not-allowed; }

.bb-cart-line__total { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding-top: 2px; text-align: right; white-space: nowrap; }
.bb-cart-line__total strong { font-family: var(--bb-font-body); font-size: 1.1875rem; font-weight: 800; color: var(--bb-ink); }

/* ---------- Update-basket no-JS fallback ---------- */
.bb-cart__actions { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 16px; padding: 20px clamp(18px, 2.4vw, 28px); border-top: 1px solid var(--bb-border); background: var(--bb-ground); }
.bb-cart__update { flex: none; }

/* ---------- Coupon card (right rail, B5) ---------- */
.bb-cart-coupon { order: 2; }
.bb-cart-coupon__title { margin: 0 0 12px; font-size: clamp(1.125rem, 1.4rem - .3vw, 1.5rem); }
.bb-cart-coupon__form { margin: 0; }
.bb-cart-coupon__row { display: flex; gap: 8px; }
.bb-cart-coupon__row .bb-input { flex: 1; }
.bb-cart-coupon__row .bb-btn { flex: none; }

/* ---------- "How would you like it?" ---------- */
.bb-cart-fulfil__title { margin: 0 0 16px; }

/* ---------- "Add before they go" rail ---------- */
.bb-cart-rail__title { margin: 0 0 16px; font-size: clamp(1.25rem, 1.05rem + .7vw, 1.5rem); }

/* ---------- Rewards panel (myCred's own markup, restyled only; its inline
   <style> float/width rules are beaten by the extra id below). ---------- */
#bb-cart-collaterals #mycred-partial-payment-woo {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: clamp(18px, 2.4vw, 28px);
	border-radius: var(--bb-r-panel);
	background: var(--bb-ink);
	color: #fff;
	order: 1;
}
#bb-cart-collaterals #mycred-partial-payment-woo h3 { margin: 0 0 6px; font-size: 1.25rem; color: var(--bb-yellow); font-family: var(--bb-font-display); }
#bb-cart-collaterals #mycred-partial-payment-woo p { margin: 0 0 14px; font-size: .875rem; color: #ddd; }
#bb-cart-collaterals #mycred-partial-payment-woo label { display: block; margin: 0 0 6px; font-size: .8125rem; font-weight: 600; color: #ddd; }
#bb-cart-collaterals #mycred-partial-payment-woo select,
#bb-cart-collaterals #mycred-partial-payment-woo input[type="number"],
#bb-cart-collaterals #mycred-partial-payment-woo input[type="range"],
#bb-cart-collaterals #mycred-partial-payment-woo input[type="text"] { width: 100%; background: #fff; color: var(--bb-ink); margin-bottom: 10px; }
#bb-cart-collaterals #mycred-partial-payment-wrapper { margin-bottom: 0 !important; }
#bb-cart-collaterals #mycred-partial-payment-total { margin-bottom: 12px !important; }
#bb-cart-collaterals #mycred-partial-payment-total p { margin: 0 0 4px; font-weight: 700; color: #fff; }
#bb-cart-collaterals #mycred-range-action input[type="submit"] {
	display: inline-flex; align-items: center; justify-content: center;
	width: 100%; min-height: var(--bb-touch); margin: 4px 0 0;
	padding: 0 20px; border: 0; border-radius: var(--bb-r-control);
	background: var(--bb-yellow); color: var(--bb-ink);
	font: 700 .9375rem/1.2 var(--bb-font-body); cursor: pointer;
}
#bb-cart-collaterals #mycred-range-action input[type="submit"]:hover { background: #f2c400; }

/* ---------- Order summary ---------- */
#bb-cart-collaterals .bb-order-summary { order: 3; background: var(--bb-surface); border: 1px solid var(--bb-border); border-radius: var(--bb-r-panel); padding: clamp(18px, 2.4vw, 28px); }
.bb-order-summary__title { margin: 0 0 16px; }
/* table-layout: fixed stops the <table>'s content-based auto-sizing (its
   normal algorithm ignores the flex display on tr/th/td below) from forcing
   the 400px rail wider than its column at narrow widths. */
.bb-order-summary__table { width: 100%; max-width: 100%; border: 0; table-layout: fixed; }
.bb-order-summary__table tr { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border: 0; }
.bb-order-summary__table th,
.bb-order-summary__table td { display: block; padding: 7px 0; border: 0; font-size: .9375rem; font-weight: 500; text-align: right; }
.bb-order-summary__table th { font-weight: 500; color: var(--bb-body); text-align: left; }
.bb-order-summary__table td { color: var(--bb-ink); }
.bb-order-summary__table tr.order-total th,
.bb-order-summary__table tr.order-total td { padding-top: 14px; border-top: 1px solid var(--bb-border); font-family: var(--bb-font-body); font-size: 1.375rem; font-weight: 800; }
.bb-order-summary__table .woocommerce-Price-amount { font-weight: inherit; }
.bb-order-summary__table ul#shipping_method { list-style: none; margin: 0; padding: 0; text-align: right; }
.bb-order-summary__table .woocommerce-shipping-destination,
.bb-order-summary__table .woocommerce-shipping-contents { font-size: .8125rem; color: var(--bb-muted); }
/* A legacy sitewide "Additional CSS" rule (.shop_table tr.shipping th { display:
   none }), written for the old checkout's shipping-method list, also hides this
   row's own label here, since this panel intentionally reuses Woo's real
   .shop_table/tr.shipping classes (so woocommerce_shipping_calculator() and
   cart-shipping.php keep working unmodified). Restored, scoped to this panel. */
#bb-cart-collaterals .bb-order-summary__table tr.shipping th { display: block; }
.bb-order-summary__table .shipping-calculator-form { margin-top: 8px; text-align: left; }
.bb-order-summary__table .shipping-calculator-form p { margin: 0 0 10px; }
.bb-order-summary .shipping-calculator-button { font-size: .8125rem; font-weight: 700; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }

.bb-order-summary__note { margin: 14px 0; font-size: .8125rem; color: var(--bb-muted); }
.wc-proceed-to-checkout .checkout-button,
.wc-proceed-to-checkout .button {
	display: flex; width: 100%; min-height: var(--bb-touch); align-items: center; justify-content: center;
	border-radius: var(--bb-r-control); background: var(--bb-yellow); color: var(--bb-ink);
	font: 700 1rem/1.2 var(--bb-font-body); text-decoration: none; text-align: center;
}
.wc-proceed-to-checkout .checkout-button:hover { background: #f2c400; color: var(--bb-ink); }

/* B11: payment badges now use the shared bbt_payment_badges() helper and its
   own .bb-paybadges styling in main.css - just a touch of top margin here. */
.bb-order-summary .bb-paybadges { margin: 16px 0 0; }
.bb-order-summary__securenote { margin: 6px 0 0; font-size: .75rem; color: var(--bb-muted); }
.bb-order-summary__help { display: inline-block; margin-top: 16px; font-size: .875rem; }

/* ---------- Empty basket ---------- */
.bb-cart-empty { padding: clamp(32px, 5vw, 56px) 20px; }
.bb-cart-empty svg { margin: 0 auto 16px; color: var(--bb-muted); }
.bb-cart-empty__text { color: var(--bb-muted); }
.bb-cart-empty__rail { margin-top: var(--bb-section); }

/* ---------- Mobile sticky bar (no B mobile mock for this page) ---------- */
.bb-cart__mobilebar { display: none; }

/* ================= Responsive ================= */
@media (max-width: 1024px) {
	.bb-cart__layout { grid-template-columns: 1fr; }
	.bb-cart-line { grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "media info total" "media info qty"; }
	.bb-cart-line__media { grid-area: media; width: 72px; height: 72px; }
	.bb-cart-line__info { grid-area: info; }
	.bb-cart-line__total { grid-area: total; }
	.bb-cart-line__qty { grid-area: qty; padding-top: 8px; }
}

@media (max-width: 767px) {
	.bb-cart__head { flex-direction: column; align-items: stretch; }
	.bb-cart__continue { align-self: flex-start; }
	.bb-cart__savings { flex-direction: column; align-items: flex-start; }
	.bb-cart__actions { flex-direction: column; align-items: stretch; }
	.bb-cart__coupon { max-width: none; }

	/* This page's own sticky bar replaces the (already-hidden-on-cart) global
	   tabs/basket bar, so the body only reserves room for this one. */
	body.woocommerce-cart { padding-bottom: 0; }
	.bb-cart { padding-bottom: 76px; }
	.bb-cart__mobilebar {
		display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 55;
		align-items: center; justify-content: space-between; gap: 12px;
		padding: 12px 14px; border-radius: var(--bb-r-panel); background: var(--bb-surface);
		box-shadow: 0 10px 30px -10px rgba(17, 17, 17, .35);
	}
	.bb-cart__mobilebar-total { font-family: var(--bb-font-body); font-size: 1.25rem; font-weight: 800; color: var(--bb-ink); }
	.bb-cart__mobilebar .bb-btn { flex: none; }
}

@media (max-width: 420px) {
	.bb-cart-line { grid-template-columns: 64px minmax(0, 1fr) auto; }
	.bb-cart-line__media { width: 64px; height: 64px; }
}

/* Pack lines (Pack Size Selector) use the same stepper; hide the snippet's own wrappers' extras. */
.bb-cart-line__qty .bb-pack-cart-qty { display: inline-flex; }
.bb-cart-line__qty .bb-pack-cart-qty-input { -moz-appearance: textfield; }
.bb-cart-line__qty input.qty::-webkit-outer-spin-button, .bb-cart-line__qty input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bb-cart-lines .bb-cart-line__qty .quantity input.qty.bb-pack-cart-qty-input { width: 34px !important; min-width: 0 !important; max-width: 34px !important; padding: 0 !important; margin: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }

/* ---------- Free-delivery progress bar (template-parts/cart/free-shipping-bar.php) -
   only ever rendered when a real Woo free-shipping threshold is configured
   (inc/pages/cart.php::bbt_cart_free_shipping_threshold()). Same track/fill
   tokens as the checkout stepper (--bb-track / --bb-ink) for a consistent
   "progress" visual language across the theme. ---------- */
.bb-freeship { margin-bottom: 16px; padding: 16px 20px; }
.bb-freeship__text { margin: 0 0 10px; font-size: .9375rem; font-weight: 600; }
.bb-freeship.is-reached .bb-freeship__text { color: var(--bb-ink); }
.bb-freeship__track { height: 8px; border-radius: var(--bb-r-pill); background: var(--bb-track); overflow: hidden; }
.bb-freeship__fill { height: 100%; border-radius: var(--bb-r-pill); background: var(--bb-yellow); transition: width .3s ease; }
.bb-freeship.is-reached .bb-freeship__fill { background: var(--bb-ink); }
