/**
 * AF Commerce — marketplace horizontal filter chip bar + LAAM-style popovers.
 */

.af-filter-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-block: 14px;
	margin-bottom: 8px;
	border-block-start: 1px solid var(--af-border, #ebebeb);
	border-block-end: 1px solid var(--af-border, #ebebeb);
}

.af-filter-bar__icon {
	flex: none;
	display: grid;
	place-items: center;
	position: relative;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fff;
	color: #111;
	cursor: pointer;
}

.af-filter-bar__icon:hover {
	border-color: #ccc;
}

.af-filter-bar__count {
	position: absolute;
	inset-block-start: -5px;
	inset-inline-end: -5px;
	display: grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding-inline: 4px;
	border-radius: 999px;
	background: var(--af-accent, #111);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
}

.af-filter-bar__scroll {
	flex: none;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 1px solid #e5e5e5;
	border-radius: 50%;
	background: #fff;
	color: #111;
	cursor: pointer;
}

.af-filter-bar__scroll:hover {
	border-color: #ccc;
}

.af-filter-bar__scroll[hidden] {
	display: none;
}

.af-filter-bar__track {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	min-width: 0;
	overflow-x: auto;
	overflow-y: visible;
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-behavior: smooth;
	padding-block: 2px;
}

.af-filter-bar__track::-webkit-scrollbar {
	display: none;
}

.af-filter-chip {
	flex: none;
	position: relative;
	margin: 0;
}

.af-filter-chip__btn,
.af-filter-chip--stock {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 40px;
	padding: 8px 14px;
	border: 1px solid #e5e5e5;
	border-radius: 10px;
	background: #fff;
	color: #111;
	font-family: var(--af-font-body, inherit);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	list-style: none;
}

.af-filter-chip__btn::-webkit-details-marker {
	display: none;
}

.af-filter-chip__btn .af-icon,
.af-filter-chip--stock .af-icon {
	width: 12px;
	height: 12px;
	color: #888;
	transition: transform 0.15s ease;
}

.af-filter-chip[open] > .af-filter-chip__btn .af-icon {
	transform: rotate(180deg);
}

.af-filter-chip__btn:hover,
.af-filter-chip--stock:hover,
.af-filter-chip.is-active > .af-filter-chip__btn,
.af-filter-chip--stock.is-active,
.af-filter-chip[open] > .af-filter-chip__btn {
	border-color: #cfcfcf;
}

.af-filter-chip.is-active > .af-filter-chip__btn,
.af-filter-chip--stock.is-active,
.af-filter-chip[open] > .af-filter-chip__btn {
	background: #f7f7f7;
}

.af-filter-chip__switch {
	display: inline-flex;
	align-items: center;
	width: 34px;
	height: 20px;
	padding: 2px;
	border: 1px solid #ddd;
	border-radius: 999px;
	background: #f3f3f3;
	box-sizing: border-box;
}

.af-filter-chip__switch-knob {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
	transition: transform 0.15s ease;
}

.af-filter-chip--stock.is-active .af-filter-chip__switch {
	background: #111;
	border-color: #111;
}

.af-filter-chip--stock.is-active .af-filter-chip__switch-knob {
	transform: translateX(14px);
}

[dir="rtl"] .af-filter-chip--stock.is-active .af-filter-chip__switch-knob {
	transform: translateX(-14px);
}

/* -------------------------------------------------------------------------
 * Popover panels (fixed via JS so overflow-x on the track cannot clip them)
 * ---------------------------------------------------------------------- */

.af-filter-chip__panel {
	position: absolute;
	inset-block-start: calc(100% + 8px);
	inset-inline-start: 0;
	z-index: 80;
	display: none;
	width: min(340px, calc(100vw - 24px));
	max-height: min(420px, 70vh);
	overflow: hidden;
	padding: 0;
	border: 1px solid #e8e8e8;
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
	box-sizing: border-box;
}

.af-filter-chip[open] > .af-filter-chip__panel,
.af-filter-chip__panel.is-placed {
	display: flex;
	flex-direction: column;
}

.af-filter-chip__panel.is-placed {
	position: fixed;
	inset: auto;
	margin: 0;
}

.af-filter-chip__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: none;
	padding: 14px 16px 10px;
}

.af-filter-chip__heading {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: #111;
}

.af-filter-chip__close {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #111;
	cursor: pointer;
}

.af-filter-chip__close:hover {
	background: #f3f3f3;
}

.af-filter-chip__close .af-icon {
	width: 16px;
	height: 16px;
}

.af-filter-chip__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	padding: 0 12px 14px;
}

