/**
 * Elementor Native WooCommerce Filters — base styles.
 *
 * All visual customisation happens through Elementor's Style tab controls
 * (see Native_Filters_Widget::register_style_*), which write inline
 * `<style>` rules scoped to `{{WRAPPER}}`. This stylesheet only provides
 * sane, minimal structural defaults so the widget looks good out of the box.
 */

.enwf-filters {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
	height: 100%;
}

.enwf-filters.is-loading .enwf-loading-overlay,
.enwf-filters .enwf-loading-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: rgba( 255, 255, 255, 0.6 );
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
	z-index: 5;
}

.enwf-filters.is-loading .enwf-loading-overlay {
	opacity: 1;
	pointer-events: auto;
}

.enwf-loading-overlay__spinner {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 3px solid rgba( 0, 0, 0, 0.1 );
	border-top-color: #333;
	animation: enwf-spin 0.7s linear infinite;
}

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

/* Active chips ---------------------------------------------------- */

.enwf-active-chips {
	display: none;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.enwf-active-chips.is-visible {
	display: flex;
}

.enwf-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	background: #f1f1f1;
	color: #333;
	border-radius: 30px;
	font-size: 13px;
	line-height: 1.4;
}

.enwf-chip__remove {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	color: inherit;
	padding: 0;
}

.enwf-clear-all {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	text-decoration: underline;
	color: #333;
	padding: 0;
}

/* Search ------------------------------------------------------------ */

.enwf-search__input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 14px;
}

/* Toggle switch (On Sale / In Stock) --------------------------------- */

.enwf-toggle {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	user-select: none;
}

.enwf-toggle__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.enwf-toggle__track {
	width: 36px;
	height: 20px;
	border-radius: 20px;
	background: #ccc;
	position: relative;
	transition: background-color 0.15s ease;
	flex-shrink: 0;
}

.enwf-toggle__thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s ease;
}

.enwf-toggle__input:checked ~ .enwf-toggle__track {
	background: #2271b1;
}

.enwf-toggle__input:checked ~ .enwf-toggle__track .enwf-toggle__thumb {
	transform: translateX( 16px );
}

/* Groups / accordion -------------------------------------------------- */

.enwf-groups--accordion .enwf-accordion__item {
	border-bottom: 1px solid #eaeaea;
	padding-bottom: 12px;
}

/* Tags (and any other section intentionally rendered flat, without an
   accordion wrapper) still get the same divider + vertical rhythm as the
   accordion items around them, so they visually blend in as "one more
   row" instead of looking like a different kind of element. */
.enwf-groups--accordion > .enwf-group {
	padding: 20px 15px;
	border-bottom: 1px solid #eaeaea;
}

.enwf-accordion__header {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: none;
	border: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
	padding: 12px 0;
	font-weight: 600;
	text-align: left;
}

/* Caret icon: a small filled triangle, pointing down when the section is
   open and rotating to point right (collapsed) when closed. */
.enwf-accordion__icon {
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid currentColor;
	transition: transform 0.25s cubic-bezier( 0.4, 0, 0.2, 1 );
	flex-shrink: 0;
}

.enwf-accordion__item.is-closed .enwf-accordion__icon {
	transform: rotate( -90deg );
}

/* Smooth open/close animation via the CSS grid 0fr <-> 1fr technique:
   this animates smoothly regardless of the panel's actual content height
   (unlike animating `max-height`, which either clips abruptly or requires
   guessing an oversized value that makes the easing feel uneven). The
   inner wrapper needs `overflow: hidden` and `min-height: 0` because grid
   items don't shrink below their content size by default. */
.enwf-accordion__panel {
	display: grid;
	grid-template-rows: 1fr;
	overflow: hidden;
	transition: grid-template-rows 0.3s cubic-bezier( 0.4, 0, 0.2, 1 );
	padding: 0 15px;
}

.enwf-accordion__item.is-closed .enwf-accordion__panel {
	grid-template-rows: 0fr;
}

.enwf-accordion__panel-inner {
	overflow: hidden;
	min-height: 0;
}

.enwf-group__label {
	font-weight: 600;
	padding: 12px 0;
	margin-bottom: 8px;
	border-bottom: 1px solid #eaeaea;
}

/* Apply / Reset action bar ---------------------------------------------- */

.enwf-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: auto;
	padding: 0 15px;
}

.enwf-actions__apply {
	appearance: none;
	cursor: pointer;
	border: none;
	background: #333;
	color: #fff;
	padding: 12px 20px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.enwf-actions__apply:hover {
	background: #000;
}

.enwf-actions__reset {
	appearance: none;
	cursor: pointer;
	border: 1px solid #ddd;
	background: #fff;
	color: #333;
	padding: 12px 20px;
	border-radius: 6px;
	font-size: 14px;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.enwf-actions__reset:hover {
	background: #f5f5f5;
	border-color: #ccc;
}

/* Term lists: checkboxes ---------------------------------------------- */

.enwf-terms {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.enwf-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
}

.enwf-checkbox__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.enwf-checkbox__box {
	width: 18px;
	height: 18px;
	border: 1px solid #bbb;
	border-radius: 4px;
	flex-shrink: 0;
	position: relative;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.enwf-checkbox__input:checked ~ .enwf-checkbox__box::after,
.enwf-checkbox.enwf-is-checked .enwf-checkbox__box::after {
	content: '';
	position: absolute;
	left: 5px;
	top: 1px;
	width: 5px;
	height: 10px;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate( 45deg );
}

/* Class-based fallback for the checked background/border (see JS
   renderTermStates()): some themes/global stylesheets interfere with the
   native `:checked` pseudo-class rendering, so this class is set
   explicitly in addition to the real `.checked` property. */
.enwf-checkbox.enwf-is-checked .enwf-checkbox__box {
	background-color: #333;
	border-color: #333;
}

.enwf-checkbox__label {
	font-size: 14px;
}

.enwf-term-count {
	font-size: 12px;
	color: #888;
}

/* Term lists: pills ----------------------------------------------------- */

.enwf-terms--pills {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px;
}

.enwf-pill {
	appearance: none;
	cursor: pointer;
	border: 1px solid #ddd;
	background: #fff;
	color: #333;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.enwf-pill.is-active {
	background: #333;
	color: #fff;
	border-color: #333;
}

.enwf-badge {
	background: rgba( 0, 0, 0, 0.08 );
	border-radius: 10px;
	font-size: 11px;
	padding: 1px 6px;
}

/* Price slider ------------------------------------------------------------ */

.enwf-price-slider__track {
	position: relative;
	height: 4px;
	background: #e2e2e2;
	border-radius: 4px;
	margin: 20px 4px 12px;
}

.enwf-price-slider__range {
	position: absolute;
	top: 0;
	bottom: 0;
	background: #333;
	border-radius: 4px;
}

.enwf-price-slider__handle {
	position: absolute;
	top: 50%;
	width: 16px;
	height: 16px;
	background: #333;
	border: 2px solid #fff;
	border-radius: 50%;
	transform: translate( -50%, -50% );
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.2 );
	cursor: pointer;
	touch-action: none;
	padding: 0 !important;
}

.enwf-price-slider__handle--min {
	margin-left: 5px;
}

.enwf-price-slider__handle--max {
	margin-left: -5px;
}

.enwf-price-slider__values {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
}

/* Layout modifiers ---------------------------------------------------------- */

.enwf-layout-horizontal .enwf-groups {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}

.enwf-layout-vertical .enwf-groups {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.enwf-layout-pills .enwf-terms {
	flex-direction: row;
	flex-wrap: wrap;
}
