/* Filter & Sort trigger (shop toolbar) + drawer wrapping both the sort
   options and the site's existing Nova AJAX Product Filter widgets (see
   inc/shop-filters.php). Nova's own CSS/JS still does the actual filtering;
   this only themes the surrounding chrome. A plain text+icon control (no
   button chrome) so it reads as a lightweight action next to the "PRODUCTS
   (N)" heading, not a competing box. */

.qg-filter-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	flex-shrink: 0;
	border: 0;
	background: none;
	padding: 0;
	color: var(--qg-color-ink);
	font-family: var(--qg-font-body);
	font-size: 0.88rem;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.2s var(--qg-ease);
}

.qg-filter-trigger .qg-icon {
	width: 16px;
	height: 16px;
}

.qg-filter-trigger:hover,
.qg-filter-trigger.is-active {
	color: var(--qg-color-accent-dark);
}

.qg-filter-drawer[hidden] {
	display: none;
}

.qg-filter-drawer {
	position: fixed;
	inset: 0;
	z-index: 210;
}

/* Sits below WP's own admin bar (z-index 99999) for logged-in staff
   browsing the live site, instead of covering its top ~32/46px. */
body.admin-bar .qg-filter-drawer {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .qg-filter-drawer {
		top: 46px;
	}
}

.qg-filter-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 14, 14, 0.4);
	opacity: 0;
	transition: opacity 0.25s var(--qg-ease);
}

.qg-filter-drawer.is-open .qg-filter-drawer__backdrop {
	opacity: 1;
}

.qg-filter-drawer__panel {
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: min(360px, 88vw);
	background: var(--qg-color-surface);
	display: flex;
	flex-direction: column;
	transform: translateX(-100%);
	transition: transform 0.3s var(--qg-ease);
	box-shadow: var(--qg-shadow-lg);
}

.qg-filter-drawer.is-open .qg-filter-drawer__panel {
	transform: translateX(0);
}

.qg-filter-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--qg-space-4);
	border-bottom: 1px solid var(--qg-color-line);
	flex-shrink: 0;
}

.qg-filter-drawer__title {
	margin: 0;
	font-family: var(--qg-font-heading);
	font-size: 1.3rem;
	font-weight: 500;
}

.qg-filter-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin: -6px;
	border: 0;
	background: none;
	cursor: pointer;
	color: var(--qg-color-ink);
	transition: opacity 0.2s var(--qg-ease);
}

.qg-filter-drawer__close:hover {
	opacity: 0.6;
}

.qg-filter-drawer__close .qg-icon {
	width: 15px;
	height: 15px;
}

.qg-filter-drawer__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: var(--qg-space-4);
}

.qg-filter-drawer__section {
	margin-bottom: var(--qg-space-5);
}

.qg-filter-drawer__section:last-child {
	margin-bottom: 0;
}

.qg-filter-drawer__section-title {
	font-family: var(--qg-font-heading);
	font-size: 0.95rem;
	font-weight: 700;
	margin: 0 0 var(--qg-space-3);
	color: var(--qg-color-ink);
}

.qg-filter-drawer__filters {
	padding-top: var(--qg-space-5);
	border-top: 1px solid var(--qg-color-line);
}

.qg-filter-drawer__footer {
	display: flex;
	gap: var(--qg-space-3);
	padding: var(--qg-space-3) var(--qg-space-4);
	padding-bottom: max(var(--qg-space-3), env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--qg-color-line);
	flex-shrink: 0;
}

.qg-filter-drawer__footer .qg-btn {
	flex: 1;
	justify-content: center;
}

/* Nova widget theming — restrained, matching the rest of the storefront's
   pill/rounded-input language rather than the plugin's own default styles. */

.qg-filter-widget {
	margin-bottom: var(--qg-space-5);
}

.qg-filter-widget:last-child {
	margin-bottom: 0;
}

.qg-filter-widget__title {
	font-family: var(--qg-font-heading);
	font-size: 0.95rem;
	font-weight: 700;
	margin: 0 0 var(--qg-space-3);
	color: var(--qg-color-ink);
}

.qg-filter-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.qg-filter-widget label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.86rem;
	color: var(--qg-color-ink-soft);
	cursor: pointer;
}

.qg-filter-widget input[type='checkbox'],
.qg-filter-widget input[type='radio'] {
	accent-color: var(--qg-color-ink);
	width: 15px;
	height: 15px;
}

@media (min-width: 640px) {
	.qg-filter-drawer__panel {
		width: min(320px, 40vw);
	}
}

@media (max-width: 639px) {
	.qg-filter-drawer__panel {
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		max-height: 82vh;
		border-radius: var(--qg-radius-lg) var(--qg-radius-lg) 0 0;
		transform: translateY(100%);
	}

	.qg-filter-drawer.is-open .qg-filter-drawer__panel {
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.qg-filter-drawer__backdrop,
	.qg-filter-drawer__panel {
		transition: none;
	}
}
