/**
 * cart.css
 *
 * Ported directly from the approved review mockup. Covers line items,
 * order summary, free shipping progress, shipping estimate widget, and
 * the Save/Share Cart actions.
 */

.page-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	border-bottom: 2px solid #111;
	padding: 10px 0 14px;
	margin-bottom: 24px;
	flex-wrap: wrap;
	gap: 10px;
}
.page-header h1 {
	margin: 0;
	font-size: 24px;
	text-transform: uppercase;
}
.page-header .count {
	font-size: 13px;
	color: #666;
}

.cart-layout {
	display: grid;
	grid-template-columns: 1fr 360px;
	gap: 32px;
	align-items: start;
	/* Bottom spacing before the footer now comes from .site-footer's
	 * canonical margin-top (footer.css, testing-round item 18) — this
	 * page-specific padding-bottom was removed 2026-09-02 to avoid
	 * doubling up with it. */
}
/*
 * Mobile-audit "Cart Page" pass (2026-09-15) — found live while
 * render-testing the new 600px card reflow below: a CSS grid item
 * defaults to min-width:auto, meaning its column refuses to shrink
 * below its CONTENT's min-content width rather than the 1fr track
 * width, unless told otherwise. Never surfaced before because the real
 * <table> element's own intrinsic sizing masked it; the moment the
 * table reflows to block/flex layout below (for the card view), its
 * content (specifically .line-product's flex children, see .info's own
 * min-width:0 further down) could set a wider floor than the phone's
 * actual viewport — a horizontal-scroll regression this sub-project
 * explicitly rules out. Confirmed via Playwright at 320px before this
 * fix (grid track computed to 341px in a 272px-wide container) and
 * after (no overflow at 320px or 375px).
 */
.cart-layout > div {
	min-width: 0;
}

/* ---------------- Line items ---------------- */
.cart-table {
	width: 100%;
	border-collapse: collapse;
}
.cart-table th {
	text-align: left;
	font-size: 10.5px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #888;
	border-bottom: 2px solid #111;
	padding-bottom: 10px;
}
.cart-table td {
	border-bottom: 1px solid #eee;
	padding: 16px 0;
	vertical-align: top;
	font-size: 13px;
}
.line-product {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}
/* Same min-width:auto flex-blowout fix as .cart-layout > div above,
 * one level deeper: without this, .info (a flex item with text content)
 * won't shrink below its own min-content floor either, which is the
 * second half of what let the mobile card view push past the phone's
 * actual width before this fix. */
.line-product .info {
	min-width: 0;
}
.line-product .thumb {
	width: 64px;
	height: 64px;
	background: #f2f2f2;
	border: 1px solid #ddd;
	flex-shrink: 0;
}
.line-product .thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.line-product .info h4 {
	font-size: 13px;
	margin: 0 0 3px;
}
.line-product .info .meta {
	font-size: 11.5px;
	color: #888;
}
.qty-input {
	width: 60px;
	padding: 6px;
	border: 1px solid #ccc;
	text-align: center;
	font-size: 13px;
}
/*
 * −/+ stepper wrapping the Qty input (mobile-audit "Cart Page"/"Quote
 * Page" pass, 2026-09-15) — same component already built for the
 * Pricing Matrix (template-parts/single-product/pricing-matrix.php,
 * assets/css/single-product.css): native number-input spin arrows are
 * inconsistent across browsers and too small to tap reliably, so this
 * is used at every screen size, not just mobile. Duplicated here rather
 * than shared with single-product.css — that stylesheet isn't enqueued
 * on the Cart or View Quote pages, and this file is already the one
 * place both those pages load in common (see class-enqueue-assets.php),
 * matching this theme's existing per-page-split asset convention rather
 * than adding a new shared "components.css" for one small block.
 * .qty-input keeps its existing class/name/selectors untouched — this
 * only wraps it, so assets/js/cart.js's and assets/js/quote-cart.js's
 * `.qty-input` selectors still resolve the same element.
 */
.qty-stepper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid #ccc;
}
.qty-stepper button {
	background: #f7f7f7;
	border: 0;
	width: 26px;
	font-size: 14px;
	cursor: pointer;
}
.qty-stepper .qty-dec {
	border-right: 1px solid #ccc;
}
.qty-stepper .qty-inc {
	border-left: 1px solid #ccc;
}
.qty-stepper button:hover:not(:disabled) {
	background: #e8e8e8;
}
.qty-stepper button:disabled {
	color: #ccc;
	cursor: default;
}
.qty-stepper .qty-input {
	width: 44px;
	border: 0;
	padding: 5px 2px;
	/* -moz-appearance below still needs a border set (inherited none from
	 * the stepper's own input reset above), matching single-product.css's
	 * identical rule. */
	-moz-appearance: textfield;
}
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.remove-btn {
	background: none;
	border: 0;
	color: var(--ink);
	padding: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}
