/*
 * Catalogue filter panel.
 *
 * Laid out as a horizontal band above the product grid so it works in the
 * theme's full-width archive templates, which have no sidebar on most pages.
 */

.ft-facets {
	--ft-accent: #168aa1;
	--ft-ink: #25364b;
	--ft-muted: #7c8998;
	--ft-line: #e7edf3;
	--ft-raised: #f7f9fa;

	margin: 0 0 1.75rem;
	padding: 1.1rem 1.25rem 0.9rem;
	color: var(--ft-ink);
	background: var(--ft-raised);
	border: 1px solid var(--ft-line);
	border-radius: 14px;
}

.ft-facets__head {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	margin-bottom: 0.9rem;
}

.ft-facets__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.4;
}

.ft-facets__clear {
	font-size: 0.8125rem;
	color: var(--ft-accent);
	text-decoration: none;
}

/* ----------------------------------------------------------------- groups */

.ft-facets__group {
	margin: 0 0 0.9rem;
	padding: 0;
	border: 0;
}

.ft-facets__legend {
	padding: 0;
	margin-bottom: 0.45rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--ft-muted);
}

.ft-facets__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ft-facets__option {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.35rem 0.75rem;
	font-size: 0.875rem;
	line-height: 1.5;
	background: #fff;
	border: 1px solid var(--ft-line);
	border-radius: 10px;
	cursor: pointer;
}

.ft-facets__option:hover {
	border-color: var(--ft-accent);
}

.ft-facets__option input {
	margin: 0;
	accent-color: var(--ft-accent);
}

.ft-facets__option:has(input:checked) {
	border-color: var(--ft-accent);
	box-shadow: inset 0 0 0 1px var(--ft-accent);
	color: #174c73;
}

.ft-facets__option-count {
	font-size: 0.75rem;
	color: var(--ft-muted);
}

/* An option that would return nothing stays visible and selectable — hiding it
   makes the list jump around as choices change — but is dimmed so the shopper
   can see at a glance which combinations are dead ends. */
.ft-facets__option.is-empty {
	opacity: 0.45;
}

/* ------------------------------------------------------------------ range */

.ft-facets__range {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.55rem;
}

.ft-facets__range input {
	width: 7rem;
	padding: 0.3rem 0.5rem;
	font-size: 0.875rem;
	background: #fff;
	border: 1px solid var(--ft-line);
	border-radius: 9px;
}

/* ---------------------------------------------------------------- actions */

.ft-facets__actions {
	margin-top: 0.3rem;
}

.ft-facets__apply {
	padding: 0.45rem 1.4rem;
	font-size: 0.9375rem;
	font-weight: 700;
	color: #fff;
	background: var(--ft-accent);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.ft-facets__apply:hover,
.ft-facets__apply:focus {
	background: #12758a;
}

@media (max-width: 480px) {
	.ft-facets {
		padding: 0.9rem 1rem;
	}

	.ft-facets__range input {
		width: 100%;
	}
}

/* ----------------------------------------------------------------- sidebar mode */

.ft-listing {
	margin: 10px 0 40px;
	width: 100%;
}

.ft-facets-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: 46px;
	margin: 0 0 14px;
	padding: 10px 18px;
	border: 1px solid #cbdce9;
	border-radius: 10px;
	background: #fff;
	color: #174f73;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.ft-facets-toggle > span {
	font-size: 17px;
	line-height: 1;
}

.ft-listing-layout {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	width: 100%;
}

.ft-filter-panel {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 18px 20px;
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ft-listing-results {
	min-width: 0;
	width: 100%;
}

.ft-facets--sidebar {
	background: none !important;
	border: none !important;
	padding: 0 !important;
	margin: 0 !important;
}

.ft-facets--sidebar .ft-facets__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 12px;
	border-bottom: 1px solid #e2e8f0;
	margin-bottom: 14px;
}

.ft-facets--sidebar .ft-facets__title {
	font-size: 16px !important;
	font-weight: 700 !important;
	color: #1e293b !important;
	margin: 0 !important;
}

.ft-facets--sidebar .ft-facets__clear {
	font-size: 12px !important;
	color: #168aa1 !important;
	text-decoration: none !important;
	font-weight: 600 !important;
}
.ft-facets--sidebar .ft-facets__clear:hover {
	text-decoration: underline !important;
}

.ft-facets--sidebar .ft-facets__group {
	margin: 0 0 16px !important;
	padding-bottom: 14px !important;
	border-bottom: 1px solid #f1f5f9 !important;
}

.ft-facets--sidebar .ft-facets__legend {
	font-size: 12.5px !important;
	font-weight: 700 !important;
	color: #475569 !important;
	margin-bottom: 8px !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
}

