/* Fast Filter — front-end UI
 * Theming via CSS variables (also exposed as Elementor widget controls). */

.ff {
	--ff-accent: #111827;
	--ff-accent-contrast: #ffffff;
	--ff-text: #111827;
	--ff-muted: #6b7280;
	--ff-bg: #ffffff;
	--ff-panel: #f3f4f6;
	--ff-border: #e5e7eb;
	--ff-radius: 12px;
	--ff-swatch: 22px;
	--ff-max-h: none;
	--ff-pad: 16px;

	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--ff-bg);
	color: var(--ff-text);
	border-radius: var(--ff-radius);
	box-sizing: border-box;
	text-align: start;
	line-height: 1.4;
}
.ff *, .ff *::before, .ff *::after { box-sizing: border-box; }
.ff button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ff ul { list-style: none; margin: 0; padding: 0; }
.ff [hidden] { display: none !important; }
.ff--empty { padding: 12px; border: 1px dashed var(--ff-border); color: var(--ff-muted); font-size: 13px; }

/* Header ---------------------------------------------------------------- */
.ff__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: var(--ff-pad) var(--ff-pad) 8px;
}
.ff__title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; }
.ff__clear { font-size: 13px; color: var(--ff-muted); text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
.ff__clear:hover { color: var(--ff-text); }

/* Chips ------------------------------------------------------------------ */
.ff__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--ff-pad) 10px; }
.ff-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 8px 4px 10px; font-size: 12.5px; line-height: 1.2;
	border-radius: 999px; background: var(--ff-panel); color: var(--ff-text);
	max-width: 100%;
}
.ff-chip__x { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; border-radius: 50%; color: var(--ff-muted); }
.ff-chip__x:hover { background: var(--ff-border); color: var(--ff-text); }
.ff-chip__x svg { width: 12px; height: 12px; }

/* Body / accordion ------------------------------------------------------- */
.ff__body { flex: 1 1 auto; min-height: 0; padding: 0 var(--ff-pad); }
/* Optional "scroll" layout: body scrolls inside a max height and the buttons stay visible. */
.ff--scroll { max-height: var(--ff-max-h, 80vh); }
.ff--scroll .ff__body { overflow: auto; overscroll-behavior: contain; }
.ff-sec { border-top: 1px solid var(--ff-border); }
.ff-sec:first-child { border-top: 0; }
.ff-sec__h { margin: 0; font-size: inherit; }
.ff-sec__head {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	width: 100%; padding: 14px 0; text-align: start;
}
.ff-sec__title { font-weight: 600; font-size: 15px; }
.ff-sec__meta { display: inline-flex; align-items: center; gap: 8px; color: var(--ff-muted); }
.ff-sec__badge {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
	background: var(--ff-accent); color: var(--ff-accent-contrast); font-size: 11.5px; font-weight: 700;
}
.ff-sec__chev { display: inline-flex; transition: transform .25s ease; }
.ff-sec.is-open .ff-sec__chev { transform: rotate(180deg); }
.ff-sec__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.ff-sec.is-open .ff-sec__panel { grid-template-rows: 1fr; }
.ff-sec__inner { min-height: 0; overflow: hidden; }
.ff-sec.is-open .ff-sec__inner { padding-bottom: 14px; }
.ff-filter + .ff-filter { margin-top: 14px; }
.ff-filter__label { font-size: 13px; font-weight: 600; color: var(--ff-muted); margin-bottom: 6px; }
.ff-empty { margin: 0; font-size: 13px; color: var(--ff-muted); }

