/* WC Advanced Product Filter - front-end styles
   Scoped under .wcpf-wrapper and written defensively (explicit resets on
   buttons/inputs) so the active theme's global styles can't leak in and
   break the layout — this is what caused the solid-color buttons and the
   broken-looking price slider before. */

.wcpf-wrapper,
.wcpf-wrapper *,
.wcpf-wrapper *::before,
.wcpf-wrapper *::after {
	box-sizing: border-box;
}

.wcpf-wrapper {
	--wcpf-accent: #1a1a1a;
	--wcpf-radius: 10px;
	--wcpf-border: #e2e2e2;
	--wcpf-text: #1a1a1a;
	--wcpf-muted: #8a8a8a;

	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--wcpf-text);
	line-height: 1.4;
	direction: ltr; /* keep the filter/grid layout predictable even on RTL-configured sites */
}

.wcpf-filters {
	flex: 0 0 260px;
	max-width: 260px;
	padding-right: 36px;
	border-right: 1px solid var(--wcpf-border);
}

.wcpf-filter-form {
	display: flex;
	flex-direction: column;
	gap: 22px;
}

/* ---------- Price block ---------- */

.wcpf-price-filter h4 {
	margin: 0 0 22px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: .01em;
}

.wcpf-price-slider {
	position: relative;
	height: 28px;
	margin: 0 2px 6px;
	touch-action: none;
}

.wcpf-slider-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 4px;
	transform: translateY(-50%);
	background: #e8e8e8;
	border-radius: 4px;
}

.wcpf-slider-range {
	position: absolute;
	top: 50%;
	height: 4px;
	transform: translateY(-50%);
	background: var(--wcpf-accent);
	border-radius: 4px;
}

.wcpf-slider-handle {
	position: absolute;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-left: -9px;
	transform: translateY(-50%);
	background: var(--wcpf-accent);
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1.5px var(--wcpf-accent), 0 2px 5px rgba(0, 0, 0, .25);
	cursor: grab;
	transition: box-shadow .15s ease;
}

.wcpf-slider-handle:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.wcpf-slider-handle.is-dragging,
.wcpf-slider-handle:active {
	cursor: grabbing;
	box-shadow: 0 0 0 6px rgba(0, 0, 0, .08);
}

.wcpf-slider-handle:focus-visible {
	outline: 2px solid var(--wcpf-accent);
	outline-offset: 3px;
}

.wcpf-price-values {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 13.5px;
	color: var(--wcpf-muted);
	font-variant-numeric: tabular-nums;
}

.wcpf-price-readout {
	color: var(--wcpf-text);
	font-weight: 500;
}

/* ---------- Dropdown / accordion filter groups ---------- */

.wcpf-dropdown {
	border-top: 1px solid var(--wcpf-border);
	padding-top: 18px;
}

.wcpf-dropdown:first-of-type {
	border-top: none;
	padding-top: 0;
}

