/* Ben Martin — WooCommerce attribute filters (WCAF plugin) */

body.bm-shop-archive .woo-listing-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
}

body.bm-shop-archive .bm-shop-filters-toggle {
	display: none;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--benmartin-line);
	border-radius: var(--benmartin-radius);
	background: var(--benmartin-white);
	font-family: var(--benmartin-sans);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--benmartin-black);
	cursor: pointer;
}

body.bm-shop-archive .bm-applied-filters-slot {
	flex: 1 1 100%;
}

body.bm-shop-archive .bm-applied-filters-slot:empty {
	display: none;
}

/* Desktop layout: sidebar 22%, gap 3%, products fill the rest */
body.bm-shop-archive,
body.bm-shop-archive .ct-container,
body.bm-shop-archive [data-sidebar] {
	--sidebar-width: 20%;
	--sidebar-gap: 3%;
}

body.bm-shop-archive #sidebar {
	align-self: flex-start;
}

body.bm-shop-archive #sidebar .ct-sidebar {
	width: 100%;
	max-width: none;
	padding-right: 20px;
	border-right: 1px solid var(--benmartin-line);
	box-sizing: border-box;
}

/* 4 products per row on desktop */
@media (min-width: 1000px) {
	body.bm-shop-archive [data-products] {
		--shop-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Product card type to match homepage cards */
body.bm-shop-archive [data-products] .woocommerce-loop-product__title,
body.bm-shop-archive [data-products] .woocommerce-loop-product__title a,
body.bm-shop-archive [data-products] .product a.woocommerce-loop-product__link {
	font-family: var(--benmartin-sans) !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.35 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	margin: 0 0 4px !important;
}

body.bm-shop-archive [data-products] .product .price {
	font-family: var(--benmartin-sans);
	font-size: 13px;
	font-weight: 700;
	margin: 0 0 6px;
}

body.bm-shop-archive [data-products] .product .price del {
	color: var(--benmartin-muted);
	font-weight: 500;
	margin-right: 6px;
}

body.bm-shop-archive [data-products] .product .price ins {
	text-decoration: none;
}

.bm-shop-filters__head {
	display: block;
	margin-bottom: 18px;
}

.bm-shop-filters__title {
	margin: 0;
	font-family: var(--benmartin-sans);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--benmartin-black);
}

.bm-shop-filters__clear {
	display: block;
	width: 100%;
	margin-top: 18px;
	padding: 12px 16px;
	box-sizing: border-box;
	text-align: center;
	font-family: var(--benmartin-sans);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--benmartin-btn-text);
	background: var(--benmartin-btn-bg);
	border: 1px solid var(--benmartin-btn-bg);
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bm-shop-filters__clear:hover {
	background: var(--benmartin-btn-bg-hover);
	border-color: var(--benmartin-btn-bg-hover);
	color: var(--benmartin-btn-text);
	opacity: 1;
}

body.bm-shop-archive .wcaf-filters,
body.benmartin-shop .wcaf-filters {
	margin: 0;
}

body.bm-shop-archive .wcaf-group,
body.benmartin-shop .wcaf-group {
	margin: 0 0 18px;
	padding: 0 0 14px;
	border: 0;
	border-bottom: 1px solid var(--benmartin-line);
}

body.bm-shop-archive .wcaf-group legend,
body.benmartin-shop .wcaf-group legend {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin: 0 0 12px;
	padding: 0;
	font-family: var(--benmartin-sans);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--benmartin-black);
}

body.bm-shop-archive .wcaf-group legend::after,
body.benmartin-shop .wcaf-group legend::after {
	content: "";
	width: 6px;
	height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	opacity: 0.55;
	margin-left: 8px;
}

.wcaf-terms {
    list-style: none;
    padding-left: 10px;
}

body.bm-shop-archive .wcaf-group.pa_bottoms_size_value ul li label, body.bm-shop-archive .wcaf-group.pa_size ul li label {
    width: 44px;
    height: 30px;
    min-height: 30px;
    border-radius: 6px;
}

.wcaf-group label {
	display: flex;
	gap: 6px;
	align-items: center;
}