.ft-facets--sidebar .ft-facets__options {
	display: flex !important;
	flex-direction: column !important;
	flex-wrap: nowrap !important;
	gap: 2px !important;
	max-height: 232px !important;
	overflow-x: hidden !important;
	overflow-y: auto !important;
	overscroll-behavior: contain !important;
	scrollbar-width: thin !important;
	scrollbar-color: #94a3b8 #eef2f6 !important;
	padding-right: 6px !important;
	margin: 0 !important;
	list-style: none !important;
}

.ft-facets--sidebar .ft-facets__options::-webkit-scrollbar {
	width: 8px !important;
	height: 0 !important;
}

.ft-facets--sidebar .ft-facets__options::-webkit-scrollbar-track {
	background: #eef2f6 !important;
	border-radius: 8px !important;
}

.ft-facets--sidebar .ft-facets__options::-webkit-scrollbar-thumb {
	background: #94a3b8 !important;
	border-radius: 8px !important;
}

.ft-facets--sidebar .ft-facets__options::-webkit-scrollbar-thumb:hover {
	background: #64748b !important;
}

.ft-facets--sidebar .ft-facets__options li {
	margin: 0 !important;
	list-style: none !important;
}

.ft-facets--sidebar .ft-facets__option {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	padding: 5px 8px !important;
	font-size: 13px !important;
	line-height: 1.4 !important;
	background: transparent !important;
	border: none !important;
	border-radius: 6px !important;
	cursor: pointer !important;
	transition: background 0.15s ease !important;
	width: 100% !important;
	box-sizing: border-box !important;
}

.ft-facets--sidebar .ft-facets__option:hover {
	background: #f8fafc !important;
	color: #168aa1 !important;
}

.ft-facets--sidebar .ft-facets__option input {
	margin: 0 8px 0 0 !important;
	accent-color: #168aa1 !important;
	flex: none !important;
}

.ft-facets--sidebar .ft-facets__option-label {
	flex: 1 !important;
	text-align: left !important;
}

.ft-facets--sidebar .ft-facets__option-count {
	font-size: 11px !important;
	color: #64748b !important;
	background: #f1f5f9 !important;
	padding: 1px 6px !important;
	border-radius: 4px !important;
	margin-left: 6px !important;
	font-weight: 500 !important;
}

.ft-facets--sidebar .ft-facets__range {
	display: flex !important;
	align-items: center !important;
	gap: 6px !important;
	margin-top: 8px !important;
}

.ft-facets--sidebar .ft-facets__range input {
	width: 100% !important;
	min-width: 0 !important;
	padding: 6px 8px !important;
	font-size: 12.5px !important;
	border: 1px solid #cbd5e1 !important;
	border-radius: 6px !important;
}

.ft-facets--sidebar .ft-facets__actions {
	margin-top: 16px !important;
}

.ft-facets--sidebar .ft-facets__apply {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 100% !important;
	min-height: 44px !important;
	padding: 0 16px !important;
	line-height: 1 !important;
	text-align: center !important;
	font-size: 13.5px !important;
	font-weight: 700 !important;
	color: #fff !important;
	background: #168aa1 !important;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer !important;
	transition: background 0.15s ease !important;
}

.ft-facets--sidebar .ft-facets__apply:hover {
	background: #12758a !important;
}

/* Results grid inside sidebar layout */
.ft-listing-results .products {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: 20px !important;
	margin: 0 0 30px !important;
	width: 100% !important;
}

