/* AF Live Search — widget + results panel. Colours and sizes come in as custom
   properties on the root (dashboard settings, per-widget overrides), so no
   CSS is generated per instance. Scoped to .afls; theme-proof structural
   rules are !important because Hello Elementor / WooCommerce style inputs
   and buttons globally. */
.afls {
	--afls-accent: #B4572F;
	--afls-accent-h: #93401D;
	--afls-text: #3E2F21;
	--afls-muted: #75614C;
	--afls-bg: #FDFAF3;
	--afls-pill: #F7F1E6;
	--afls-line: #E8DDC9;
	--afls-tint: #F5E6D4;
	--afls-hl: #F2E4C4;
	--afls-h: 46px;
	--afls-pill-r: 999px;
	--afls-panel-r: 20px;
	--afls-fs: 15px;
	--afls-img: 56px;
	--afls-toggle-bg: var(--afls-tint);
	--afls-ipad: 12px;   /* box edge → icon */
	--afls-igap: 8px;    /* icon → text */
	--afls-tsize: 40px;  /* mobile button */
	--afls-tm: 0px;      /* mobile button margin */
	--afls-tr: 2px;      /* mobile button radius */
	--afls-toggle-c: var(--afls-accent);
	--afls-panel-max: 70vh;
	--afls-sheet-gap: 8px;    /* phone: header bar → sheet */
	--afls-sheet-inset: 12px; /* phone: sheet → screen edges */
	--afls-font: var(--zh-font-sans, "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	position: relative;
	width: 100%;
	font-family: var(--afls-font);
	color: var(--afls-text);
	box-sizing: border-box;
}
.afls *, .afls *::before, .afls *::after { box-sizing: border-box; }
.afls-sr {
	position: absolute !important;
	width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.afls-form { position: relative; margin: 0; }

/* ---- the pill ---- */
.afls-pill {
	display: flex;
	align-items: center;
	min-height: var(--afls-h);
	background: var(--afls-pill);
	border: 1px solid var(--afls-line);
	border-radius: var(--afls-pill-r);
	overflow: hidden;
	transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.afls-pill:hover { border-color: var(--afls-muted); }
.afls-pill:focus-within {
	background: var(--afls-bg);
	border-color: var(--afls-accent);
	box-shadow: 0 0 0 1px var(--afls-accent);
}
.afls-input {
	flex: 1 1 auto !important;
	min-width: 0;
	height: calc(var(--afls-h) - 2px) !important;
	margin: 0 !important;
	padding: 0 22px 0 2px !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	outline: 0 !important;
	font: inherit !important;
	font-size: var(--afls-fs) !important;
	color: var(--afls-text) !important;
	-webkit-appearance: none;
	appearance: none;
}
.afls-input::placeholder { color: var(--afls-muted); opacity: 1; }
.afls-input::-webkit-search-cancel-button,
.afls-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.afls-submit,
.afls-toggle {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	margin: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	color: var(--afls-muted) !important;
	cursor: pointer;
	transition: color .15s, background-color .15s;
}
.afls-submit { width: auto; height: calc(var(--afls-h) - 2px); padding: 0 var(--afls-igap) 0 var(--afls-ipad) !important; }
.afls-submit:hover, .afls-submit:focus-visible { color: var(--afls-accent) !important; }
.afls-submit svg, .afls-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.afls-submit:focus-visible, .afls-toggle:focus-visible, .afls-chip:focus-visible, .afls-clear:focus-visible {
	outline: 2px solid var(--afls-accent) !important;
	outline-offset: 2px;
}
.afls.is-loading .afls-submit svg { animation: afls-pulse 1s ease-in-out infinite; }
@keyframes afls-pulse { 50% { opacity: .35; } }

/* ---- the mobile icon (hidden unless the breakpoint class is on) ---- */
.afls-toggle {
	display: none !important;
	width: var(--afls-tsize); height: var(--afls-tsize);
	margin: var(--afls-tm) !important;
	border-radius: var(--afls-tr) !important;
	background: var(--afls-toggle-bg) !important;
	color: var(--afls-toggle-c) !important;
}
.afls-toggle svg { width: 21px; height: 21px; }
/* a custom icon: an image, or an Elementor library icon (font or inline SVG) */
.afls-submit img.afls-ico, .afls-toggle img.afls-ico { width: 20px; height: 20px; object-fit: contain; }
.afls-toggle img.afls-ico { width: 22px; height: 22px; }
.afls-submit span.afls-ico, .afls-toggle span.afls-ico { display: inline-flex; font-size: 19px; line-height: 1; }
.afls-toggle span.afls-ico { font-size: 21px; }
.afls .afls-ico svg { width: 1em; height: 1em; fill: currentColor; }
.afls.is-mobile { width: auto; }
.afls.is-mobile .afls-toggle { display: inline-flex !important; }
.afls.is-mobile .afls-form { display: none; }
/* the panel: fixed under the header bar, full width, independent of any
   ancestor's positioning; --afls-top is measured by the script */
/* a rounded sheet under the header bar, inset from both edges */
.afls.is-mobile.is-open .afls-form {
	display: block;
	position: fixed;
	top: calc(var(--afls-top, 64px) + var(--afls-sheet-gap));
	left: var(--afls-sheet-inset);
	right: var(--afls-sheet-inset);
	z-index: 10000;
	padding: 10px 12px 12px;
	background: var(--afls-bg);
	border: 1px solid var(--afls-line);
	border-radius: var(--afls-panel-r);
	box-shadow: 0 2px 6px rgba(51, 38, 26, .07), 0 16px 36px rgba(51, 38, 26, .16);
}
.afls.is-mobile.is-open .afls-panel {
	position: static;
	margin-top: 10px;
	max-height: calc(100vh - var(--afls-top, 64px) - var(--afls-sheet-gap) - 112px);
	max-height: calc(100dvh - var(--afls-top, 64px) - var(--afls-sheet-gap) - 112px);
	padding: 4px 0 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* ---- the panel ---- */
.afls-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 10000;
	max-height: min(var(--afls-panel-max), 640px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 8px;
	background: var(--afls-bg);
	border: 1px solid var(--afls-line);
	border-radius: var(--afls-panel-r);
	box-shadow: 0 2px 6px rgba(51, 38, 26, .07), 0 12px 28px rgba(51, 38, 26, .12);
	text-align: left;
	scrollbar-width: thin;
	scrollbar-color: var(--afls-line) transparent;
}
.afls-panel[hidden] { display: none !important; }
.afls-panel::-webkit-scrollbar { width: 9px; }
.afls-panel::-webkit-scrollbar-thumb { background: var(--afls-line); border-radius: 99px; border: 2px solid var(--afls-bg); }
.afls-hint { margin: 6px 2px !important; font-size: 13px; line-height: 1.4; color: var(--afls-muted); }
.afls-hint b { color: var(--afls-text); font-weight: 600; }
.afls-clear {
	margin-left: 8px; padding: 0; border: 0; background: none;
	font: inherit; font-size: 12px; font-weight: 600; color: var(--afls-accent);
	text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.afls-dym { margin: 4px 2px 8px !important; font-size: 13px; color: var(--afls-muted); }
.afls-dym b { color: var(--afls-text); }
.afls-chips, .afls-cats { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 10px; }
.afls-chip {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 7px 14px; border: 0; border-radius: 999px;
	background: var(--afls-tint); color: var(--afls-accent-h);
	font: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer;
	transition: background-color .15s, color .15s;
}
.afls-chip:hover { background: var(--afls-accent); color: #fff; }
.afls-cat {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 8px 12px; border: 1px solid var(--afls-line); border-radius: 999px;
	font-size: 13px; font-weight: 600; color: var(--afls-text) !important; text-decoration: none !important;
	transition: background-color .15s, border-color .15s;
}
.afls-cat .n { color: var(--afls-muted); font-weight: 400; }
.afls-cat:hover, .afls-cat.is-active { background: var(--afls-tint); border-color: var(--afls-tint); }
.afls-list { display: block; }
/* a row is a grid: [thumbnail] name + meta | price. The price is its own
   column pinned to the right edge; on phones it drops under the name. */
.afls-item {
	display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; align-items: center;
	padding: 10px 8px; border-radius: 10px;
	color: var(--afls-text) !important; text-decoration: none !important;
	line-height: 1.35;
}
.afls-item.has-img { grid-template-columns: var(--afls-img) minmax(0, 1fr) auto; }
.afls-item:hover, .afls-item.is-active { background: var(--afls-tint); outline: 1px solid rgba(201, 162, 75, .45); }
.afls-item img { width: var(--afls-img); height: var(--afls-img); object-fit: cover; border-radius: 4px; background: var(--afls-tint); }
.afls-item .b { display: block; min-width: 0; }
.afls-item .t { display: block; font-weight: 600; font-size: var(--afls-fs); }
.afls-item .m { display: block; margin-top: 2px; font-size: 12.5px; color: var(--afls-muted); }
.afls-item .p { justify-self: end; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.25; }
.afls-item .p b { display: block; font-weight: 600; font-size: var(--afls-fs); }
.afls-item .p s { display: block; font-size: 12px; color: var(--afls-muted); }
/* phones: price under the name, bold, on its own line */
.afls.is-mobile .afls-item, .afls-panel.is-narrow .afls-item { grid-template-columns: minmax(0, 1fr); }
.afls.is-mobile .afls-item.has-img, .afls-panel.is-narrow .afls-item.has-img { grid-template-columns: var(--afls-img) minmax(0, 1fr); }
.afls.is-mobile .afls-item.has-img img, .afls-panel.is-narrow .afls-item.has-img img { grid-row: 1 / 3; }
.afls.is-mobile .afls-item .p, .afls-panel.is-narrow .afls-item .p { justify-self: start; text-align: left; margin-top: 3px; }
.afls.is-mobile .afls-item .p b, .afls-panel.is-narrow .afls-item .p b { display: inline; }
.afls.is-mobile .afls-item .p s, .afls-panel.is-narrow .afls-item .p s { display: inline; margin-right: 6px; }
.afls-item mark { background: var(--afls-hl); color: inherit; border-radius: 2px; padding: 0 1px; }
.afls-oos { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #8F2D1E; background: #F9E7E1; }
.afls-more { position: sticky; bottom: 0; }
.afls-all {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; margin-top: 8px; padding: 13px; border-radius: 12px;
	background: var(--afls-accent); color: #FFFFFF !important;
	font-size: 14px; font-weight: 600; text-decoration: none !important;
	transition: background-color .16s;
}
.afls-all:hover, .afls-all.is-active { background: var(--afls-accent-h); }
.afls-all svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.afls-empty { padding: 22px; text-align: center; font-size: 14px; color: var(--afls-muted); }
.afls-empty b { color: var(--afls-text); }
.afls-empty a { color: var(--afls-accent); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
	.afls *, .afls *::before, .afls *::after { transition: none !important; animation: none !important; }
}
@media print { .afls-panel { display: none !important; } }
