/* SarvTheme product-filter.css — built from modules. Edit modules + run npm run build */

/* --- product-filter.css --- */
/**
 * Product Filter — theme-token styles (match sidebar widgets, pagination, buttons).
 */

.st-product-filter {
	--st-pf-primary: var(
		--st-widget-primary,
		var(--sarv-color-primary, var(--st-color-primary, #0d6efd))
	);
	--st-pf-text: var(--st-widget-text, var(--sarv-color-text, var(--st-text, #1a1a1a)));
	--st-pf-muted-text: var(--st-widget-muted, var(--sarv-color-text-muted, #6b7280));
	--st-pf-border: var(--st-widget-border, var(--sarv-color-border, var(--st-border, #e5e7eb)));
	--st-pf-surface: var(--st-widget-bg, var(--sarv-color-bg, var(--st-surface, #fff)));
	--st-pf-muted: var(--sarv-color-bg-muted, var(--st-surface, #f8f9fa));
	--st-pf-danger: var(--sarv-color-danger, #ef4444);
	--st-pf-radius: var(--st-widget-radius, var(--sarv-radius-md, var(--st-radius-md, 12px)));
	--st-pf-radius-sm: var(--sarv-radius-sm, 8px);
	--st-pf-shadow: var(--st-widget-shadow, var(--sarv-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.06)));
	--st-pf-transition: var(--st-transition, 0.2s ease);
	--st-pf-pad-x: var(--st-widget-pad-x, 1.15rem);
	--st-pf-pad-y: var(--st-widget-pad-y, 1rem);
	--st-pf-focus: var(--st-focus-ring, 0 0 0 3px color-mix(in srgb, var(--st-pf-primary) 25%, transparent));

	display: flex;
	flex-direction: column;
	background: var(--st-pf-surface);
	border: 1px solid var(--st-pf-border);
	border-radius: var(--st-pf-radius);
	box-shadow: var(--st-pf-shadow);
	overflow: hidden;
	color: var(--st-pf-text);
	font-size: 0.925rem;
	line-height: 1.45;
}

/* Sidebar widget already provides card chrome + title */
.st-sidebar .st-product-filter-widget > .st-product-filter,
.st-sidebar .widget.st-product-filter-widget > *:not(.widget-title) {
	padding: 0;
}

.st-sidebar .st-product-filter-widget .st-product-filter {
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
}

.st-sidebar .st-product-filter-widget .st-product-filter__head {
	display: none;
}

/* Offcanvas has its own header */
.st-product-filter-offcanvas .st-product-filter__head {
	display: none;
}

.st-product-filter__head {
	padding: var(--st-pf-pad-y) var(--st-pf-pad-x);
	background: var(--st-pf-muted);
	border-bottom: 1px solid var(--st-pf-border);
}

.st-product-filter__heading {
	display: block;
	font-size: 0.98rem;
	font-weight: 700;
	line-height: 1.4;
	color: var(--st-pf-text);
}

.st-product-filter__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem var(--st-pf-pad-x);
	border-bottom: 1px solid var(--st-pf-border);
}

.st-product-filter__row-label {
	font-size: 0.925rem;
	font-weight: 600;
	color: var(--st-pf-text);
}

/* Toggle switch — uses primary (theme brand) */
.st-product-filter__switch {
	position: relative;
	display: inline-flex;
	cursor: pointer;
	flex-shrink: 0;
}

.st-product-filter__switch input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.st-product-filter__switch-ui {
	width: 44px;
	height: 24px;
	border-radius: var(--st-radius-pill, 999px);
	background: color-mix(in srgb, var(--st-pf-border) 70%, var(--st-pf-muted-text));
	position: relative;
	transition: background var(--st-pf-transition);
}

.st-product-filter__switch-ui::after {
	content: "";
	position: absolute;
	top: 2px;
	inset-inline-start: 2px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	transition: transform var(--st-pf-transition);
}

.st-product-filter__switch input:checked + .st-product-filter__switch-ui {
	background: var(--st-pf-primary);
}

.st-product-filter__switch input:checked + .st-product-filter__switch-ui::after {
	transform: translateX(20px);
}

.st-product-filter__switch input:focus-visible + .st-product-filter__switch-ui {
	box-shadow: var(--st-pf-focus);
}

[dir="rtl"] .st-product-filter__switch input:checked + .st-product-filter__switch-ui::after,
body.rtl .st-product-filter__switch input:checked + .st-product-filter__switch-ui::after {
	transform: translateX(-20px);
}

/* Accordion groups */
.st-product-filter__group {
	border-bottom: 1px solid var(--st-pf-border);
	margin: 0;
	padding: 0;
	background: transparent;
	border-radius: 0;
	border-inline: 0;
	border-top: 0;
}

.st-product-filter__title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.9rem var(--st-pf-pad-x);
	font-weight: 700;
	font-size: 0.925rem;
	color: var(--st-pf-text);
	cursor: pointer;
	list-style: none;
	user-select: none;
	transition: color var(--st-pf-transition);
}

.st-product-filter__title:hover {
	color: var(--st-pf-primary);
}

.st-product-filter__title::-webkit-details-marker {
	display: none;
}

.st-product-filter__title::after {
	content: "";
	width: 0.5rem;
	height: 0.5rem;
	border-inline-end: 2px solid var(--st-pf-muted-text);
	border-bottom: 2px solid var(--st-pf-muted-text);
	transform: rotate(45deg);
	transition: transform var(--st-pf-transition), border-color var(--st-pf-transition);
	flex-shrink: 0;
	margin-top: -0.2rem;
}

.st-product-filter__group[open] > .st-product-filter__title::after {
	transform: rotate(225deg);
	margin-top: 0.15rem;
	border-color: var(--st-pf-primary);
}

.st-product-filter__body {
	padding: 0 var(--st-pf-pad-x) var(--st-pf-pad-y);
}

.st-product-filter__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	max-height: 220px;
	overflow: auto;
}

.st-product-filter__check {
	display: flex;
	width: 100%;
	align-items: center;
	gap: 10px;
	padding: 0.45rem 0.55rem;
	border-radius: var(--st-pf-radius-sm);
	font-size: 0.9rem;
	cursor: pointer;
	user-select: none;
	color: var(--st-pf-text);
	transition: background-color 0.15s ease;
}

.st-product-filter__check:hover {
	background: var(--st-pf-muted);
}

/* Branded checkbox (same pattern as admin st-check) */
.st-product-filter .st-check__input,
.st-product-filter .st-radio__input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.st-product-filter .st-check__box {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	border: 2px solid color-mix(in srgb, var(--st-pf-border) 55%, var(--st-pf-muted-text));
	border-radius: 6px;
	background: var(--st-pf-surface);
	transition:
		border-color var(--st-pf-transition),
		background-color var(--st-pf-transition),
		box-shadow var(--st-pf-transition);
}

.st-product-filter .st-check__icon {
	width: 12px;
	height: 12px;
	fill: #fff;
	opacity: 0;
	transform: scale(0.6);
	transition:
		opacity 0.15s ease,
		transform 0.15s ease;
}

.st-product-filter .st-check__input:checked + .st-check__box {
	background: var(--st-pf-primary);
	border-color: var(--st-pf-primary);
}

.st-product-filter .st-check__input:checked + .st-check__box .st-check__icon {
	opacity: 1;
	transform: scale(1);
}

.st-product-filter .st-check:hover .st-check__box {
	border-color: color-mix(in srgb, var(--st-pf-primary) 55%, var(--st-pf-border));
}

.st-product-filter .st-check__input:focus-visible + .st-check__box {
	box-shadow: var(--st-pf-focus);
}

.st-product-filter .st-check__text,
.st-product-filter .st-radio__text {
	font-size: 0.9rem;
	color: inherit;
	line-height: 1.4;
}

/* Branded radio (rating) */
.st-product-filter .st-radio__dot {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	border: 2px solid color-mix(in srgb, var(--st-pf-border) 55%, var(--st-pf-muted-text));
	border-radius: 50%;
	background: var(--st-pf-surface);
	position: relative;
	transition:
		border-color var(--st-pf-transition),
		box-shadow var(--st-pf-transition);
}

.st-product-filter .st-radio__dot::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	background: var(--st-pf-primary);
	transform: scale(0);
	transition: transform 0.15s ease;
}

.st-product-filter .st-radio__input:checked + .st-radio__dot {
	border-color: var(--st-pf-primary);
}

.st-product-filter .st-radio__input:checked + .st-radio__dot::after {
	transform: scale(1);
}

.st-product-filter .st-radio:hover .st-radio__dot {
	border-color: color-mix(in srgb, var(--st-pf-primary) 55%, var(--st-pf-border));
}

.st-product-filter .st-radio__input:focus-visible + .st-radio__dot {
	box-shadow: var(--st-pf-focus);
}

.st-product-filter__count {
	margin-inline-start: auto;
	opacity: 0.55;
	font-style: normal;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--st-pf-muted-text);
}

/* Color swatches */
.st-product-filter__swatches {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.55rem;
}

.st-product-filter__swatch {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.st-product-filter__swatch input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.st-product-filter__swatch-dot {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--st-swatch, #d1d5db);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-pf-border) 80%, #000);
	display: block;
	transition: box-shadow var(--st-pf-transition);
}

.st-product-filter__swatch.is-dual .st-product-filter__swatch-dot {
	background: linear-gradient(
		135deg,
		var(--st-swatch) 50%,
		var(--st-swatch-2, var(--st-swatch)) 50%
	);
}

.st-product-filter__swatch.is-empty .st-product-filter__swatch-dot {
	background:
		linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
		linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
	background-size: 8px 8px;
	background-position: 0 0, 0 4px, 4px -4px, -4px 0;
	background-color: #f3f4f6;
}

.st-product-filter__swatch.is-light .st-product-filter__swatch-dot {
	box-shadow: inset 0 0 0 1px var(--st-pf-border);
}

.st-product-filter__swatch.is-active .st-product-filter__swatch-dot,
.st-product-filter__swatch:has(input:checked) .st-product-filter__swatch-dot {
	box-shadow:
		0 0 0 2px var(--st-pf-surface),
		0 0 0 4px var(--st-pf-primary);
}

.st-product-filter__swatch:has(input:focus-visible) .st-product-filter__swatch-dot {
	box-shadow: var(--st-pf-focus);
}

/* Pills */
.st-product-filter__pills {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
}

.st-product-filter__pill {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.st-product-filter__pill input {
	position: absolute;
	opacity: 0;
	inset: 0;
	margin: 0;
	cursor: pointer;
}

.st-product-filter__pill span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 0.35rem 0.75rem;
	border: 1px solid var(--st-pf-border);
	border-radius: var(--st-pf-radius-sm);
	background: var(--st-pf-surface);
	color: var(--st-pf-text);
	font-size: 0.82rem;
	transition:
		border-color var(--st-pf-transition),
		color var(--st-pf-transition),
		background-color var(--st-pf-transition);
}

.st-product-filter__pill:hover span {
	border-color: color-mix(in srgb, var(--st-pf-primary) 45%, var(--st-pf-border));
}

.st-product-filter__pill.is-active span,
.st-product-filter__pill:has(input:checked) span {
	border-color: var(--st-pf-primary);
	color: var(--st-pf-primary);
	background: color-mix(in srgb, var(--st-pf-primary) 9%, white);
	font-weight: 600;
}

.st-product-filter__pill:has(input:focus-visible) span {
	box-shadow: var(--st-pf-focus);
}

/* Price */
.st-product-filter__price {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.st-product-filter__price-inputs {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.st-product-filter__price-inputs input[type="number"] {
	width: 100%;
	min-width: 0;
	min-height: 40px;
	height: auto;
	border: 1px solid var(--st-pf-border);
	border-radius: var(--st-pf-radius-sm);
	padding: 0.4rem 0.65rem;
	font-size: 0.85rem;
	background: var(--st-pf-surface);
	color: var(--st-pf-text);
}

.st-product-filter__price-inputs input[type="number"]:focus {
	outline: none;
	border-color: var(--st-pf-primary);
	box-shadow: var(--st-pf-focus);
}

.st-product-filter__price-sep {
	color: var(--st-pf-muted-text);
}

.st-product-filter__price-ranges {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.st-product-filter__price-ranges input[type="range"] {
	width: 100%;
	accent-color: var(--st-pf-primary);
}

/* Active filters */
.st-product-filter__active {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--st-pf-border);
	padding-block: 0.35rem 0.5rem;
}

.st-product-filter__active[hidden] {
	display: none;
}

.st-product-filter__active-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem var(--st-pf-pad-x);
	background: color-mix(in srgb, var(--st-pf-primary) 8%, white);
}

.st-product-filter__active-title {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--st-pf-text);
}

.st-product-filter button.st-product-filter__active-reset {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	min-height: 0;
	min-width: 0;
	border: 0;
	background: transparent;
	color: var(--st-pf-muted-text);
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
	box-shadow: none;
	font-size: inherit;
	line-height: 1;
	gap: 0;
}

.st-product-filter button.st-product-filter__active-reset:hover,
.st-product-filter button.st-product-filter__active-reset:focus-visible,
.st-product-filter button.st-product-filter__active-reset:active {
	background: color-mix(in srgb, var(--st-pf-primary) 12%, white);
	color: var(--st-pf-primary);
	transform: none;
	box-shadow: none;
}

.st-product-filter__chips {
	list-style: none;
	margin: 0;
	padding: 1rem var(--st-pf-pad-x) 0.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

/* Badge (not a theme button) */
.st-product-filter__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	max-width: 100%;
	padding: 0.28rem 0.3rem 0.28rem 0.65rem;
	border: 1px solid color-mix(in srgb, var(--st-pf-primary) 28%, var(--st-pf-border));
	border-radius: var(--st-radius-pill, 999px);
	background: color-mix(in srgb, var(--st-pf-primary) 10%, white);
	color: var(--st-pf-primary);
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
}

.st-product-filter__chip-label {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.st-product-filter button.st-product-filter__chip-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	min-height: 0;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--st-pf-primary) 18%, white);
	color: var(--st-pf-primary);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
	gap: 0;
	flex-shrink: 0;
}

.st-product-filter button.st-product-filter__chip-remove:hover,
.st-product-filter button.st-product-filter__chip-remove:focus-visible,
.st-product-filter button.st-product-filter__chip-remove:active {
	background: var(--st-pf-primary);
	color: #fff;
	transform: none;
	box-shadow: none;
}

.st-product-filter button.st-product-filter__clear {
	display: flex;
	align-items: center;
	justify-content: center;
	width: calc(100% - (var(--st-pf-pad-x) * 2));
	margin: 0.85rem var(--st-pf-pad-x) 1.15rem;
	min-height: 42px;
	border: 1px solid var(--st-pf-border);
	border-radius: var(--st-pf-radius-sm);
	background: var(--st-pf-surface);
	color: var(--st-pf-danger);
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	padding: 0.5rem 0.75rem;
	align-self: stretch;
	box-shadow: none;
	gap: 0;
}

.st-product-filter button.st-product-filter__clear:hover,
.st-product-filter button.st-product-filter__clear:focus-visible,
.st-product-filter button.st-product-filter__clear:active {
	background: color-mix(in srgb, var(--st-pf-danger) 8%, white);
	border-color: color-mix(in srgb, var(--st-pf-danger) 35%, var(--st-pf-border));
	color: var(--st-pf-danger);
	transform: none;
	box-shadow: none;
}

.st-product-filter__mobile-btn {
	display: none;
	margin-bottom: 0.75rem;
	border: 1px solid var(--st-pf-border);
	background: var(--st-pf-surface);
	border-radius: var(--st-pf-radius);
	padding: 0.55rem 0.9rem;
	font-weight: 600;
	color: var(--st-pf-text);
	box-shadow: var(--st-pf-shadow);
	min-height: var(--st-control-height, 44px);
}

.st-product-filter__mobile-btn:hover {
	border-color: var(--st-pf-primary);
	color: var(--st-pf-primary);
	background: color-mix(in srgb, var(--st-pf-primary) 8%, white);
	transform: none;
	box-shadow: var(--st-pf-shadow);
}

.st-product-filter-above {
	margin-bottom: 1rem;
}

.st-product-filter-above .st-product-filter {
	max-width: 100%;
}

.st-product-filter--loading {
	opacity: 0.65;
	pointer-events: none;
	transition: opacity var(--st-pf-transition);
}

.st-product-filter-offcanvas .offcanvas-body {
	padding: 0;
}

.st-product-filter-offcanvas .st-product-filter {
	border: 0;
	border-radius: 0;
	box-shadow: none;
	min-height: 100%;
}

@media (max-width: 991.98px) {
	.st-product-filter__mobile-btn {
		display: inline-flex;
		align-items: center;
		gap: 0.4rem;
	}

	.st-shop-sidebar .st-product-filter-widget {
		display: none;
	}
}