.ft-listing-results .products > div {
	width: 100% !important;
	max-width: 100% !important;
	flex: none !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.ft-listing-results .ft-facets__count {
	font-size: 15px !important;
	color: #64748b !important;
	margin: 0 0 16px !important;
}

.ft-listing-results .ft-facets__count strong {
	color: #0f172a !important;
	font-weight: 700 !important;
}

@media (max-width: 1280px) {
	.ft-listing-results .products {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 1199px) {
	.ft-listing > .ft-facets-toggle {
		display: inline-flex;
		width: 100%;
	}

	.ft-listing .ft-filter-panel {
		display: none !important;
		position: static !important;
		max-height: none !important;
		margin-bottom: 20px !important;
	}

	.ft-listing .ft-filter-panel.is-open {
		display: block !important;
	}
}

@media (max-width: 880px) {
	.ft-facets-toggle {
		display: inline-flex;
		width: 100%;
	}

	.ft-listing-layout {
		grid-template-columns: minmax(0, 1fr) !important;
	}
	.ft-listing .ft-filter-panel,
	.ft-facets-archive .ft-filter-panel--archive {
		display: none !important;
		position: static !important;
		max-height: none !important;
		margin-bottom: 20px !important;
	}
	.ft-listing .ft-filter-panel.is-open,
	.ft-facets-archive .ft-filter-panel--archive.is-open {
		display: block !important;
	}
	.ft-listing-results .products {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 12px !important;
	}
}

/* ------------------------------------------------- archive sidebar layout */

/*
 * On a product archive the panel is printed by woocommerce_archive_description,
 * which lands inside the theme's content wrapper (#jas-content > .jas-wc) just
 * before the .jas-container that holds the toolbar and the product loop. The
 * wrapper is turned into a two-column grid matching .ft-listing-layout.
 */
.ft-facets-archive #jas-content > .jas-wc {
	width: calc(100% - 40px);
	max-width: none;
	margin-top: 70px;
	margin-bottom: 60px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
	display: grid;
	grid-template-columns: 238px minmax(0, 1fr);
	gap: 26px;
	align-items: start;
}

.ft-facets-archive .jas-wc > .ft-filter-panel--archive {
	grid-column: 1;
	grid-row: 1;
	width: 100%;
	box-sizing: border-box;
}

/* Hide breadcrumb, duplicate top sidebar, and old drawer on archive */
.ft-facets-archive .woocommerce-breadcrumb,
.ft-facets-archive .shop-top-sidebar,
.ft-facets-archive .jas-filter-wrap {
	display: none !important;
}

/* The products wrapper takes column 2 */
.ft-facets-archive .jas-wc > .jas-full,
.ft-facets-archive .jas-wc > .jas-container {
	grid-column: 2;
	grid-row: 1;
	width: 100%;
	min-width: 0;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.ft-facets-archive .jas-wc > .jas-full > .jas-row {
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* Remove empty theme sidebar so products take 100% of the results column */
.ft-facets-archive .sidebar.jas-col-md-3 {
	display: none !important;
}

.ft-facets-archive .jas-col-md-9 {
	width: 100% !important;
	max-width: 100% !important;
	flex: 0 0 100% !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

/* Clean toolbar on archive */
.ft-facets-archive .result-count-order {
	margin: 0 0 16px 0 !important;
}

.ft-facets-archive .result-count-order .flex {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	width: 100% !important;
}

.ft-facets-archive .result-count-order .filter-trigger,
.ft-facets-archive .result-count-order .wc-col-switch {
	display: none !important;
}

.ft-facets-archive .result-count-order .ft-facets__count {
	margin: 0 !important;
	font-size: 15px !important;
	color: #64748b !important;
}

.ft-facets-archive .result-count-order .ft-facets__count strong {
	color: #0f172a !important;
	font-weight: 700 !important;
}

.ft-facets-archive .result-count-order .woocommerce-ordering {
	display: none !important;
}

.ft-facets-archive .result-count-order .woocommerce-ordering select {
	height: 38px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	padding: 0 12px;
	font-size: 13px;
	color: #334155;
	background: #fff;
}

.ft-facets-archive .ft-filter-panel--archive {
	background: #f7f9fa;
	border: 0;
	border-radius: 14px;
	padding: 20px;
	position: sticky;
	top: 20px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	box-shadow: none;
}

@media (min-width: 881px) {
	/* Claue's archive result wrapper carries an extra 30px top offset that the
	   shared /catalog/ listing does not. Neutralise it so count and first card
	   rows align exactly across every product archive. */
	.ft-facets-archive .jas-wc > .jas-full,
	.ft-facets-archive .jas-wc > .jas-container {
		margin-top: -30px;
	}
}

@media (max-width: 1150px) {
	.ft-facets-archive #jas-content > .jas-wc {
		width: calc(100% - 30px);
		grid-template-columns: 215px minmax(0, 1fr);
		gap: 18px;
	}
}

@media (max-width: 880px) {
	.ft-facets-archive #jas-content > .jas-wc {
		display: block;
		margin-top: 30px;
	}
	.ft-facets-archive #jas-content > .jas-wc > * {
		grid-column: auto;
	}
	.ft-facets-archive .ft-facets-toggle--archive {
		margin-bottom: 14px;
	}
	.ft-facets-archive .jas-wc > .jas-full,
	.ft-facets-archive .jas-wc > .jas-container {
		margin-top: 0;
	}
	.ft-facets-archive .ft-filter-panel--archive {
		display: none !important;
		position: static;
		max-height: none;
		margin-bottom: 20px;
	}
	.ft-facets-archive .ft-filter-panel--archive.is-open {
		display: block !important;
	}
}
