/* ABC Filter Boss — scoped under .abc-fb to avoid leaking into theme/plugin styles */

.abc-fb {
	--abc-fb-accent: #0b2788;
	--abc-fb-accent-contrast: #fff;
	--abc-fb-border: #e0e0e0;
	--abc-fb-text: #2c2c2c;
	--abc-fb-text-muted: #767676;
	--abc-fb-track: #e0e0e0;
	--abc-fb-surface: #fff;
	--abc-fb-radius: 6px;
	font-family: inherit;
	color: var(--abc-fb-text);
	font-size: 15px;
	box-sizing: border-box;
}

.abc-fb *,
.abc-fb *::before,
.abc-fb *::after {
	box-sizing: inherit;
}

.abc-fb__form {
	position: relative;
}

.abc-fb__group {
	margin: 0 0 2em;
	padding-bottom: 2em;
	border-bottom: 1px solid var(--abc-fb-border);
}

.abc-fb__group:last-of-type {
	border-bottom: none;
	padding-bottom: 0;
}

.abc-fb__group-title {
	margin: 0 0 1em;
	font-size: 0.85em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--abc-fb-text-muted);
}

/*
 * Dropdown display style: a native <details>/<summary> pair, so open/close
 * works with zero JavaScript (keyboard, screen readers, and no-JS visitors
 * all get a fully working control for free from the browser). JS only
 * layers on top for click-outside-to-close and the "(N selected)" label.
 */
.abc-fb__dropdown {
	position: relative;
}

.abc-fb__dropdown-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6em;
	width: 100%;
	padding: 0.8em 1em;
	background: var(--abc-fb-surface);
	border: 1px solid var(--abc-fb-border);
	border-radius: var(--abc-fb-radius);
	cursor: pointer;
	list-style: none;
	user-select: none;
	transition: border-color 0.15s ease;
}

.abc-fb__dropdown-trigger:hover {
	border-color: var(--abc-fb-accent);
}

.abc-fb__dropdown-trigger::-webkit-details-marker {
	display: none;
}

.abc-fb__dropdown-trigger-label {
	color: var(--abc-fb-text);
	font-size: 0.95em;
}

.abc-fb__dropdown-trigger::after {
	content: "";
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-right: 1.5px solid var(--abc-fb-text-muted);
	border-bottom: 1.5px solid var(--abc-fb-text-muted);
	transform: rotate(45deg);
	transition: transform 0.15s ease;
	margin-top: -4px;
}

.abc-fb__dropdown[open] > .abc-fb__dropdown-trigger::after {
	transform: rotate(-135deg);
	margin-top: 4px;
}

.abc-fb__dropdown[open] > .abc-fb__dropdown-trigger {
	border-color: var(--abc-fb-accent);
}

.abc-fb__dropdown-panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 20;
	padding: 0.9em;
	background: var(--abc-fb-surface);
	border: 1px solid var(--abc-fb-border);
	border-radius: var(--abc-fb-radius);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	max-height: 320px;
	overflow-y: auto;
}

/* Inside a dropdown panel the collapse-clamp/search-box top margin is redundant. */
.abc-fb__dropdown-panel .abc-fb__search {
	margin-top: 0;
}

/* Search box for long lists */
.abc-fb__search {
	display: block;
	width: 100%;
	margin: 0 0 0.7em;
	padding: 0.5em 0.75em;
	font-size: 0.95em;
	line-height: 1.3;
	color: var(--abc-fb-text);
	background: var(--abc-fb-surface);
	border: 1px solid var(--abc-fb-border);
	border-radius: var(--abc-fb-radius);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.abc-fb__search:focus {
	outline: none;
	border-color: var(--abc-fb-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--abc-fb-accent) 18%, transparent);
}

.abc-fb__no-match {
	margin: 0.5em 0 0;
	font-size: 0.88em;
	color: var(--abc-fb-text-muted);
	font-style: italic;
}

/* Collapsible list wrapper */
.abc-fb__list-wrap {
	overflow: hidden;
	max-height: var(--abc-fb-collapsed-height, none);
	transition: max-height 0.25s ease;
}

.abc-fb__list-wrap.is-expanded,
.abc-fb__list-wrap.is-searching {
	max-height: none !important;
}

