/* Weaxen Product Filter: frontend styles.
   Everything is driven by custom properties so themes and the Elementor
   widgets can restyle without !important. */

.wxpf-filter,
.wxpf-listing {
	--wxpf-accent: #1d4ed8;
	--wxpf-accent-contrast: #fff;
	--wxpf-text: inherit;
	--wxpf-muted: #6b7280;
	--wxpf-border: #d9dde3;
	--wxpf-radius: 6px;
	--wxpf-gap: 16px;
	--wxpf-field-bg: #fff;
	--wxpf-drawer-width: 360px;
	--wxpf-swatch-size: 28px;
	box-sizing: border-box;
}

.wxpf-filter *,
.wxpf-filter *::before,
.wxpf-filter *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------- layout */

.wxpf-filter .wxpf-components {
	display: flex;
	flex-direction: column;
	gap: var(--wxpf-gap);
}

.wxpf-filter.wxpf-sticky {
	position: sticky;
	top: var(--wxpf-sticky-top, 24px);
	align-self: flex-start;
}

.wxpf-component[hidden],
.wxpf-option[hidden] {
	display: none !important;
}

.wxpf-comp-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 0 0 8px;
	margin: 0;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--wxpf-border);
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

/* Themes style button:hover globally (Hello Elementor paints it pink), so
   every state of our own buttons is declared explicitly. */
.wxpf-comp-toggle:hover,
.wxpf-comp-toggle:focus,
.wxpf-comp-toggle:active {
	background: transparent;
	color: inherit;
	box-shadow: none;
}

.wxpf-comp-body {
	padding-top: 10px;
}

.wxpf-chevron::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s;
}

.wxpf-comp-toggle[aria-expanded="false"] .wxpf-chevron::before {
	transform: rotate(-45deg);
}

/* Orientation per device. Desktop is the default; tablet and mobile override. */
@media (min-width: 1025px) {
	.wxpf-filter.wxpf-o-d-horizontal .wxpf-components {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-start;
	}
	.wxpf-filter.wxpf-o-d-horizontal .wxpf-component {
		flex: 1 1 200px;
		min-width: 180px;
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.wxpf-filter.wxpf-o-t-horizontal .wxpf-components {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-start;
	}
	.wxpf-filter.wxpf-o-t-horizontal .wxpf-component {
		flex: 1 1 200px;
		min-width: 160px;
	}
}

@media (max-width: 767px) {
	.wxpf-filter.wxpf-o-m-horizontal .wxpf-components {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: flex-start;
	}
	.wxpf-filter.wxpf-o-m-horizontal .wxpf-component {
		flex: 1 1 140px;
		min-width: 130px;
	}
}

/* --------------------------------------------------------------- options */

.wxpf-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wxpf-options .wxpf-options {
	margin-left: 18px;
}

.wxpf-option label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 0;
	cursor: pointer;
}

.wxpf-count {
	color: var(--wxpf-muted);
	font-size: 0.875em;
}

.wxpf-select,
.wxpf-search-input,
.wxpf-num {
	width: 100%;
	padding: 8px 10px;
	background: var(--wxpf-field-bg);
	border: 1px solid var(--wxpf-border);
	border-radius: var(--wxpf-radius);
	color: inherit;
	font: inherit;
}

.wxpf-display-swatch_color,
.wxpf-display-swatch_image,
.wxpf-display-button {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.wxpf-option--swatch label,
.wxpf-option--button label {
	position: relative;
	padding: 0;
}

.wxpf-option--swatch input,
.wxpf-option--button input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.wxpf-swatch {
	display: block;
	width: var(--wxpf-swatch-size);
	height: var(--wxpf-swatch-size);
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 1px var(--wxpf-border);
	background-size: cover;
	background-position: center;
}

.wxpf-swatch--image {
	border-radius: var(--wxpf-radius);
}

.wxpf-option--swatch input:checked + .wxpf-swatch {
	box-shadow: 0 0 0 2px var(--wxpf-accent);
}

.wxpf-option--swatch input:focus-visible + .wxpf-swatch,
.wxpf-option--button input:focus-visible + .wxpf-option-label {
	outline: 2px solid var(--wxpf-accent);
	outline-offset: 2px;
}

.wxpf-option--button .wxpf-option-label {
	padding: 6px 12px;
	border: 1px solid var(--wxpf-border);
	border-radius: var(--wxpf-radius);
}

.wxpf-option--button input:checked + .wxpf-option-label {
	background: var(--wxpf-accent);
	border-color: var(--wxpf-accent);
	color: var(--wxpf-accent-contrast);
}

.wxpf-stars {
	color: #f59e0b;
	letter-spacing: 1px;
}

/* ----------------------------------------------------------------- price */

.wxpf-slider {
	position: relative;
	height: 24px;
	margin: 4px 8px 8px;
}

.wxpf-slider-track {
	position: absolute;
	top: 10px;
	left: 0;
	right: 0;
	height: 4px;
	border-radius: 2px;
	background: var(--wxpf-border);
}

.wxpf-slider-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	border-radius: 2px;
	background: var(--wxpf-accent);
}

