/* ==========================================================================
   ArcAI Smart Filters
   ========================================================================== */
:root {
	--asf-accent: #1a1a1a;
	--asf-accent-ink: #fff;
	--asf-ink: #1d1d1f;
	--asf-muted: #6e6e73;
	--asf-line: #e6e6e9;
	--asf-soft: #f5f5f7;
	--asf-bg: #fff;
	--asf-radius: 14px;
	--asf-shadow: 0 20px 60px rgba(0, 0, 0, .18);
	--asf-ease: cubic-bezier(.2, .8, .2, 1);
}

.asf, .asc { color: var(--asf-ink); font-size: 15px; line-height: 1.4; }
.asf *, .asc * { box-sizing: border-box; }
.asf button, .asc button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Toolbar ---------- */
.asf-toolbar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
	padding: 4px 0 18px;
}
.asf-open {
	display: inline-flex; align-items: center; gap: 8px;
	height: 42px; padding: 0 18px; border-radius: 999px;
	background: var(--asf-accent); color: var(--asf-accent-ink) !important;
	border: 0; font-weight: 600; letter-spacing: .01em;
	transition: transform .15s var(--asf-ease), opacity .15s;
}
.asf-open:hover { opacity: .9; }
.asf-open:active { transform: scale(.97); }
.asf-badge {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
	background: var(--asf-accent-ink); color: var(--asf-accent);
	font-size: 12px; font-weight: 700; display: inline-grid; place-items: center;
}
.asf-count { color: var(--asf-muted); font-size: 14px; }
.asf-sort { margin-left: auto; position: relative; }
.asf-sort select {
	appearance: none; -webkit-appearance: none;
	height: 42px; padding: 0 38px 0 16px; border-radius: 999px;
	border: 1px solid var(--asf-line); background: var(--asf-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23555' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
	font-size: 14px; color: var(--asf-ink); cursor: pointer; margin: 0;
}
.asf-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.asf-chip {
	display: inline-flex; align-items: center; gap: 6px;
	height: 32px; padding: 0 10px 0 14px; border-radius: 999px;
	background: var(--asf-soft); border: 1px solid var(--asf-line);
	font-size: 13px; font-weight: 500; text-decoration: none; color: var(--asf-ink);
	transition: background .15s, border-color .15s;
}
.asf-chip:hover { border-color: var(--asf-ink); }
.asf-chip svg { opacity: .55; }
.asf-chip--clear { background: transparent; border-color: transparent; text-decoration: underline; padding: 0 8px; color: var(--asf-muted); }

/* ---------- Panel (drawer) ---------- */
.asf-backdrop {
	position: fixed; inset: 0; z-index: 2147483000; background: rgba(0, 0, 0, .4);
	opacity: 0; transition: opacity .3s var(--asf-ease);
}
.asf.is-open .asf-backdrop { opacity: 1; }

.asf-panel {
	position: fixed; z-index: 2147483001; top: 0; right: 0; bottom: 0; text-align: left;
	width: min(420px, 92vw); background: var(--asf-bg);
	display: flex; flex-direction: column; box-shadow: var(--asf-shadow);
	transform: translateX(105%); transition: transform .38s var(--asf-ease);
	visibility: hidden;
}
.asf.is-open .asf-panel { transform: none; visibility: visible; }
body.asf-lock { overflow: hidden; }

.asf-panel__head {
	display: flex; align-items: center; gap: 12px;
	padding: 18px 20px; border-bottom: 1px solid var(--asf-line);
}
.asf-panel__head strong { font-size: 18px; }
.asf-reset { margin-left: auto; font-size: 13px; color: var(--asf-muted); text-decoration: underline; }
.asf-x { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--asf-soft); display: grid; place-items: center; }
.asf-reset + .asf-x { margin-left: 4px; }