.remove-btn:hover {
	opacity: 0.6;
}
.remove-btn svg {
	width: 17px;
	height: 17px;
}
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
.line-total-cell {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}
.line-total {
	font-weight: 700;
}
.savings-note {
	font-size: 11px;
	color: var(--ink-soft);
	margin-top: 2px;
}
.savings-note:empty {
	display: none;
}
.continue-shopping {
	display: inline-block;
	margin-top: 20px;
	font-size: 12.5px;
	text-decoration: underline;
	color: #666;
}

/* ---------------- Order summary ---------------- */
.summary-box {
	border: 2px solid #111;
	padding: 22px;
	position: sticky;
	top: 90px;
}
.summary-box h3 {
	text-transform: uppercase;
	font-size: 13px;
	letter-spacing: 0.04em;
	border-bottom: 1px solid var(--line);
	padding-bottom: 12px;
	margin-bottom: 14px;
}
.summary-row {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	padding: 6px 0;
}
.summary-row.units {
	color: #666;
}
.summary-row.savings {
	font-weight: 700;
}
.summary-row.total {
	border-top: 2px solid #111;
	margin-top: 10px;
	padding-top: 12px;
	font-weight: 800;
	font-size: 16px;
}
/*
 * .btn is a shared, site-wide class (base.css) — each mockup file
 * actually defines its own local .btn slightly differently per page
 * context (single-product's is inline-flex in a row of buttons,
 * account's is inline-block, cart's is a full-width block button with
 * top spacing). The theme's shared base.css version matches the
 * account mockup's definition, which is correct for account-page
 * buttons but left "Proceed to Checkout" narrow and left-aligned
 * instead of the cart mockup's full-width, centered, spaced-out
 * treatment. Scoped override here rather than changing the shared
 * class, which would incorrectly affect every other page that
 * correctly relies on the inline-block version.
 */
.summary-box .btn,
.modal-box .btn {
	display: block;
	width: 100%;
	padding: 13px;
	margin-top: 16px;
}

/* ---------------- Free shipping progress ---------------- */
.free-shipping-widget {
	border-top: 1px solid var(--line);
	margin-top: 16px;
	padding-top: 16px;
}
.free-shipping-bar-track {
	width: 100%;
	height: 6px;
	background: #eee;
	border: 1px solid #ddd;
	overflow: hidden;
}
.free-shipping-bar-fill {
	height: 100%;
	background: #111;
	width: 0%;
	transition: width 0.3s ease;
}
.free-shipping-message {
	font-size: 12px;
	margin-top: 8px;
	text-align: center;
}
.free-shipping-message.unlocked {
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* ---------------- Shipping estimate widget ---------------- */
.shipping-widget {
	border-top: 1px solid var(--line);
	margin-top: 16px;
	padding-top: 16px;
}
.shipping-widget label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
	margin-bottom: 6px;
}
.shipping-input-row {
	display: flex;
	gap: 8px;
}
.shipping-input-row input {
	flex: 1;
	border: 1px solid #ccc;
	padding: 8px 10px;
	font-size: 13px;
}
.shipping-input-row button {
	border: 1px solid #111;
	background: #111;
	color: #fff;
	padding: 0 14px;
	font-size: 11.5px;
	text-transform: uppercase;
	font-weight: 600;
	cursor: pointer;
}
.shipping-result {
	margin-top: 10px;
	font-size: 12.5px;
	padding: 10px 12px;
	border: 1px solid #ddd;
	background: var(--bg-soft);
	display: none;
}
.shipping-result.show {
	display: block;
}
.shipping-result.freight {
	border: 2px solid #111;
	background: #f7f7f7;
}
.shipping-result .disclaimer {
	display: block;
	font-size: 10.5px;
	color: #999;
	margin-top: 4px;
}