/* Options (checkbox rows) ----------------------------------------------- */
.ff-opt__label {
	position: relative; display: flex; align-items: center; gap: 10px;
	padding: 7px 6px; margin: 0 -6px; border-radius: 8px; cursor: pointer; user-select: none;
	transition: background .15s ease;
}
.ff-opt__label:hover { background: var(--ff-panel); }
.ff-opt__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.ff-check {
	flex: 0 0 auto; width: 18px; height: 18px; border-radius: 5px;
	border: 1.5px solid var(--ff-border); background: var(--ff-bg);
	display: inline-flex; align-items: center; justify-content: center;
	transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ff-check::after {
	content: ""; width: 10px; height: 10px; opacity: 0; transform: scale(.6);
	background: currentColor; color: var(--ff-accent-contrast);
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M4 10.5l4 4 8-8' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
	mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M4 10.5l4 4 8-8' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
	transition: opacity .15s ease, transform .15s ease;
}
.ff-opt__input:checked + .ff-check { background: var(--ff-accent); border-color: var(--ff-accent); }
.ff-opt__input:checked + .ff-check::after { opacity: 1; transform: scale(1); }
.ff-opt__input:focus-visible + .ff-check { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-accent) 30%, transparent); }
.ff-opt__name { flex: 1 1 auto; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.ff-opt__count { flex: 0 0 auto; font-size: 12px; color: var(--ff-muted); font-variant-numeric: tabular-nums; }
.is-empty > .ff-opt__label, .is-empty > .ff-node__row > .ff-opt__label, .ff-swatch.is-empty > .ff-swatch__label { opacity: .42; }
.ff-list > li.is-hidden, .ff-list > li.is-filtered { display: none; }

/* Category tree ---------------------------------------------------------- */
.ff-tree .ff-node__row { display: flex; align-items: center; gap: 2px; }
.ff-tree .ff-node__row > .ff-opt__label { flex: 1 1 auto; min-width: 0; }
.ff-node__toggle {
	flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
	width: 28px; height: 28px; border-radius: 6px; color: var(--ff-muted);
	transition: transform .2s ease, background .15s ease;
}
.ff-node__toggle:hover { background: var(--ff-panel); color: var(--ff-text); }
.ff-node.is-open > .ff-node__row > .ff-node__toggle { transform: rotate(180deg); }
.ff-node__children { display: none; padding-inline-start: 22px; position: relative; }
.ff-node__children::before { content: ""; position: absolute; inset-block: 4px; inset-inline-start: 9px; width: 1px; background: var(--ff-border); }
.ff-node.is-open > .ff-node__children { display: block; }

/* Search / show more ----------------------------------------------------- */
.ff-search { margin-bottom: 6px; }
.ff-search__input {
	width: 100%; padding: 8px 12px; font: inherit; font-size: 13.5px; color: var(--ff-text);
	background: var(--ff-panel); border: 1px solid transparent; border-radius: 8px; outline: none;
}
.ff-search__input:focus { border-color: var(--ff-accent); background: var(--ff-bg); }
.ff-more { margin-top: 4px; padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--ff-accent); text-decoration: underline; text-underline-offset: 3px; }

/* Colour swatches -------------------------------------------------------- */
.ff-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.ff-swatch__label {
	position: relative; display: inline-flex; align-items: center; gap: 8px;
	padding: 5px 10px 5px 6px; border: 1.5px solid var(--ff-border); border-radius: 999px;
	cursor: pointer; user-select: none; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
[dir="rtl"] .ff-swatch__label { padding: 5px 6px 5px 10px; }
.ff-swatch__label:hover { border-color: var(--ff-muted); }
.ff-swatch__dot {
	--sw: var(--ff-panel);
	position: relative; flex: 0 0 auto; width: var(--ff-swatch); height: var(--ff-swatch); border-radius: 50%;
	background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
	display: inline-flex; align-items: center; justify-content: center;
}
.ff-swatch__initial { display: none; font-size: 11px; font-weight: 700; color: var(--ff-muted); }
.no-color .ff-swatch__initial { display: block; }
.ff-swatch__name { font-size: 13.5px; }
.ff-swatch .ff-opt__count { font-size: 11.5px; }
.ff-swatch .ff-opt__input:checked ~ .ff-swatch__dot::after,
.ff-swatch .ff-opt__input:checked + .ff-swatch__dot::after {
	content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ff-accent);
}
.ff-swatch .ff-opt__input:checked ~ .ff-swatch__name { font-weight: 600; }
.ff-swatch__label:has(.ff-opt__input:checked) { border-color: var(--ff-accent); background: color-mix(in srgb, var(--ff-accent) 6%, var(--ff-bg)); }
.ff-swatch__label:has(.ff-opt__input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ff-accent) 30%, transparent); }

