/* ==========================================================================
   Filter Studio — front end
   Every colour and size comes from a custom property set per filter set by
   FST_Render::scoped_css(). The values below are fallbacks only.
   ========================================================================== */

.fst-panel {
	--fst-bg: #0b0b0e;
	--fst-accent: #d6a94c;
	--fst-text: #f2f2f4;
	--fst-muted: #85858f;
	--fst-line: #1c1c22;
	--fst-tick: #14140f;
	--fst-radius: 14px;
	--fst-pad: 18px;
	--fst-width: 280px;
	--fst-heading-size: 15px;
	--fst-option-size: 14px;
	--fst-box-radius: 3px;

	box-sizing: border-box !important;
	width: 100% !important;
	max-width: var(--fst-width) !important;
	margin: 0 !important;
	padding: 4px var(--fst-pad) var(--fst-pad) !important;
	background: var(--fst-bg) !important;
	border: 1px solid var(--fst-line) !important;
	border-radius: var(--fst-radius) !important;
	color: var(--fst-text) !important;
	font-size: var(--fst-option-size) !important;
	line-height: 1.45 !important;
	-webkit-font-smoothing: antialiased;
}

.fst-panel *,
.fst-panel *::before,
.fst-panel *::after {
	box-sizing: inherit;
}

.fst-panel--horizontal {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 8px 24px;
	/* !important to clear the max-width/padding .fst-panel sets the same way. */
	max-width: none !important;
	padding: var(--fst-pad) !important;
}

.fst-panel--horizontal .fst-group {
	flex: 1 1 180px;
	border-top: 0;
}

.fst-panel__heading {
	margin: 14px 0 2px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--fst-muted);
}

/* --- Group ---------------------------------------------------------------- */

.fst-panel--vertical .fst-group + .fst-group {
	border-top: 1px solid var(--fst-line);
}

.fst-group__title {
	margin: 0;
	padding: 0;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	border: 0;
}

.fst-group__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100% !important;
	padding: 16px 0 !important;
	background: none !important;
	border: 0 !important;
	border-radius: 4px !important;
	color: var(--fst-text) !important;
	font: inherit !important;
	font-size: var(--fst-heading-size) !important;
	font-weight: 600 !important;
	text-align: left !important;
	cursor: pointer !important;
	appearance: none !important;
}

.fst-group__toggle:hover,
.fst-group__toggle:focus {
	color: var(--fst-text);
	background: none;
}

.fst-group__toggle:focus-visible {
	outline: 2px solid var(--fst-accent);
	outline-offset: 3px;
}

.fst-chevron {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	color: var(--fst-muted);
	transform: rotate(-90deg);
	transition: transform 0.22s ease, color 0.22s ease;
}

.fst-group.is-open > .fst-group__title .fst-chevron {
	transform: rotate(0deg);
}

.fst-group__toggle:hover .fst-chevron {
	color: var(--fst-text);
}

/* --- Collapsible panel ---------------------------------------------------- */

.fst-group__panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.26s ease;
}

.fst-group.is-open > .fst-group__panel {
	grid-template-rows: 1fr;
}

.fst-group__list {
	overflow: hidden;
	min-height: 0;
}

.fst-group.is-open > .fst-group__panel > .fst-group__list {
	padding-bottom: 8px;
}

/* --- Options -------------------------------------------------------------- */

.fst-option {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 6px 0;
	color: var(--fst-muted);
	/* !important: this is a bare <label>, which themes and Woo both style. */
	font-size: var(--fst-option-size) !important;
	cursor: pointer;
	transition: color 0.15s ease;
}

.fst-option:hover {
	color: var(--fst-text);
}

.fst-option--extra {
	display: none;
}

.fst-group.fst-group--expanded .fst-option--extra {
	display: flex;
}

/* Visually hidden, still focusable. */
.fst-option input,
.fst-label-pill input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.fst-option__box {
	position: relative;
	flex: 0 0 auto;
	width: 15px;
	height: 15px;
	background: transparent;
	border: 1.5px solid var(--fst-muted);
	border-radius: var(--fst-box-radius);
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.fst-option__box::after {
	content: "";
	position: absolute;
	top: 1px;
	left: 4px;
	width: 4px;
	height: 8px;
	border: solid var(--fst-tick);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg) scale(0.6);
	opacity: 0;
	transition: opacity 0.12s ease, transform 0.12s ease;
}