.wxpf-range {
	position: absolute;
	left: -8px;
	top: 0;
	width: calc(100% + 16px);
	height: 24px;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}

.wxpf-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 18px;
	height: 18px;
	border: 2px solid var(--wxpf-accent);
	border-radius: 50%;
	background: #fff;
	cursor: grab;
}

.wxpf-range::-moz-range-thumb {
	pointer-events: auto;
	width: 14px;
	height: 14px;
	border: 2px solid var(--wxpf-accent);
	border-radius: 50%;
	background: #fff;
	cursor: grab;
}

.wxpf-range::-webkit-slider-runnable-track,
.wxpf-range::-moz-range-track {
	background: transparent;
}

.wxpf-price-inputs {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wxpf-price-inputs[hidden] {
	display: none;
}

.wxpf-price-text {
	margin-top: 6px;
	color: var(--wxpf-muted);
	font-size: 0.875em;
}

/* --------------------------------------------------------- buttons, chips */

.wxpf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 16px;
	border: 1px solid var(--wxpf-border);
	border-radius: var(--wxpf-radius);
	background: var(--wxpf-field-bg);
	color: inherit;
	font: inherit;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.wxpf-btn--primary {
	background: var(--wxpf-accent);
	border-color: var(--wxpf-accent);
	color: var(--wxpf-accent-contrast);
}

.wxpf-btn:hover,
.wxpf-btn:focus {
	background: var(--wxpf-field-bg);
	color: inherit;
	border-color: var(--wxpf-border);
}

.wxpf-btn--primary:hover,
.wxpf-btn--primary:focus {
	background: var(--wxpf-accent);
	border-color: var(--wxpf-accent);
	color: var(--wxpf-accent-contrast);
	filter: brightness(0.92);
}

.wxpf-btn--ghost:hover,
.wxpf-btn--ghost:focus {
	background: transparent;
}

.wxpf-btn--primary.is-dirty {
	box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
}

.wxpf-btn--ghost {
	background: transparent;
}

/* In instant mode Apply only belongs to the drawer view. */
.wxpf-apply--drawer-only { display: none; }

.wxpf-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: var(--wxpf-gap);
}

.wxpf-debug {
	font-size: 12px;
	opacity: 0.7;
	border-top: 1px dashed currentColor;
	padding-top: 8px;
}

.wxpf-active {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: var(--wxpf-gap);
}

.wxpf-active[hidden] {
	display: none;
}

.wxpf-chip {
	padding: 4px 10px;
	border: 1px solid var(--wxpf-border);
	border-radius: 999px;
	background: var(--wxpf-field-bg);
	color: inherit;
	font: inherit;
	font-size: 0.875em;
	cursor: pointer;
}

.wxpf-chip:hover {
	background: var(--wxpf-field-bg);
	color: inherit;
	border-color: var(--wxpf-accent);
}

.wxpf-btn:focus-visible,
.wxpf-chip:focus-visible,
.wxpf-comp-toggle:focus-visible,
.wxpf-select:focus-visible,
.wxpf-search-input:focus-visible,
.wxpf-num:focus-visible {
	outline: 2px solid var(--wxpf-accent);
	outline-offset: 2px;
}

.wxpf-filter.wxpf-busy .wxpf-components {
	opacity: 0.7;
}

/* ---------------------------------------------------------------- drawer */

.wxpf-toggle,
.wxpf-close,
.wxpf-panel-head {
	display: none;
}

.wxpf-overlay {
	display: none;
}

