/**
 * WooCommerce baseline compatibility — Bootstrap 5 conflict resolution.
 *
 * Minimal overrides only. Does not redesign WooCommerce output.
 * Scoped to .woocommerce selectors to prevent leaking into theme components.
 *
 * @package PackagingCommerce
 */

/* ── Reset Bootstrap conflicts on WC output ──────────────────────── */

/* WC sets display:block on <a> inside .woocommerce; Bootstrap row/col
   resets may override WC grid, so give WC its own stacking context. */

.woocommerce,
.woocommerce-page {
	/* Prevent WC styles bleeding into Bootstrap utilities */
}

/* WC renders inline quantity inputs that Bootstrap num inputs widen */
.woocommerce .quantity .qty {
	width: 72px;
	padding-inline: var(--brand-space-2);
	font-size: var(--brand-text-base);
}

/* WC tables — strip Bootstrap table-hover that WC doesn't expect */
.woocommerce table.shop_table {
	border-collapse: collapse;
	border: 1px solid var(--brand-color-border);
	font-size: var(--brand-text-sm);
}

.woocommerce table.shop_table th,
.woocommerce table.shop_table td {
	padding: var(--brand-space-3) var(--brand-space-4);
	border: 1px solid var(--brand-color-border);
	vertical-align: middle;
}

.woocommerce table.shop_table thead th {
	background-color: var(--brand-color-surface-alt);
	font-weight: var(--brand-weight-semibold);
}

/* ── WC product loop grid ────────────────────────────────────────── */

/*
 * Grid layout itself (display, grid-template-columns, gap) is owned by
 * assets/css/pages/shop.css so there is exactly one grid system for the
 * product loop. This file only strips WC's legacy float/width output so
 * it doesn't fight the grid.
 */
.woocommerce ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce ul.products li.product {
	/* WC adds inline width and float — reset for grid item sizing */
	width: auto;
	margin: 0;
	float: none;
}

/*
 * Remove WC's clearfix pseudo-elements entirely. `content:" "` on a
 * ::before/::after of a grid container generates an anonymous grid item,
 * which silently occupies the first grid cell and pushes every real
 * <li> one cell later — the exact cause of cards appearing to "skip" a
 * column at 2-column breakpoints. `display:none` alone (as previously
 * used for ::after) still leaves ::before's generated box in the grid;
 * both must be fully suppressed via `content:none`.
 */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
	content: none;
	display: none;
}

/* ── WC product images ───────────────────────────────────────────── */

.woocommerce .woocommerce-product-gallery img,
.woocommerce ul.products li.product img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* ── WC pagination ───────────────────────────────────────────────── */

.woocommerce nav.woocommerce-pagination ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--brand-space-1);
	list-style: none;
	margin: var(--brand-space-8) 0 0;
	padding: 0;
}

.woocommerce nav.woocommerce-pagination ul li {
	margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding-inline: var(--brand-space-2);
	border: 1px solid var(--brand-color-border);
	border-radius: var(--brand-radius-md);
	font-size: var(--brand-text-sm);
	color: var(--brand-color-ink);
	text-decoration: none;
	transition: background-color var(--brand-transition-fast),
	            color var(--brand-transition-fast),
	            border-color var(--brand-transition-fast);
}

.woocommerce nav.woocommerce-pagination ul li a:hover {
	background-color: var(--brand-color-primary-soft);
	border-color: var(--brand-color-primary);
	color: var(--brand-color-primary);
}

.woocommerce nav.woocommerce-pagination ul li span.current {
	background-color: var(--brand-color-primary);
	border-color: var(--brand-color-primary);
	color: #fff;
}

/* ── WC order-by select ──────────────────────────────────────────── */

.woocommerce-ordering select {
	padding: var(--brand-space-2) var(--brand-space-3);
	border: 1px solid var(--brand-color-border);
	border-radius: var(--brand-radius-md);
	font-size: var(--brand-text-sm);
	font-family: var(--brand-font-body);
	background-color: var(--brand-color-surface);
	color: var(--brand-color-ink);
	cursor: pointer;
}

/* ── WC result count ─────────────────────────────────────────────── */

.woocommerce-result-count {
	font-size: var(--brand-text-sm);
	color: var(--brand-color-muted);
	margin: 0;
}

/* ── WC breadcrumb ───────────────────────────────────────────────── */

.woocommerce .woocommerce-breadcrumb {
	font-size: var(--brand-text-xs);
	color: var(--brand-color-muted);
	margin-block-end: var(--brand-space-4);
}

.woocommerce .woocommerce-breadcrumb a {
	color: var(--brand-color-primary);
	text-decoration: none;
}

.woocommerce .woocommerce-breadcrumb a:hover {
	text-decoration: underline;
}

/* ── WC price ────────────────────────────────────────────────────── */

.woocommerce .price {
	color: var(--brand-color-ink);
	font-weight: var(--brand-weight-semibold);
}

.woocommerce .price ins {
	font-weight: var(--brand-weight-bold);
	text-decoration: none;
	color: var(--brand-color-primary);
}

.woocommerce .price del {
	color: var(--brand-color-muted);
	font-size: 0.875em;
	font-weight: var(--brand-weight-regular);
}

/* ── WC add-to-cart button ───────────────────────────────────────── */

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--brand-space-2) var(--brand-space-5);
	background-color: var(--brand-color-primary);
	color: #fff;
	border: none;
	border-radius: var(--brand-radius-md);
	font-family: var(--brand-font-body);
	font-size: var(--brand-text-sm);
	font-weight: var(--brand-weight-medium);
	cursor: pointer;
	text-decoration: none;
	transition: background-color var(--brand-transition-fast);
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
	background-color: var(--brand-color-primary-dark);
	color: #fff;
}

.woocommerce a.button.alt,
.woocommerce button.button.alt {
	background-color: var(--brand-color-secondary);
}

.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
	background-color: var(--brand-color-secondary-dark);
}

.woocommerce a.button.disabled,
.woocommerce button.button:disabled,
.woocommerce a.button.disabled:hover {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── WC form fields ──────────────────────────────────────────────── */

.woocommerce form .form-row label {
	display: block;
	font-size: var(--brand-text-sm);
	font-weight: var(--brand-weight-medium);
	margin-block-end: var(--brand-space-1);
	color: var(--brand-color-ink);
}

.woocommerce form .form-row .input-text,
.woocommerce form .form-row select {
	width: 100%;
	padding: var(--brand-space-2) var(--brand-space-3);
	border: 1px solid var(--brand-color-border);
	border-radius: var(--brand-radius-md);
	font-size: var(--brand-text-base);
	font-family: var(--brand-font-body);
	background-color: var(--brand-color-surface);
	color: var(--brand-color-ink);
	transition: border-color var(--brand-transition-fast),
	            box-shadow var(--brand-transition-fast);
}

.woocommerce form .form-row .input-text:focus,
.woocommerce form .form-row select:focus {
	border-color: var(--brand-color-primary);
	box-shadow: 0 0 0 3px var(--brand-color-primary-soft);
	outline: none;
}

/* ── WC RTL fixes ────────────────────────────────────────────────── */

/* WC adds float:left on some elements which breaks RTL */
.woocommerce .quantity,
.woocommerce-cart .cart-collaterals,
.woocommerce-cart table.cart td.actions {
	float: none;
}

/* WC ul.products uses clearfix floats on children — already reset above */

/* ── WC ajax spinner ─────────────────────────────────────────────── */

.woocommerce .blockUI.blockOverlay {
	z-index: var(--brand-z-modal);
}