.abc-fb__show-more {
	display: inline-block;
	margin-top: 0.6em;
	padding: 0;
	background: none;
	border: none;
	font-size: 0.85em;
	font-weight: 600;
	color: var(--abc-fb-accent);
	cursor: pointer;
}

.abc-fb__show-more:hover {
	text-decoration: underline;
}

.abc-fb__list,
.abc-fb__list--nested {
	list-style: none;
	margin: 0;
	padding: 0;
}

.abc-fb__list--nested {
	margin-left: 1.35em;
	margin-top: 0.35em;
}

.abc-fb__item {
	margin: 0 0 0.55em;
}

.abc-fb__item--search-hidden {
	display: none;
}

.abc-fb__item label {
	display: flex;
	align-items: center;
	gap: 0.6em;
	cursor: pointer;
	font-size: 0.95em;
	line-height: 1.3;
	position: relative;
}

/*
 * Custom checkbox: the real <input> is made invisible (not display:none —
 * it stays focusable/clickable/keyboard-accessible) and a sibling <span>
 * carries 100% of the visual styling. This is deliberate: styling the
 * native input directly (appearance:none + colors) is fragile — any other
 * site-wide `input[type="checkbox"]` rule from the theme or another plugin
 * can win the cascade and override it. A plain <span> with a plugin-unique
 * class name can't collide with anything else on the page.
 */