/* Size / numeric attribute chips — flex wrap stays compact as sidebar widens */
body.bm-shop-archive .wcaf-group.pa_size .wcaf-terms,
body.bm-shop-archive .wcaf-group.pa_bottoms_size_value .wcaf-terms,
body.bm-shop-archive .wcaf-group.pa_jeans_length .wcaf-terms,
body.bm-shop-archive .wcaf-group.pa_number_pockets .wcaf-terms,
body.bm-shop-archive .wcaf-group.pa_size_map .wcaf-terms,
body.benmartin-shop .wcaf-group.pa_size .wcaf-terms,
body.benmartin-shop .wcaf-group.pa_bottoms_size_value .wcaf-terms,
body.benmartin-shop .wcaf-group.pa_jeans_length .wcaf-terms,
body.benmartin-shop .wcaf-group.pa_number_pockets .wcaf-terms,
body.benmartin-shop .wcaf-group.pa_size_map .wcaf-terms {
	display: flex !important;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

body.bm-shop-archive .wcaf-group.pa_size .wcaf-terms li,
body.bm-shop-archive .wcaf-group.pa_bottoms_size_value .wcaf-terms li,
body.bm-shop-archive .wcaf-group.pa_jeans_length .wcaf-terms li,
body.bm-shop-archive .wcaf-group.pa_number_pockets .wcaf-terms li,
body.bm-shop-archive .wcaf-group.pa_size_map .wcaf-terms li,
body.benmartin-shop .wcaf-group.pa_size .wcaf-terms li,
body.benmartin-shop .wcaf-group.pa_bottoms_size_value .wcaf-terms li,
body.benmartin-shop .wcaf-group.pa_jeans_length .wcaf-terms li,
body.benmartin-shop .wcaf-group.pa_number_pockets .wcaf-terms li,
body.benmartin-shop .wcaf-group.pa_size_map .wcaf-terms li {
	margin: 0;
	padding: 0;
	flex: 0 0 auto;
}

body.bm-shop-archive .wcaf-group.pa_size label,
body.bm-shop-archive .wcaf-group.pa_bottoms_size_value label,
body.bm-shop-archive .wcaf-group.pa_jeans_length label,
body.bm-shop-archive .wcaf-group.pa_number_pockets label,
body.bm-shop-archive .wcaf-group.pa_size_map label,
body.benmartin-shop .wcaf-group.pa_size label,
body.benmartin-shop .wcaf-group.pa_bottoms_size_value label,
body.benmartin-shop .wcaf-group.pa_jeans_length label,
body.benmartin-shop .wcaf-group.pa_number_pockets label,
body.benmartin-shop .wcaf-group.pa_size_map label {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	width: auto;
	min-width: 44px;
	min-height: 36px;
	margin: 0;
	padding: 6px 10px;
	border: 1px solid var(--benmartin-line);
	border-radius: 0;
	background: var(--benmartin-white);
	font-family: var(--benmartin-sans);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	box-sizing: border-box;
	cursor: pointer;
	color: var(--benmartin-ink);
}

body.bm-shop-archive .wcaf-group.pa_size label:has(input:checked),
body.bm-shop-archive .wcaf-group.pa_bottoms_size_value label:has(input:checked),
body.bm-shop-archive .wcaf-group.pa_jeans_length label:has(input:checked),
body.bm-shop-archive .wcaf-group.pa_number_pockets label:has(input:checked),
body.bm-shop-archive .wcaf-group.pa_size_map label:has(input:checked),
body.benmartin-shop .wcaf-group.pa_size label:has(input:checked),
body.benmartin-shop .wcaf-group.pa_bottoms_size_value label:has(input:checked),
body.benmartin-shop .wcaf-group.pa_jeans_length label:has(input:checked),
body.benmartin-shop .wcaf-group.pa_number_pockets label:has(input:checked),
body.benmartin-shop .wcaf-group.pa_size_map label:has(input:checked) {
	border-color: var(--benmartin-black);
	background: var(--benmartin-black);
	color: var(--benmartin-white);
}

body.bm-shop-archive .wcaf-group.pa_size input[type="checkbox"],
body.bm-shop-archive .wcaf-group.pa_bottoms_size_value input[type="checkbox"],
body.bm-shop-archive .wcaf-group.pa_jeans_length input[type="checkbox"],
body.bm-shop-archive .wcaf-group.pa_number_pockets input[type="checkbox"],
body.bm-shop-archive .wcaf-group.pa_size_map input[type="checkbox"],
body.benmartin-shop .wcaf-group.pa_size input[type="checkbox"],
body.benmartin-shop .wcaf-group.pa_bottoms_size_value input[type="checkbox"],
body.benmartin-shop .wcaf-group.pa_jeans_length input[type="checkbox"],
body.benmartin-shop .wcaf-group.pa_number_pockets input[type="checkbox"],
body.benmartin-shop .wcaf-group.pa_size_map input[type="checkbox"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 1px;
	height: 1px;
	margin: 0;
}

/* Color swatches */
body.bm-shop-archive .wcaf-chips,
body.benmartin-shop .wcaf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

body.bm-shop-archive .wcaf-chip,
body.benmartin-shop .wcaf-chip {
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid var(--benmartin-line);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

body.bm-shop-archive .wcaf-chip.is-active,
body.benmartin-shop .wcaf-chip.is-active {
	outline: 1px solid var(--benmartin-black);
	outline-offset: 2px;
}

body.bm-shop-archive .wcaf-chip-dot,
body.benmartin-shop .wcaf-chip-dot {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	display: block;
}

/* Applied filters bar */
body.bm-shop-archive #wcaf-applied-filters,
body.benmartin-shop #wcaf-applied-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 14px;
}

body.bm-shop-archive .wcaf-chip-applied,
body.benmartin-shop .wcaf-chip-applied {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	background: var(--benmartin-white);
	border: 1px solid var(--benmartin-line);
	border-radius: 999px;
	font-family: var(--benmartin-sans);
	font-size: 12px;
	color: var(--benmartin-ink);
}

body.bm-shop-archive .wcaf-chip-applied .remove-filter,
body.benmartin-shop .wcaf-chip-applied .remove-filter {
	cursor: pointer;
	font-weight: 700;
	line-height: 1;
	color: var(--benmartin-muted);
}

body.bm-shop-archive #wcaf-applied-filters .clear-all,
body.benmartin-shop #wcaf-applied-filters .clear-all {
	display: inline-flex;
	align-items: center;
	padding: 6px 14px;
	border-radius: 999px;
	background: var(--benmartin-btn-bg);
	color: var(--benmartin-btn-text);
	font-family: var(--benmartin-sans);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

body.bm-shop-archive #wcaf-applied-filters .clear-all:hover,
body.benmartin-shop #wcaf-applied-filters .clear-all:hover {
	background: var(--benmartin-btn-bg-hover);
	color: var(--benmartin-btn-text);
}