.fst-option input:checked ~ .fst-option__box {
	background: var(--fst-accent);
	border-color: var(--fst-accent);
}

.fst-option input:checked ~ .fst-option__box::after {
	opacity: 1;
	transform: rotate(45deg) scale(1);
}

.fst-option input:checked ~ .fst-option__label {
	color: var(--fst-text);
}

.fst-option:hover .fst-option__box {
	border-color: var(--fst-text);
}

.fst-option input:focus-visible ~ .fst-option__box {
	outline: 2px solid var(--fst-accent);
	outline-offset: 2px;
}

.fst-option__label {
	transition: color 0.15s ease;
}

.fst-option__count {
	margin-left: auto;
	font-size: 0.85em;
	opacity: 0.7;
}

/* --- Pill buttons --------------------------------------------------------- */

.fst-labels {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 4px 0 2px;
}

.fst-label-pill {
	margin: 0;
	cursor: pointer;
}

.fst-label-pill span {
	display: inline-block;
	padding: 5px 12px;
	border: 1px solid var(--fst-line);
	border-radius: 999px;
	color: var(--fst-muted);
	font-size: calc(var(--fst-option-size) - 1px);
	transition: all 0.15s ease;
}

.fst-label-pill input:checked + span {
	background: var(--fst-accent);
	border-color: var(--fst-accent);
	color: var(--fst-tick);
}

.fst-label-pill input:focus-visible + span {
	outline: 2px solid var(--fst-accent);
	outline-offset: 2px;
}

/* --- Dropdown ------------------------------------------------------------- */

.fst-select {
	width: 100%;
	margin: 4px 0 6px;
	padding: 8px 10px;
	background: transparent;
	border: 1px solid var(--fst-line);
	border-radius: 6px;
	color: var(--fst-text);
	font: inherit;
	font-size: var(--fst-option-size);
}

.fst-select option {
	color: #111;
}

/* --- Show more ------------------------------------------------------------ */

.fst-more {
	margin: 4px 0 0;
	padding: 4px 0;
	background: none;
	border: 0;
	color: var(--fst-accent);
	font: inherit;
	font-size: calc(var(--fst-option-size) - 1px);
	text-decoration: underline;
	cursor: pointer;
}

/* --- Buttons -------------------------------------------------------------- */

.fst-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 18px;
}

.fst-clear,
.fst-apply {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	background: var(--fst-accent);
	border: 0;
	border-radius: 999px;
	color: var(--fst-tick);
	font: inherit;
	font-size: calc(var(--fst-option-size) - 1px);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
}

.fst-clear:hover,
.fst-apply:hover {
	filter: brightness(1.1);
	color: var(--fst-tick);
	text-decoration: none;
}

.fst-clear:active,
.fst-apply:active {
	transform: translateY(1px);
}

.fst-clear:focus-visible,
.fst-apply:focus-visible {
	outline: 2px solid var(--fst-text);
	outline-offset: 2px;
}

/* --- Loading -------------------------------------------------------------- */

.fst-panel.is-loading {
	opacity: 0.55;
}

/* --- Chips ---------------------------------------------------------------- */

.fst-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
}

.fst-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 12px;
	background: rgba(128, 128, 128, 0.12);
	border: 1px solid rgba(128, 128, 128, 0.25);
	border-radius: 999px;
	color: inherit;
	font-size: 13px;
	line-height: 1.4;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.fst-chip:hover {
	background: rgba(128, 128, 128, 0.22);
	text-decoration: none;
}

.fst-chip__x {
	font-size: 15px;
	line-height: 1;
	opacity: 0.6;
}

.fst-chip--clear {
	background: transparent;
	border-style: dashed;
	font-weight: 600;
}

/* --- Admin-only hint ------------------------------------------------------ */

.fst-hint {
	padding: 10px 14px;
	background: #fff8e5;
	border-left: 4px solid #d6a94c;
	color: #5a4a20;
	font-size: 13px;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 768px) {
	.fst-panel {
		/* Same reason as .fst-panel--horizontal: the base rule is !important. */
		max-width: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fst-panel *,
	.fst-panel *::after {
		transition-duration: 0.01ms !important;
	}
}