/* ---------------- Save / Share Cart ---------------- */
.save-cart-row {
	margin-top: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.save-cart-link,
.share-cart-link {
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 600;
	text-decoration: underline;
	color: #666;
	background: none;
	border: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	cursor: pointer;
}
.save-cart-link svg,
.share-cart-link svg {
	width: 14px;
	height: 14px;
}

/*
 * Save/Share Cart modals — .modal-overlay / .modal-box (common) /
 * .modal-close / .modal-box h3 live in base.css, shared with the
 * single product page's Size Chart modal. This is just the size this
 * page's compact form content needs (narrower than single-product's
 * size-chart table) plus the text input styling neither page needed
 * until now.
 */
.modal-box {
	max-width: 420px;
}
.modal-box input {
	width: 100%;
	border: 1px solid #ccc;
	padding: 10px 12px;
	font-size: 13px;
	margin-bottom: 14px;
}
.modal-box label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
	display: block;
	margin-bottom: 6px;
}
.modal-box p {
	font-size: 12.5px;
	color: #666;
	margin-top: 0;
}
.share-link-row {
	display: flex;
	gap: 8px;
	margin-bottom: 14px;
}
.share-link-row input {
	margin-bottom: 0;
}
.share-link-row .btn {
	width: auto;
	margin-top: 0;
	padding: 0 16px;
	white-space: nowrap;
}
.share-note {
	font-size: 11px;
	color: #999;
	margin-bottom: 0;
}

/* ---------------- Empty cart ---------------- */
.empty-state {
	border: 1px dashed #999;
	padding: 60px 20px;
	text-align: center;
}
.empty-state h2 {
	margin-bottom: 8px;
}
.empty-state p {
	color: #666;
	margin-bottom: 20px;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
	.cart-layout {
		grid-template-columns: 1fr;
	}
	.line-product {
		flex-direction: column;
		align-items: flex-start;
	}
	.summary-box {
		position: static;
	}
}

/*
 * Mobile-audit "Cart Page"/"Quote Page" pass (2026-09-15). .cart-table
 * had zero responsive treatment below 900px — a raw 5-column table
 * (Product 45%, Unit Price, Qty, Line Total, remove icon) that either
 * overflowed or crushed illegibly at phone widths, exactly what this
 * sub-project's no-horizontal-scroll rule rules out. Reflows below 600px
 * into one bordered card per line item instead, same "table → card"
 * technique already used for the Pricing Matrix (data-label attributes +
 * ::before generated content; <thead> hidden since every value already
 * carries its own label — see template-parts/single-product/
 * pricing-matrix.php's docblock for the full reasoning).
 *
 * This one block fixes BOTH the real Cart page (woocommerce/cart/
 * cart.php) and View Quote (template-view-quote.php) at once, since
 * both load this stylesheet and both use .cart-table — View Quote's
 * slightly different inner markup (a bare .line-total span instead of
 * Cart's .line-total-cell wrapper; an <a> instead of a <button> for
 * Remove) still matches every selector here because they all target the
 * shared .cart-table / data-label / .cart-td-* / .remove-btn contract,
 * not a page-specific wrapper element.
 */
@media (max-width: 600px) {
	.cart-table thead {
		display: none;
	}
	.cart-table,
	.cart-table tbody,
	.cart-table tr,
	.cart-table td {
		display: block;
		width: 100%;
	}
	.cart-table tr {
		position: relative;
		border: 1px solid #111;
		/* Right padding reserves room for .cart-td-remove, positioned
		 * absolute within this row below — keeps the remove icon from
		 * ever overlapping the price/qty/total text next to it. */
		padding: 14px 44px 14px 14px;
		margin-bottom: 12px;
	}
	.cart-table td {
		border-bottom: 0;
		padding: 6px 0;
	}
	.cart-table td:first-child {
		padding-top: 0;
	}
	/* Product cell (thumb + title) is the card's own visual header — no
	 * data-label needed, just a hairline separating it from the labeled
	 * fields below (same #eee tone the desktop table's row divider
	 * already uses). */
	.cart-table .cart-td-product {
		padding-bottom: 12px;
		margin-bottom: 8px;
		border-bottom: 1px solid #eee;
	}
	.cart-table td[data-label]::before {
		content: attr(data-label);
		display: block;
		font-size: 10.5px;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: #888;
		margin-bottom: 4px;
	}
	.cart-table .line-total-cell {
		align-items: flex-start;
	}
	.cart-table .cart-td-remove {
		position: absolute;
		top: 12px;
		right: 10px;
		width: auto;
		padding: 0;
	}
	/* Larger tap targets + iOS Safari's zoom-on-focus fix (any input
	 * under 16px triggers it — same fix already applied to the header
	 * search input, assets/css/header.css) for the stepper built into
	 * this same file, above. */
	.qty-stepper button {
		width: 32px;
		padding: 6px 0;
	}
	.qty-stepper .qty-input {
		font-size: 16px;
	}
}