/* Mobile drawer */
@media (max-width: 768px) {
	body.bm-shop-archive .bm-shop-filters-toggle {
		display: inline-flex;
	}

	body.bm-shop-archive #sidebar {
		display: none;
	}

	body.bm-shop-archive.bm-filters-open {
		overflow: hidden;
	}

	.bm-shop-filters-drawer {
		position: fixed;
		inset: 0;
		z-index: 999990;
	}

	.bm-shop-filters-drawer[hidden] {
		display: none;
	}

	.bm-shop-filters-drawer__overlay {
		position: absolute;
		inset: 0;
		background: rgba(10, 10, 10, 0.45);
	}

	.bm-shop-filters-drawer__panel {
		position: absolute;
		top: 0;
		left: 0;
		width: min(320px, 88vw);
		height: 100%;
		background: var(--benmartin-white);
		box-shadow: 8px 0 30px rgba(10, 10, 10, 0.12);
		overflow: auto;
		-webkit-overflow-scrolling: touch;
	}

	.bm-shop-filters-drawer__mount {
		padding: 20px;
	}

	.bm-shop-filters.is-drawer-active .bm-shop-filters__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		margin-bottom: 16px;
	}

	.bm-shop-filters__close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--benmartin-black);
		cursor: pointer;
	}
}

@media (min-width: 769px) {
	.bm-shop-filters__head {
		margin-bottom: 18px;
	}

	.bm-shop-filters__close {
		display: none;
	}
}