.af-filter-chip__search {
	width: 100%;
	margin-bottom: 10px;
	min-height: 40px;
	padding: 8px 12px;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	font-size: 13px;
}

.af-filter-chip__list,
.af-filter-chip__options {
	margin: 0;
	padding: 0;
	list-style: none;
}

.af-filter-chip__choice,
.af-filter-chip__link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 8px;
	border-radius: 8px;
	color: #222;
	font-size: 13px;
	text-decoration: none;
}

.af-filter-chip__choice:hover,
.af-filter-chip__link:hover,
.af-filter-chip__choice.is-active,
.af-filter-chip__link.is-active {
	background: #f5f5f5;
}

.af-filter-chip__check {
	flex: none;
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border: 1px solid #ccc;
	border-radius: 4px;
	color: transparent;
	background: #fff;
}

.af-filter-chip__choice.is-active .af-filter-chip__check {
	border-color: #111;
	background: #111;
	color: #fff;
}

.af-filter-chip__check .af-icon {
	width: 12px;
	height: 12px;
}

.af-filter-chip__swatch {
	flex: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #eee;
}

.af-filter-chip__choice-label {
	flex: 1 1 auto;
	min-width: 0;
}

.af-filter-chip__choice-count {
	flex: none;
	color: #999;
	font-size: 12px;
}

/* Sort panel keeps a simple list. */
.af-filter-chip--sort .af-filter-chip__link {
	display: block;
}

/* -------------------------------------------------------------------------
 * Price popover
 * ---------------------------------------------------------------------- */

.af-price-pop {
	display: grid;
	gap: 18px;
	padding-top: 4px;
}

.af-price-pop__fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.af-price-pop__field {
	display: grid;
	gap: 6px;
	margin: 0;
	font-weight: 400;
}

.af-price-pop__label {
	font-size: 12px;
	color: #666;
}

.af-price-pop__field input {
	width: 100%;
	min-height: 42px;
	padding: 8px 12px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	font-size: 14px;
	color: #111;
	box-sizing: border-box;
}

.af-price-pop__slider {
	position: relative;
	height: 28px;
	margin: 4px 4px 0;
}

.af-price-pop__rail {
	position: absolute;
	inset-inline: 0;
	inset-block-start: 50%;
	height: 4px;
	margin-top: -2px;
	border-radius: 999px;
	background: #e8e8e8;
}

.af-price-pop__fill {
	position: absolute;
	inset-block: 0;
	border-radius: inherit;
	background: #111;
}

.af-price-pop__range {
	position: absolute;
	inset-inline: 0;
	inset-block-start: 50%;
	width: 100%;
	margin: 0;
	transform: translateY(-50%);
	appearance: none;
	background: transparent;
	pointer-events: none;
	height: 28px;
}

.af-price-pop__range::-webkit-slider-thumb {
	appearance: none;
	width: 18px;
	height: 18px;
	border: 2px solid #111;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	pointer-events: auto;
	cursor: pointer;
}

.af-price-pop__range::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: 2px solid #111;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
	pointer-events: auto;
	cursor: pointer;
}

.af-price-pop__range::-webkit-slider-runnable-track {
	height: 4px;
	background: transparent;
}

.af-price-pop__range::-moz-range-track {
	height: 4px;
	background: transparent;
}

.af-price-pop__actions {
	display: grid;
	grid-template-columns: 96px 1fr;
	gap: 10px;
}

.af-price-pop__reset,
.af-price-pop__apply {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	box-sizing: border-box;
}

.af-price-pop__reset {
	border: 1px solid #e0e0e0;
	background: #fff;
	color: #111;
}

.af-price-pop__apply {
	border: 1px solid #111;
	background: #111;
	color: #fff;
}

.af-price-pop__apply:hover {
	opacity: 0.9;
}

/* Chip bar owns the Filters entry point — hide the full-width trigger. */
.af-shop--chip-bar .af-filters-trigger {
	display: none !important;
}

.af-shop--chip-bar .af-toolbar__controls .woocommerce-ordering {
	display: none;
}