/* Range slider ----------------------------------------------------------- */
.ff-range { padding: 4px 0 2px; }
.ff-range + .ff-range { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--ff-border); }
.ff-range__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ff-range__label { font-size: 14px; font-weight: 600; }
.ff-range__out { font-size: 13px; color: var(--ff-muted); font-variant-numeric: tabular-nums; }
.ff-range__out b { color: var(--ff-text); font-weight: 600; }
.ff-range__slider { position: relative; height: 28px; margin: 0 9px; }
.ff-range__track { position: absolute; inset-inline: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--ff-border); }
.ff-range__fill { position: absolute; top: 0; bottom: 0; background: var(--ff-accent); border-radius: 2px; }
.ff-range__input {
	-webkit-appearance: none; appearance: none;
	position: absolute; inset-inline: -9px; top: 0; width: calc(100% + 18px); height: 28px; margin: 0;
	background: transparent; pointer-events: none; outline: none;
}
.ff-range__input::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.ff-range__input::-moz-range-track { height: 28px; background: transparent; }
.ff-range__input::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none; pointer-events: auto;
	width: 18px; height: 18px; margin-top: 5px; border-radius: 50%;
	background: var(--ff-bg); border: 2px solid var(--ff-accent); box-shadow: 0 1px 3px rgba(0,0,0,.2);
	cursor: grab; transition: transform .12s ease;
}
.ff-range__input::-moz-range-thumb {
	pointer-events: auto; width: 14px; height: 14px; border-radius: 50%;
	background: var(--ff-bg); border: 2px solid var(--ff-accent); box-shadow: 0 1px 3px rgba(0,0,0,.2); cursor: grab;
}
.ff-range__input:active::-webkit-slider-thumb { transform: scale(1.12); cursor: grabbing; }
.ff-range__input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ff-accent) 30%, transparent); }
.ff-range__input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ff-accent) 30%, transparent); }
.ff-range__fields { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ff-range__field { flex: 1 1 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ff-muted); }
.ff-range__field input {
	width: 100%; min-width: 0; padding: 6px 8px; font: inherit; font-size: 13px; color: var(--ff-text);
	background: var(--ff-panel); border: 1px solid transparent; border-radius: 8px; outline: none; -moz-appearance: textfield;
}
.ff-range__field input::-webkit-outer-spin-button, .ff-range__field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ff-range__field input:focus { border-color: var(--ff-accent); background: var(--ff-bg); }
.ff-range__sep { color: var(--ff-muted); }

/* Footer ----------------------------------------------------------------- */
.ff__foot {
	display: flex; gap: 10px; padding: 12px var(--ff-pad) var(--ff-pad);
	background: var(--ff-bg); border-top: 1px solid var(--ff-border);
	border-radius: 0 0 var(--ff-radius) var(--ff-radius);
}
.ff-btn {
	position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; padding: 10px 18px; border-radius: calc(var(--ff-radius) - 2px);
	font-size: 14px; font-weight: 600; transition: filter .15s ease, background .15s ease, opacity .15s ease;
}
.ff-btn--primary { flex: 1 1 auto; background: var(--ff-accent); color: var(--ff-accent-contrast); }
.ff-btn--primary:hover { filter: brightness(1.08); }
.ff-btn--primary.is-none { opacity: .7; }
.ff--scroll .ff__foot { position: sticky; bottom: 0; z-index: 1; }
.ff-btn--ghost { background: var(--ff-panel); color: var(--ff-text); border: 1px solid var(--ff-border); }
.ff-btn--ghost:hover { background: var(--ff-border); }
.ff-btn__spinner {
	display: none; width: 16px; height: 16px; border-radius: 50%;
	border: 2px solid color-mix(in srgb, var(--ff-accent-contrast) 35%, transparent); border-top-color: var(--ff-accent-contrast);
	animation: ff-spin .7s linear infinite;
}
.ff.is-loading .ff-btn__spinner { display: inline-block; }
@keyframes ff-spin { to { transform: rotate(360deg); } }

/* Elementor popup: the popup itself scrolls; the widget just takes its full height ---- */
.elementor-widget-fast_filter { width: 100%; }

@media (prefers-reduced-motion: reduce) {
	.ff *, .ff *::before, .ff *::after { transition: none !important; animation-duration: 0s !important; }
}
@media (max-width: 480px) {
	.ff { --ff-pad: 14px; }
	.ff-range__fields { flex-wrap: wrap; }
}
