/* SLV GridOps Shop Filters — storefront styles.
   Deliberately neutral so it inherits the theme's typography; the CSS
   variables below are the tuning knobs (override them in the theme or
   Customizer → Additional CSS). */

.sgsf-sidebar {
	--sgsf-border: #d7dbe0;
	--sgsf-accent: #111111;
	--sgsf-radius: 8px;
	display: block;
	font-size: 14px;
	margin: 0 0 16px;
}

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

.sgsf-group {
	border-bottom: 1px solid var(--sgsf-border);
	padding: 2px 0 10px;
	margin: 0 0 10px;
}

.sgsf-group > summary {
	list-style: none;
	cursor: pointer;
	user-select: none;
	font-weight: 600;
	padding: 8px 0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.sgsf-group > summary::-webkit-details-marker { display: none; }

.sgsf-group > summary::after {
	content: "▾";
	margin-left: auto;
	font-size: 11px;
	opacity: 0.55;
	transition: transform 0.15s ease;
}

.sgsf-group:not([open]) > summary::after {
	transform: rotate(-90deg);
}

.sgsf-badge {
	display: inline-block;
	min-width: 18px;
	text-align: center;
	background: var(--sgsf-accent);
	color: #fff;
	border-radius: 9px;
	font-size: 11px;
	font-weight: 600;
	line-height: 18px;
	padding: 0 5px;
}

.sgsf-group-body {
	padding: 2px 0 4px;
}

/* Checkbox lists scroll instead of swallowing the sidebar. */
.sgsf-options {
	max-height: 236px;
	overflow: auto;
	padding-right: 4px;
}

.sgsf-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 0;
	cursor: pointer;
	font-weight: 400;
}

.sgsf-option input[type="checkbox"] {
	margin: 0;
	flex: 0 0 auto;
}

.sgsf-option-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sgsf-count {
	margin-left: auto;
	opacity: 0.5;
	font-size: 12px;
}

.sgsf-select {
	width: 100%;
	max-width: 100%;
	border: 1px solid var(--sgsf-border);
	border-radius: 6px;
	padding: 6px 8px;
	background: #fff;
}

/* ------------------------------------------------------------------ */
/* Price + toggles                                                     */
/* ------------------------------------------------------------------ */

.sgsf-price {
	display: flex;
	align-items: center;
	gap: 6px;
}

.sgsf-price input {
	width: 100%;
	min-width: 0;
	border: 1px solid var(--sgsf-border);
	border-radius: 6px;
	padding: 6px 8px;
}

.sgsf-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
	cursor: pointer;
	font-weight: 600;
	border-bottom: 1px solid var(--sgsf-border);
	margin: 0 0 10px;
}

.sgsf-toggle input[type="checkbox"] {
	margin: 0;
}

/* ------------------------------------------------------------------ */
/* Apply + chips                                                       */
/* ------------------------------------------------------------------ */

.sgsf-apply {
	display: block;
	width: 100%;
	border: 1px solid var(--sgsf-accent);
	background: var(--sgsf-accent);
	color: #fff;
	border-radius: var(--sgsf-radius);
	padding: 9px 16px;
	cursor: pointer;
	font-size: 14px;
	margin-top: 4px;
}

.sgsf-apply:hover {
	opacity: 0.88;
}

/* Auto-apply JS marks the form; the button becomes redundant. */
.sgsf-sidebar.sgsf-auto .sgsf-apply {
	display: none;
}

.sgsf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 10px 0 16px;
	font-size: 13px;
}

.sgsf-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid #d7dbe0;
	border-radius: 999px;
	padding: 4px 12px;
	text-decoration: none;
	background: #f6f7f8;
	color: inherit;
}

.sgsf-chip:hover {
	border-color: #111;
}

.sgsf-chip-clear {
	background: transparent;
	border-style: dashed;
}

/* ------------------------------------------------------------------ */
/* Horizontal variant ("Above the product grid" placement)             */
/* ------------------------------------------------------------------ */