.abc-fb__checkbox-input {
	position: absolute;
	inset: 0;
	width: 17px;
	height: 17px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.abc-fb__checkbox-box {
	flex: 0 0 auto;
	width: 17px;
	height: 17px;
	border: 1.5px solid var(--abc-fb-border);
	border-radius: 4px;
	background: var(--abc-fb-surface);
	position: relative;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.abc-fb__checkbox-input:hover + .abc-fb__checkbox-box {
	border-color: var(--abc-fb-accent);
}

.abc-fb__checkbox-input:checked + .abc-fb__checkbox-box {
	background: var(--abc-fb-accent);
	border-color: var(--abc-fb-accent);
}

.abc-fb__checkbox-input:checked + .abc-fb__checkbox-box::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 9px;
	border: solid var(--abc-fb-accent-contrast);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.abc-fb__checkbox-input:focus-visible + .abc-fb__checkbox-box {
	outline: 2px solid var(--abc-fb-accent);
	outline-offset: 2px;
}

.abc-fb__checkbox-input:disabled + .abc-fb__checkbox-box {
	cursor: not-allowed;
	opacity: 0.5;
}

.abc-fb__checkbox-input:disabled {
	cursor: not-allowed;
}

.abc-fb__label {
	flex: 1 1 auto;
	color: var(--abc-fb-text);
}

.abc-fb__item--empty .abc-fb__label {
	color: var(--abc-fb-text-muted);
}

.abc-fb__item--empty .abc-fb__count {
	opacity: 0.6;
}

/* Count pill */
.abc-fb__count {
	flex: 0 0 auto;
	min-width: 1.6em;
	padding: 0.1em 0.5em;
	font-size: 0.78em;
	font-weight: 600;
	text-align: center;
	color: var(--abc-fb-text-muted);
	background: color-mix(in srgb, var(--abc-fb-text-muted) 10%, transparent);
	border-radius: 999px;
}

.abc-fb__checkbox-input:checked ~ .abc-fb__count {
	color: var(--abc-fb-accent-contrast);
	background: var(--abc-fb-accent);
}

/* Price: flat (no variance) */
.abc-fb__price-flat {
	margin: 0;
	font-size: 0.95em;
	color: var(--abc-fb-text-muted);
}

/*
 * Price range slider. The two native <input type="range"> elements are kept
 * for keyboard operation and screen readers, but rendered fully invisible —
 * two custom <span> "thumbs", positioned and dragged entirely by our own JS
 * (pointer events), carry 100% of the visuals. This deliberately avoids
 * styling native range/thumb pseudo-elements at all: that technique is
 * known to render inconsistently across browsers when two range inputs are
 * layered on one track (confirmed on this project — the exact same CSS
 * produced a correctly styled thumb in one browser and broken native
 * chrome in another). A plain, fully custom element can't do that.
 */
.abc-fb__price-slider {
	position: relative;
	height: 1.6em;
	margin: 0.3em 9px 0;
	--abc-fb-min-percent: 0%;
	--abc-fb-max-percent: 100%;
}

.abc-fb__track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 3px;
	transform: translateY(-50%);
	background: var(--abc-fb-track);
	border-radius: 2px;
	pointer-events: none;
}

.abc-fb__track::after {
	content: "";
	position: absolute;
	top: 0;
	height: 100%;
	left: var(--abc-fb-min-percent);
	right: calc(100% - var(--abc-fb-max-percent));
	background: var(--abc-fb-accent);
	border-radius: 2px;
}

.abc-fb__range {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.abc-fb__thumb {
	position: absolute;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-left: -9px;
	transform: translateY(-50%);
	border-radius: 50%;
	background: var(--abc-fb-surface);
	border: 2.5px solid var(--abc-fb-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	cursor: pointer;
	touch-action: none;
	z-index: 2;
	transition: transform 0.1s ease;
}

.abc-fb__thumb--min {
	left: var(--abc-fb-min-percent);
}

.abc-fb__thumb--max {
	left: var(--abc-fb-max-percent);
}

.abc-fb__thumb:hover {
	transform: translateY(-50%) scale(1.15);
}

.abc-fb__thumb--dragging {
	z-index: 3;
	transform: translateY(-50%) scale(1.15);
}

.abc-fb__range--min:focus-visible ~ .abc-fb__thumb--min,
.abc-fb__range--max:focus-visible ~ .abc-fb__thumb--max {
	outline: 2px solid var(--abc-fb-accent);
	outline-offset: 2px;
}

.abc-fb__price-values {
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin-top: 0.85em;
	font-size: 0.9em;
	color: var(--abc-fb-text-muted);
}

.abc-fb__price-values .woocommerce-Price-amount {
	color: var(--abc-fb-text);
	font-weight: 600;
}

/* Actions */
.abc-fb__actions {
	display: flex;
	align-items: center;
	gap: 1.25em;
	margin-top: 0.5em;
}

.abc-fb__apply {
	display: inline-flex;
	align-items: center;
	padding: 0.65em 1.4em !important;
	font-size: 0.85em !important;
	font-weight: 600;
	background: var(--abc-fb-accent) !important;
	color: var(--abc-fb-accent-contrast) !important;
	border: none !important;
	border-radius: 999px !important;
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.abc-fb__apply:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 10px color-mix(in srgb, var(--abc-fb-accent) 35%, transparent);
	opacity: 0.95;
}

.abc-fb__clear {
	background: none !important;
	border: none !important;
	padding: 0 !important;
	min-width: 0 !important;
	width: auto !important;
	height: auto !important;
	color: var(--abc-fb-text-muted) !important;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
	font-size: 0.85em !important;
	line-height: normal !important;
	transition: color 0.12s ease;
}

.abc-fb__clear:hover {
	color: var(--abc-fb-accent);
}

.abc-fb__spinner {
	display: none;
	width: 1em;
	height: 1em;
	margin-left: auto;
	border: 2px solid var(--abc-fb-border);
	border-top-color: var(--abc-fb-accent);
	border-radius: 50%;
	animation: abc-fb-spin 0.6s linear infinite;
}

.abc-fb--loading .abc-fb__spinner {
	display: inline-block;
}

.abc-fb--loading .abc-fb__form {
	opacity: 0.6;
	pointer-events: none;
}

@keyframes abc-fb-spin {
	to {
		transform: rotate(360deg);
	}
}

/*
 * Mobile filter drawer. On a narrow viewport, a sidebar column typically
 * stacks below all the products rather than being useful — so instead the
 * panel becomes an off-canvas drawer, opened via a "Filter" bar injected
 * above the product grid. Desktop layout is completely untouched: none of
 * this applies outside the media query below.
 */
/*
 * !important throughout: this button is injected outside the panel, into
 * whatever wrapper sits above the product grid — a context where the
 * theme's own generic `button` element styling reliably wins on specificity
 * otherwise (confirmed: the in-panel "Apply Filters" button needed the same
 * treatment for the same reason).
 */
.abc-fb__mobile-trigger {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	width: auto !important;
	margin: 0 0 1.25em !important;
	padding: 0.6em 1.1em !important;
	background: var(--abc-fb-surface) !important;
	border: 1px solid var(--abc-fb-border) !important;
	border-radius: var(--abc-fb-radius) !important;
	color: var(--abc-fb-text) !important;
	font-size: 0.9em !important;
	font-weight: 600 !important;
	font-family: inherit !important;
	line-height: normal !important;
	cursor: pointer;
}

.abc-fb__mobile-trigger:hover {
	border-color: var(--abc-fb-accent) !important;
}

.abc-fb__mobile-trigger-icon {
	display: inline-flex;
	flex-direction: column;
	gap: 3px;
	width: 16px;
}

.abc-fb__mobile-trigger-icon span {
	display: block;
	height: 2px;
	border-radius: 1px;
	background: var(--abc-fb-accent);
}

.abc-fb__mobile-trigger-icon span:nth-child(1) {
	width: 100%;
}

.abc-fb__mobile-trigger-icon span:nth-child(2) {
	width: 65%;
}

.abc-fb__mobile-trigger-icon span:nth-child(3) {
	width: 35%;
}

.abc-fb__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 99998;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.abc-fb__backdrop--visible {
	opacity: 1;
	pointer-events: auto;
}

.abc-fb__drawer-close {
	display: none;
	position: absolute;
	top: 1em;
	right: 1em;
	width: 32px;
	height: 32px;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	border-radius: 50%;
	color: var(--abc-fb-text);
	font-size: 1.4em;
	line-height: 1;
	cursor: pointer;
}

.abc-fb__drawer-close:hover {
	background: color-mix( in srgb, var(--abc-fb-text) 8%, transparent );
}

@media (max-width: 782px) {
	.abc-fb__mobile-trigger {
		display: flex;
	}

	/* :not(...) matters here — the trigger button below also carries the
	   base .abc-fb class (for its color variables) and must never pick up
	   this off-canvas positioning meant for the actual drawer panel. */
	.abc-fb:not(.abc-fb__mobile-trigger) {
		position: fixed;
		/* --abc-fb-header-offset is measured and set by JS from the real
		   site header height (+ WP admin bar, if present) — never assume a
		   fixed pixel value, themes' header height varies by configuration. */
		top: var(--abc-fb-header-offset, 0px);
		right: 0;
		bottom: 0;
		width: min(88vw, 380px);
		z-index: 99999;
		padding: 1.5em 1.25em;
		background: var(--abc-fb-surface);
		transform: translateX(100%);
		transition: transform 0.25s ease;
		box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
		display: flex;
		flex-direction: column;
	}

	.abc-fb:not(.abc-fb__mobile-trigger) .abc-fb__form {
		display: flex;
		flex-direction: column;
		flex: 1 1 auto;
		min-height: 0;
	}

	/* Wraps everything except the action bar so it can scroll independently
	   while Apply/Clear stay pinned in view. */
	.abc-fb:not(.abc-fb__mobile-trigger) .abc-fb__scroll-area {
		flex: 1 1 auto;
		overflow-y: auto;
		min-height: 0;
	}

	.abc-fb:not(.abc-fb__mobile-trigger) .abc-fb__actions {
		flex: 0 0 auto;
		margin: 1em -1.25em -1.5em;
		padding: 1em 1.25em 1.5em;
		background: var(--abc-fb-surface);
		border-top: 1px solid var(--abc-fb-border);
	}

	/*
	 * Must match (or beat) the specificity of the closed-state rule above —
	 * :not(.abc-fb__mobile-trigger) counts as two class selectors, so a
	 * plain single-class .abc-fb--drawer-open rule loses the cascade fight
	 * even with the class correctly applied (confirmed live: computed
	 * transform stayed at the closed matrix() despite the class being set).
	 */
	.abc-fb.abc-fb--drawer-open {
		transform: translateX(0) !important;
	}

	.abc-fb__drawer-close {
		display: flex;
	}

	/* Redundant in the drawer: the trigger button and close icon already
	   make it obvious what this panel is, so the widget title is dropped.
	   The title markup is a sibling of .abc-fb (both live inside the
	   widget's <section>), not a descendant, hence the wrapper selector. */
	.widget_abc_filter_boss .widget-title {
		display: none;
	}

	.abc-fb__form {
		margin-top: 2.5em;
	}
}