.asf-panel__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 20px; margin: 0; }
.asf-panel__foot {
	display: flex; gap: 10px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--asf-line); background: var(--asf-bg);
}
.asf-btn {
	flex: 1; height: 48px; border-radius: 12px; border: 0;
	background: var(--asf-accent); color: var(--asf-accent-ink) !important;
	font-weight: 600; display: grid; place-items: center; text-decoration: none;
	transition: opacity .15s;
}
.asf-btn--ghost { flex: 0 0 auto; padding: 0 20px; background: var(--asf-soft); color: var(--asf-ink) !important; }
.asf-btn--ghost[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.asf.is-loading .asf-btn[data-asf-showbtn] { opacity: .6; }

/* Mobile: bottom sheet */
@media (max-width: 767px) {
	.asf-panel {
		top: auto; left: 0; width: 100%; max-height: 88vh; height: 88vh;
		border-radius: 20px 20px 0 0; transform: translateY(105%);
	}
	.asf-panel::before {
		content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px;
		margin-left: -20px; border-radius: 4px; background: var(--asf-line);
	}
	.asf-toolbar { gap: 8px; }
	.asf-count { order: 3; flex-basis: 100%; }
	.asf-chips { order: 4; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
	.asf-chips::-webkit-scrollbar { display: none; }
	.asf-chip { flex: 0 0 auto; }
	.asf-open, .asf-sort { flex: 1; }
	.asf-sort select { width: 100%; }
}

/* Sidebar layout (desktop: inline column, mobile: drawer) */
@media (min-width: 1024px) {
	.asf--sidebar .asf-open, .asf--sidebar .asf-backdrop { display: none !important; }
	.asf--sidebar .asf-panel {
		position: sticky; top: 100px; bottom: auto; right: auto; z-index: 1; width: auto; max-height: calc(100vh - 120px);
		transform: none; visibility: visible; box-shadow: none; background: transparent;
	}
	.asf--sidebar .asf-x, .asf--sidebar .asf-panel__foot { display: none; }
	.asf--sidebar .asf-panel__head { padding: 0 0 14px; }
	.asf--sidebar .asf-panel__body { padding: 0; }
	.asf--sidebar .asf-toolbar { padding-bottom: 8px; }
	.asf--sidebar .asf-sort { margin-left: 0; flex: 1 1 100%; order: -1; }
	.asf--sidebar .asf-sort select { width: 100%; }
	.asf--sidebar .asf-panel__head { border-bottom: 0; }
}

/* ---------- Groups ---------- */
.asf-group { border-bottom: 1px solid var(--asf-line); }
.asf-group:last-child { border-bottom: 0; }
.asf-group__title { margin: 0 !important; font-size: inherit !important; }
.asf-group__title button {
	width: 100%; display: flex; align-items: center; gap: 8px;
	padding: 18px 0; background: none; border: 0; text-align: left;
	font-weight: 600; font-size: 15px; letter-spacing: .01em;
}
.asf-group__n {
	min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
	background: var(--asf-accent); color: var(--asf-accent-ink); font-size: 11px; display: inline-grid; place-items: center;
}
.asf-chev { margin-left: auto; transition: transform .25s var(--asf-ease); opacity: .6; }
.asf-group.is-open .asf-chev { transform: rotate(180deg); }
.asf-group__body { padding: 0 0 18px; }

/* Toggles */
.asf-toggles { padding: 14px 0 6px; display: grid; gap: 4px; border-bottom: 1px solid var(--asf-line); }
.asf-switch { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; font-weight: 500; }
.asf-switch input { position: absolute; opacity: 0; pointer-events: none; }
.asf-switch__ui {
	position: relative; flex: 0 0 auto; width: 42px; height: 26px; border-radius: 999px;
	background: #d6d6db; transition: background .2s;
}
.asf-switch__ui::after {
	content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
	background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--asf-ease);
}
.asf-switch input:checked + .asf-switch__ui { background: var(--asf-accent); }
.asf-switch input:checked + .asf-switch__ui::after { transform: translateX(16px); }
.asf-switch input:focus-visible + .asf-switch__ui { outline: 2px solid var(--asf-accent); outline-offset: 2px; }
.asf-switch .asf-term__count { margin-left: auto; }

/* Term list */
.asf-search input {
	width: 100%; height: 40px; margin: 0 0 10px; padding: 0 14px;
	border: 1px solid var(--asf-line); border-radius: 10px; background: var(--asf-soft); font-size: 14px;
}
.asf-terms { list-style: none; margin: 0 !important; padding: 0 !important; }
.asf-terms li { margin: 0; padding: 0; list-style: none; }
.asf-terms li::before { display: none; }
.asf-term { display: flex; align-items: center; gap: 12px; cursor: pointer; position: relative; margin: 0; }
.asf-term input { position: absolute; opacity: 0; pointer-events: none; }
.asf-term.is-zero { opacity: .45; }

.asf-terms--list .asf-term { padding: 8px 0; }
.asf-terms--list .asf-term__box {
	flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #b9b9c0;
	display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.asf-terms--list .asf-term__box::after {
	content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px;
	transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .15s var(--asf-ease);
}
.asf-terms--list input:checked + .asf-term__box { background: var(--asf-accent); border-color: var(--asf-accent); }
.asf-terms--list input:checked + .asf-term__box::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.asf-terms--list .asf-term:hover .asf-term__box { border-color: var(--asf-ink); }
.asf-term input:focus-visible + .asf-term__box { outline: 2px solid var(--asf-accent); outline-offset: 2px; }
.asf-term__name { flex: 1; }
.asf-term__count { color: var(--asf-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Chips style */
.asf-terms--chips { display: flex; flex-wrap: wrap; gap: 8px; }
.asf-terms--chips .asf-term {
	padding: 8px 14px; border-radius: 999px; border: 1px solid var(--asf-line);
	background: var(--asf-bg); font-size: 14px; gap: 6px; transition: all .15s;
}
.asf-terms--chips .asf-term__box { display: none; }
.asf-terms--chips .asf-term__name { flex: 0 0 auto; }
.asf-terms--chips .asf-term:hover { border-color: var(--asf-ink); }
.asf-terms--chips .asf-term:has(input:checked) { background: var(--asf-accent); border-color: var(--asf-accent); color: var(--asf-accent-ink); }
.asf-terms--chips .asf-term:has(input:checked) .asf-term__count { color: inherit; opacity: .7; }
.asf-terms--chips .asf-term:has(input:focus-visible) { outline: 2px solid var(--asf-accent); outline-offset: 2px; }

.asf-more { margin-top: 6px; padding: 6px 0; background: none; border: 0; font-size: 14px; font-weight: 600; text-decoration: underline; }

/* Price */
.asf-price { padding: 6px 2px 0; }
.asf-range { position: relative; height: 28px; }
.asf-range__track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: var(--asf-line); }
.asf-range__fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--asf-accent); }
.asf-range input[type=range] {
	position: absolute; inset: 0; width: 100%; height: 28px; margin: 0; padding: 0;
	background: none; pointer-events: none; -webkit-appearance: none; appearance: none; border: 0;
}
.asf-range input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; height: 28px; }
.asf-range input[type=range]::-moz-range-track { background: none; border: 0; }
.asf-range input[type=range]::-webkit-slider-thumb {
	-webkit-appearance: none; pointer-events: auto; width: 24px; height: 24px; margin-top: 2px; border-radius: 50%;
	background: #fff; border: 2px solid var(--asf-accent); box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: grab;
}
.asf-range input[type=range]::-moz-range-thumb {
	pointer-events: auto; width: 20px; height: 20px; border-radius: 50%;
	background: #fff; border: 2px solid var(--asf-accent); box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: grab;
}
.asf-price__inputs { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
.asf-price__inputs label { flex: 1; display: grid; gap: 4px; font-size: 12px; color: var(--asf-muted); }
.asf-price__inputs input {
	width: 100%; height: 42px; padding: 0 12px; margin: 0; border: 1px solid var(--asf-line); border-radius: 10px;
	font-size: 15px; color: var(--asf-ink); background: var(--asf-bg); -moz-appearance: textfield;
}
.asf-price__sep { padding-bottom: 10px; color: var(--asf-muted); }
.asf-empty { color: var(--asf-muted); padding: 20px 0; }

/* Loading state on product grid */
.asf-grid-loading { position: relative; pointer-events: none; }
.asf-grid-loading > * { opacity: .35; transition: opacity .2s; }
.asf-grid-loading::after {
	content: ""; position: absolute; left: 50%; top: 120px; width: 34px; height: 34px; margin-left: -17px;
	border-radius: 50%; border: 3px solid var(--asf-line); border-top-color: var(--asf-accent);
	animation: asf-spin .7s linear infinite; z-index: 5;
}
@keyframes asf-spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Subcategory slider
   ========================================================================== */
.asc { margin: 0 0 24px; }
.asc__title { margin: 0 0 10px; font-weight: 600; }
.asc__viewport { position: relative; }
.asc__track {
	display: flex; gap: 14px; margin: 0 !important; padding: 4px 2px 10px !important; list-style: none;
	overflow-x: auto; scroll-snap-type: x proximity; scroll-behavior: smooth;
	scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.asc__track::-webkit-scrollbar { display: none; }
.asc__track.is-dragging { scroll-behavior: auto; scroll-snap-type: none; cursor: grabbing; }
.asc__track.is-dragging a { pointer-events: none; }
.asc__item { flex: 0 0 auto; scroll-snap-align: start; margin: 0; padding: 0; list-style: none; }
.asc__item::before { display: none; }
.asc__link { display: flex; text-decoration: none !important; color: var(--asf-ink) !important; -webkit-user-drag: none; }
.asc__link img { -webkit-user-drag: none; user-select: none; }

/* fades */
.asc__viewport::before, .asc__viewport::after {
	content: ""; position: absolute; top: 0; bottom: 10px; width: 48px; z-index: 2; pointer-events: none;
	opacity: 0; transition: opacity .2s;
}
.asc__viewport::before { left: 0; background: linear-gradient(90deg, var(--asf-bg), rgba(255,255,255,0)); }
.asc__viewport::after { right: 0; background: linear-gradient(270deg, var(--asf-bg), rgba(255,255,255,0)); }
.asc.can-prev .asc__viewport::before, .asc.can-next .asc__viewport::after { opacity: 1; }

.asc__arrow {
	position: absolute; top: 50%; z-index: 3; width: 40px; height: 40px; margin-top: -25px; border-radius: 50%;
	border: 1px solid var(--asf-line); background: var(--asf-bg); box-shadow: 0 4px 14px rgba(0,0,0,.12);
	display: grid; place-items: center; transition: transform .15s, opacity .2s;
}
.asc__arrow:hover { transform: scale(1.06); }
.asc__arrow--prev { left: -6px; }
.asc__arrow--next { right: -6px; }
@media (hover: none) { .asc__arrow { display: none !important; } }

/* Chips: same behaviour as mobile on every screen – no arrows over the pills,
   just swipe / drag / mouse wheel with soft edge fades. */
.asc--chips .asc__arrow { display: none !important; }
.asc--chips .asc__track { cursor: grab; padding-left: 2px !important; padding-right: 24px !important; }
.asc--chips .asc__viewport::before, .asc--chips .asc__viewport::after { width: 64px; }

/* Cards style */
.asc--cards .asc__link { flex-direction: column; align-items: center; gap: 8px; width: 112px; text-align: center; }
.asc--cards .asc__img {
	position: relative; width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
	background: var(--asf-soft); display: grid; place-items: center;
	box-shadow: 0 0 0 1px var(--asf-line); transition: box-shadow .2s, transform .25s var(--asf-ease);
}
.asc--cards .asc__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--asf-ease); }
.asc--cards .asc__link:hover .asc__img img { transform: scale(1.08); }
.asc--cards .asc__link:hover .asc__img { box-shadow: 0 0 0 2px var(--asf-ink); }
.asc--cards .is-current .asc__img { box-shadow: 0 0 0 3px var(--asf-accent); }
.asc--cards .is-current .asc__name { font-weight: 700; }
.asc__initial { font-size: 32px; font-weight: 700; color: var(--asf-muted); }
.asc__img--icon { background: var(--asf-bg) !important; box-shadow: inset 0 0 0 1.5px var(--asf-line) !important; }
.asc--cards .asc__name { font-size: 13px; font-weight: 500; line-height: 1.25; display: grid; gap: 2px; }
.asc__name small { font-size: 11px; color: var(--asf-muted); font-weight: 400; }
.asc--cards .asc__count { display: block; }