.sgsf-sidebar.sgsf-horizontal {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 16px;
	align-items: flex-start;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-group {
	position: relative;
	border-bottom: 0;
	padding: 0;
	margin: 0;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-group > summary {
	border: 1px solid var(--sgsf-border);
	border-radius: var(--sgsf-radius);
	padding: 7px 12px;
	background: #fff;
	white-space: nowrap;
	font-weight: 400;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-group[open] > summary {
	border-color: var(--sgsf-accent);
}

.sgsf-sidebar.sgsf-horizontal .sgsf-group-body {
	position: absolute;
	z-index: 30;
	top: calc(100% + 6px);
	left: 0;
	min-width: 220px;
	max-height: 320px;
	overflow: auto;
	background: #fff;
	border: 1px solid var(--sgsf-border);
	border-radius: var(--sgsf-radius);
	box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
	padding: 10px 12px;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-option {
	white-space: nowrap;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-toggle {
	border: 1px solid var(--sgsf-border);
	border-radius: var(--sgsf-radius);
	border-bottom: 1px solid var(--sgsf-border);
	padding: 7px 12px;
	margin: 0;
	background: #fff;
	font-weight: 400;
	white-space: nowrap;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-price input {
	width: 90px;
}

.sgsf-sidebar.sgsf-horizontal .sgsf-apply {
	display: inline-block;
	width: auto;
	margin: 0;
}

/* Even with auto-apply, the horizontal bar keeps the button visible for
   the price fields (there's no obvious "done" affordance in a bar). */
.sgsf-sidebar.sgsf-horizontal.sgsf-auto .sgsf-apply {
	display: inline-block;
}

@media (max-width: 640px) {
	.sgsf-sidebar.sgsf-horizontal {
		gap: 6px;
	}
	.sgsf-sidebar.sgsf-horizontal .sgsf-group-body {
		min-width: 180px;
	}
}

/* ------------------------------------------------------------------ */
/* 0.3.1 polish layer: modern inputs, hover/focus states, theme        */
/* resilience. CSS-only — markup untouched.                            */
/* ------------------------------------------------------------------ */

.sgsf-sidebar {
	--sgsf-bg: #ffffff;
	--sgsf-hover: rgba(0, 0, 0, 0.04);
}

/* Native controls pick up the accent colour (modern browsers). */
.sgsf-sidebar input[type="checkbox"],
.sgsf-sidebar input[type="radio"] {
	accent-color: var(--sgsf-accent);
	width: 15px;
	height: 15px;
}

/* Options: a soft hover wash, roomier hit area, checked emphasis. */
.sgsf-option {
	border-radius: 6px;
	padding: 5px 6px;
	margin: 0 -6px;
	transition: background 0.12s ease;
}

.sgsf-option:hover {
	background: var(--sgsf-hover);
}

/* The checked/unchecked weight distinction must survive theme CSS that
   boldens every <label> in the sidebar (a common pattern for widgets
   whose labels were group headings). Weight lives on the NAME SPAN with
   !important: an inherited label weight never beats a declared rule. */
.sgsf-sidebar .sgsf-option .sgsf-option-name {
	font-weight: 400 !important;
}

.sgsf-sidebar .sgsf-option:has(input:checked) .sgsf-option-name {
	font-weight: 600 !important;
}

.sgsf-option:has(input:checked) .sgsf-count {
	opacity: 0.8;
}

/* Keyboard users get a visible ring; mouse users don't. Guarded with
   !important because theme resets commonly declare
   `input:focus { outline: none !important }` site-wide. */
.sgsf-sidebar summary:focus-visible,
.sgsf-sidebar .sgsf-option input:focus-visible,
.sgsf-sidebar .sgsf-select:focus-visible,
.sgsf-sidebar .sgsf-price input:focus-visible,
.sgsf-sidebar .sgsf-apply:focus-visible,
.sgsf-sidebar .sgsf-chip:focus-visible {
	outline: 2px solid var(--sgsf-accent) !important;
	outline-offset: 2px;
	box-shadow: none !important;
}

.sgsf-group > summary:hover {
	opacity: 0.8;
}

/* Thin, unobtrusive scrollbar on long option lists. */
.sgsf-options {
	scrollbar-width: thin;
}

.sgsf-options::-webkit-scrollbar {
	width: 6px;
}

.sgsf-options::-webkit-scrollbar-thumb {
	background: var(--sgsf-border);
	border-radius: 999px;
}

/* Inputs share one focus language. */
.sgsf-select:focus,
.sgsf-price input:focus {
	border-color: var(--sgsf-accent);
	box-shadow: none;
}

/* Backgrounds route through the variable so dark themes can override
   one knob instead of fighting hardcoded white. */
.sgsf-select,
.sgsf-sidebar.sgsf-horizontal .sgsf-group > summary,
.sgsf-sidebar.sgsf-horizontal .sgsf-group-body,
.sgsf-sidebar.sgsf-horizontal .sgsf-toggle {
	background: var(--sgsf-bg);
}

/* Active-filter chips: the ✕ affordance reads as removable. */
.sgsf-chip {
	transition: border-color 0.12s ease, background 0.12s ease;
}

.sgsf-chip:hover {
	background: #eef0f3;
}

.sgsf-chip-clear:hover {
	border-style: solid;
}

.sgsf-apply {
	font-weight: 600;
	transition: opacity 0.12s ease;
}

/* Group open/close: ease the reveal instead of snapping. */
.sgsf-group-body {
	animation: sgsf-reveal 0.14s ease;
}

@keyframes sgsf-reveal {
	from { opacity: 0; transform: translateY(-3px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.sgsf-group-body { animation: none; }
	.sgsf-option, .sgsf-chip, .sgsf-apply { transition: none; }
}