/* Off-canvas drawer: applies per device when its class is present. */
@media (min-width: 1025px) {
	.wxpf-filter.wxpf-drawer-d .wxpf-toggle { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-d .wxpf-apply--drawer-only { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-d .wxpf-panel-head { display: flex; }
	.wxpf-filter.wxpf-drawer-d .wxpf-close { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-d .wxpf-panel {
		position: fixed;
		z-index: 100001;
		top: 0;
		bottom: 0;
		left: 0;
		width: min(var(--wxpf-drawer-width), 92vw);
		padding: 16px;
		overflow-y: auto;
		background: #fff;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
		transform: translateX(-102%);
		transition: transform 0.25s ease;
		visibility: hidden;
	}
	.wxpf-filter.wxpf-drawer-d.wxpf-open .wxpf-panel { transform: none; visibility: visible; }
	.wxpf-filter.wxpf-drawer-d .wxpf-overlay:not([hidden]) {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(0, 0, 0, 0.45);
	}
}

@media (min-width: 768px) and (max-width: 1024px) {
	.wxpf-filter.wxpf-drawer-t .wxpf-toggle { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-t .wxpf-apply--drawer-only { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-t .wxpf-panel-head { display: flex; }
	.wxpf-filter.wxpf-drawer-t .wxpf-close { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-t .wxpf-panel {
		position: fixed;
		z-index: 100001;
		top: 0;
		bottom: 0;
		left: 0;
		width: min(var(--wxpf-drawer-width), 92vw);
		padding: 16px;
		overflow-y: auto;
		background: #fff;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
		transform: translateX(-102%);
		transition: transform 0.25s ease;
		visibility: hidden;
	}
	.wxpf-filter.wxpf-drawer-t.wxpf-open .wxpf-panel { transform: none; visibility: visible; }
	.wxpf-filter.wxpf-drawer-t .wxpf-overlay:not([hidden]) {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(0, 0, 0, 0.45);
	}
}

@media (max-width: 767px) {
	.wxpf-filter.wxpf-drawer-m .wxpf-toggle { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-m .wxpf-apply--drawer-only { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-m .wxpf-panel-head { display: flex; }
	.wxpf-filter.wxpf-drawer-m .wxpf-close { display: inline-flex; }
	.wxpf-filter.wxpf-drawer-m .wxpf-panel {
		position: fixed;
		z-index: 100001;
		top: 0;
		bottom: 0;
		left: 0;
		width: min(var(--wxpf-drawer-width), 92vw);
		padding: 16px;
		overflow-y: auto;
		background: #fff;
		box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
		transform: translateX(-102%);
		transition: transform 0.25s ease;
		visibility: hidden;
	}
	.wxpf-filter.wxpf-drawer-m.wxpf-open .wxpf-panel { transform: none; visibility: visible; }
	.wxpf-filter.wxpf-drawer-m .wxpf-overlay:not([hidden]) {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 100000;
		background: rgba(0, 0, 0, 0.45);
	}
}

.wxpf-panel-head {
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--wxpf-gap);
	font-weight: 600;
}

.wxpf-close {
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

body.wxpf-drawer-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.wxpf-panel { transition: none !important; }
}

/* ---------------------------------------------------------------- listing */

.wxpf-listing {
	position: relative;
}

.wxpf-listing.wxpf-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	z-index: 2;
}

.wxpf-listing.wxpf-loading::before {
	content: "";
	position: absolute;
	top: 80px;
	left: 50%;
	z-index: 3;
	width: 28px;
	height: 28px;
	margin-left: -14px;
	border: 3px solid var(--wxpf-border);
	border-top-color: var(--wxpf-accent);
	border-radius: 50%;
	animation: wxpf-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.wxpf-listing.wxpf-loading::before { animation: none; }
}

.wxpf-listing ul.products.wxpf-items {
	display: grid;
	grid-template-columns: repeat(var(--wxpf-cols, 4), minmax(0, 1fr));
	gap: var(--wxpf-listing-gap, 24px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.wxpf-listing ul.products.wxpf-items::before,
.wxpf-listing ul.products.wxpf-items::after {
	display: none;
}

.wxpf-listing ul.products.wxpf-items li.product {
	float: none;
	width: auto;
	margin: 0;
	clear: none;
}

@media (min-width: 768px) and (max-width: 1024px) {
	.wxpf-listing ul.products.wxpf-items {
		grid-template-columns: repeat(var(--wxpf-cols-tablet, min(var(--wxpf-cols, 4), 3)), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.wxpf-listing ul.products.wxpf-items {
		grid-template-columns: repeat(var(--wxpf-cols-mobile, 2), minmax(0, 1fr));
	}
}

.wxpf-result-count {
	margin-bottom: 12px;
	color: var(--wxpf-muted);
}

.wxpf-result-count:empty {
	display: none;
}

.wxpf-status {
	margin-bottom: 12px;
	padding: 10px 12px;
	border: 1px solid #f5c2c7;
	border-radius: var(--wxpf-radius);
	background: #fdecee;
	color: #842029;
}

.wxpf-status[hidden],
.wxpf-pagination[hidden] {
	display: none;
}

.wxpf-empty {
	padding: 32px 0;
	text-align: center;
}

.wxpf-pagination {
	margin-top: 24px;
	text-align: center;
}

.wxpf-pagination ul.page-numbers {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wxpf-pagination .page-numbers a,
.wxpf-pagination span.page-numbers {
	display: inline-block;
	min-width: 38px;
	padding: 8px 12px;
	border: 1px solid var(--wxpf-border);
	border-radius: var(--wxpf-radius);
	text-decoration: none;
}

.wxpf-pagination .page-numbers.current {
	background: var(--wxpf-accent);
	border-color: var(--wxpf-accent);
	color: var(--wxpf-accent-contrast);
}

.wxpf-sentinel {
	display: block;
	height: 1px;
}

.wxpf-notice {
	padding: 8px 12px;
	border: 1px dashed var(--wxpf-border);
	color: var(--wxpf-muted);
}

/* Elementor adapter: dim the host widget while it reloads. */
.wxpf-loading {
	opacity: 0.6;
	transition: opacity 0.15s;
}

.wxpf-listing.wxpf-loading {
	opacity: 1;
}