/* Chips style */
.asc--chips .asc__track { gap: 8px; }
.asc--chips .asc__link {
	align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
	border: 1px solid var(--asf-line); background: var(--asf-bg); font-size: 14px; font-weight: 500; white-space: nowrap;
	transition: border-color .15s, background .15s;
}
.asc--chips .asc__link:hover { border-color: var(--asf-ink); }
.asc--chips .asc__name { display: flex; align-items: center; gap: 6px; }
.asc--chips .asc__name small { order: -1; }
.asc--chips .asc__item--back .asc__name small { display: none; }
.asc--chips .asc__img--icon { display: grid; width: auto; height: auto; box-shadow: none !important; background: none !important; }
.asc--chips .is-current .asc__link { background: var(--asf-accent); border-color: var(--asf-accent); color: var(--asf-accent-ink) !important; }
.asc--chips .is-current .asc__count { color: inherit; opacity: .7; }
.asc--chips .asc__count { order: 2 !important; }
.asc--chips .asc__item--back .asc__link { background: var(--asf-soft); }

@media (max-width: 767px) {
	.asc__track { margin: 0 -16px !important; padding-left: 16px !important; padding-right: 16px !important; scroll-padding-left: 16px; gap: 10px; }
	.asc--cards .asc__link { width: 82px; }
	.asc--cards .asc__img { width: 72px; height: 72px; }
	.asc--cards .asc__name { font-size: 12px; }
	.asc__viewport::before, .asc__viewport::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.asf *, .asc * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.asf-noresults { padding: 60px 20px; text-align: center; color: var(--asf-muted); display: grid; justify-items: center; gap: 14px; }
.asf-noresults .asf-btn { flex: 0 0 auto; height: 44px; }
.asc__name small { vertical-align: baseline !important; position: static !important; top: auto !important; bottom: auto !important; line-height: 1 !important; }
.asc--chips .asc__count { align-self: center; margin-top: 1px; }

/* Theme isolation for the drawer (it lives directly in <body>) */
.asf-portal { color: var(--asf-ink); font-size: 15px; line-height: 1.4; text-align: left; }
.asf-panel label, .asf-panel .asf-term, .asf-panel .asf-term__name { text-align: left !important; justify-content: flex-start; margin: 0; }
.asf-panel .asf-term__name { flex: 1 1 auto; }
.asf-panel .asf-terms--chips .asf-term__name { flex: 0 0 auto; }
.asf-panel__head { position: relative; z-index: 2; background: var(--asf-bg); flex: 0 0 auto; }
.asf-panel__body > :first-child { margin-top: 0; }
@media (max-width: 767px) {
	.asf-panel { height: auto; max-height: calc(100dvh - 40px); }
	.asf-panel__head { padding-top: 24px; }
}

/* Category links in the filter panel */
.asf-cats { list-style: none; margin: 0 !important; padding: 0 !important; display: grid; gap: 2px; }
.asf-cats li { margin: 0; padding: 0; list-style: none; }
.asf-cats li::before { display: none; }
.asf-cat {
	display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin: 0 -10px; border-radius: 10px;
	color: var(--asf-ink) !important; text-decoration: none !important; transition: background .15s;
}
.asf-cat:hover { background: var(--asf-soft); }
.asf-cat__name { flex: 1 1 auto; text-align: left; }
.asf-cat__go { opacity: .4; flex: 0 0 auto; }
.asf-cat.is-current { background: var(--asf-accent); color: var(--asf-accent-ink) !important; font-weight: 600; }
.asf-cat.is-current .asf-term__count, .asf-cat.is-current .asf-cat__go { color: inherit; opacity: .7; }