.wcpf-wrapper button.wcpf-dropdown-toggle {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: #fff;
	border: 1px solid var(--wcpf-border);
	border-radius: var(--wcpf-radius);
	padding: 13px 16px;
	font-size: 14px;
	font-family: inherit;
	color: var(--wcpf-text);
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.wcpf-wrapper button.wcpf-dropdown-toggle:hover {
	border-color: #bbb;
}

.wcpf-dropdown.is-open button.wcpf-dropdown-toggle {
	border-color: var(--wcpf-accent);
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.wcpf-chevron {
	transition: transform .18s ease;
	color: var(--wcpf-muted);
	flex: 0 0 auto;
	margin-left: 10px;
}

.wcpf-dropdown.is-open .wcpf-chevron {
	transform: rotate(180deg);
	color: var(--wcpf-text);
}

.wcpf-dropdown-panel {
	display: none;
	background: #fff;
	border: 1px solid var(--wcpf-border);
	border-top: none;
	border-radius: 0 0 var(--wcpf-radius) var(--wcpf-radius);
	padding: 6px 16px 14px;
}

.wcpf-dropdown.is-open .wcpf-dropdown-panel {
	display: block;
	border-color: var(--wcpf-accent);
}

.wcpf-terms-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 240px;
	overflow-y: auto;
}

.wcpf-terms-list li {
	margin: 0;
	border-bottom: 1px solid #f1f1f1;
}

.wcpf-terms-list li:last-child {
	border-bottom: none;
}

.wcpf-wrapper .wcpf-terms-list label {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13.5px;
	padding: 9px 0;
	cursor: pointer;
	color: var(--wcpf-text);
}

.wcpf-wrapper .wcpf-terms-list input[type="checkbox"] {
	appearance: auto;
	width: 16px;
	height: 16px;
	accent-color: var(--wcpf-accent);
	cursor: pointer;
	flex: 0 0 auto;
}

.wcpf-term-count {
	color: var(--wcpf-muted);
	font-size: 12px;
	margin-left: auto;
}

.wcpf-wrapper button.wcpf-btn-reset {
	all: unset;
	box-sizing: border-box;
	display: block;
	width: 100%;
	text-align: center;
	padding: 12px;
	border: 1px solid var(--wcpf-border);
	border-radius: var(--wcpf-radius);
	background: #fff;
	color: var(--wcpf-text);
	font-family: inherit;
	font-size: 13.5px;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.wcpf-wrapper button.wcpf-btn-reset:hover {
	background: #f7f7f7;
	border-color: #ccc;
}

/* ---------- Product grid / results ---------- */

.wcpf-results {
	flex: 1 1 0;
	min-width: 0;
	position: relative;
	padding-left: 36px;
	scroll-margin-top: 40px;
}

.wcpf-loading {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .75);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	z-index: 5;
	opacity: 0;
	pointer-events: none;
	transition: opacity .15s ease;
}

.wcpf-loading.is-visible {
	opacity: 1;
	pointer-events: all;
}

.wcpf-no-products {
	grid-column: 1 / -1;
	padding: 50px 0;
	text-align: center;
	color: var(--wcpf-muted);
}

/* ---------- Product grid: hardened against theme/WooCommerce default styles ----------
   Themes commonly style `ul.products li.product` with float/width/margin (the classic
   WooCommerce grid). Those rules can out-specificity a plain `display:grid`, which is what
   caused the broken "two products with huge gaps" layout. The selectors and !important
   below make sure our grid always wins regardless of the active theme. */

.wcpf-results ul.products.wcpf-product-grid {
	display: grid !important;
	direction: ltr !important;
	grid-template-columns: repeat(var(--wcpf-columns, 4), minmax(0, 1fr)) !important;
	gap: 24px !important;
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* WooCommerce core CSS adds a float-clearfix trick to every product list:
   `.woocommerce ul.products::before/::after { content:" "; display:table; }`.
   That's invisible and harmless under the old float layout, but the moment the list
   becomes a CSS Grid container, that generated pseudo-element turns into a real,
   visible grid item — the very first one in the row — which is exactly what was
   showing up as an empty box before any real product. Grid doesn't need a clearfix
   at all, so just remove the pseudo-elements entirely. */
.wcpf-results ul.products.wcpf-product-grid::before,
.wcpf-results ul.products.wcpf-product-grid::after {
	content: none !important;
	display: none !important;
}

@media (max-width: 1200px) {
	.wcpf-results ul.products.wcpf-product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 900px) {
	.wcpf-results ul.products.wcpf-product-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 16px !important;
	}
}

@media (max-width: 480px) {
	.wcpf-results ul.products.wcpf-product-grid {
		grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
	}
}

.wcpf-results ul.products.wcpf-product-grid li.product {
	float: none !important;
	clear: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: 16px !important;
	display: flex !important;
	flex-direction: column;
	gap: 4px;
	background: #fff;
	border: 1px solid var(--wcpf-border);
	border-radius: var(--wcpf-radius);
	transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}

.wcpf-results .wcpf-product-grid li.product:hover {
	box-shadow: 0 10px 28px rgba(0, 0, 0, .08);
	transform: translateY(-3px);
	border-color: #d5d5d5;
}

.wcpf-results .wcpf-product-grid li.product a {
	text-decoration: none;
	color: inherit;
}

.wcpf-results .wcpf-product-grid li.product img {
	width: 100% !important;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: calc(var(--wcpf-radius) - 3px);
	background: #f5f5f5;
	display: block;
	margin-bottom: 6px;
}

.wcpf-results .wcpf-product-grid li.product .woocommerce-loop-product__title {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	margin: 8px 0 4px;
	color: var(--wcpf-text);
}

.wcpf-results .wcpf-product-grid li.product .price {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 18px;
	font-weight: 700;
	color: var(--wcpf-text);
	margin: 0 0 2px;
}

.wcpf-results .wcpf-product-grid li.product .price del {
	color: var(--wcpf-muted);
	text-decoration: line-through;
	font-weight: 400;
	margin-right: 8px;
	font-size: 15px;
}

.wcpf-results .wcpf-product-grid li.product .price ins {
	color: var(--wcpf-accent);
	text-decoration: none;
}

.wcpf-results .wcpf-product-grid li.product .stock {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 12.5px;
	font-weight: 500;
	margin: 0 0 6px;
	color: #2e7d32;
}

.wcpf-results .wcpf-product-grid li.product .stock.out-of-stock {
	color: #c62828;
}

.wcpf-results .wcpf-product-grid li.product .button,
.wcpf-results .wcpf-product-grid li.product .add_to_cart_button,
.wcpf-results .wcpf-product-grid li.product a.button {
	all: unset;
	box-sizing: border-box;
	display: block;
	width: 100%;
	text-align: center;
	background: var(--wcpf-accent) !important;
	color: #fff !important;
	padding: 12px !important;
	border-radius: calc(var(--wcpf-radius) - 3px) !important;
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: .04em;
	text-transform: uppercase;
	cursor: pointer;
	margin-top: 8px;
	transition: opacity .15s ease;
}

.wcpf-results .wcpf-product-grid li.product .button:hover,
.wcpf-results .wcpf-product-grid li.product .add_to_cart_button:hover {
	opacity: .85;
}

.wcpf-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
}

.wcpf-wrapper .wcpf-pagination button {
	all: unset;
	box-sizing: border-box;
	padding: 7px 13px;
	border: 1px solid var(--wcpf-border);
	background: #fff;
	color: var(--wcpf-text);
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
	font-family: inherit;
}

.wcpf-wrapper .wcpf-pagination button.is-active {
	background: var(--wcpf-accent);
	color: #fff;
	border-color: var(--wcpf-accent);
}

@media (max-width: 782px) {
	.wcpf-wrapper {
		flex-direction: column;
		gap: 0;
	}
	.wcpf-filters {
		max-width: 100%;
		flex-basis: 100%;
		border-right: none;
		border-bottom: 1px solid var(--wcpf-border);
		padding-right: 0;
		padding-bottom: 24px;
	}
	.wcpf-results {
		padding-left: 0;
		padding-top: 24px;
	}
}
