/* =============================================================================
   FYONLI — PRODUCT SEARCH BAND
   Full-width search section rendered directly below the primary navigation
   (storefront_before_content, priority 1 → the first block after </header>).

   Scoping note: every selector here is namespaced under .fy-searchbar or
   .fy-search-empty. Nothing reaches into .site-header, .col-full or any
   WooCommerce class, so this file cannot collide with style.css or
   woocommerce.css and adds no !important to a shared selector.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. THE BAND
   -------------------------------------------------------------------------- */

.fy-searchbar {
	width: 100%;
	box-sizing: border-box;
	background: linear-gradient(180deg, #fbf9f5 0%, #f5f1e8 100%);
	border-top: 1px solid #ece5d8;
	border-bottom: 1px solid #e4dbc9;
}

.fy-searchbar *,
.fy-searchbar *::before,
.fy-searchbar *::after {
	box-sizing: border-box;
}

/* The layout rules below set `display` on elements that are toggled with the
   `hidden` attribute. An author `display` always beats the UA sheet's
   `[hidden] { display: none }`, so restate it here at author level. */
.fy-searchbar [hidden] {
	display: none !important;
}

.fy-searchbar__inner {
	max-width: 1000px;
	margin: 0 auto;
	padding: 14px 24px;
}

/* --------------------------------------------------------------------------
   2. FIELD GROUP
   -------------------------------------------------------------------------- */

.fy-searchbar__form {
	position: relative;
	display: flex;
	align-items: stretch;
	width: 100%;
	margin: 0;
	background: #ffffff;
	border: 1.5px solid #e0d8c8;
	border-radius: 999px;
	box-shadow: 0 1px 2px rgba(17, 29, 7, 0.04), 0 6px 18px rgba(17, 29, 7, 0.05);
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.fy-searchbar__form:hover {
	border-color: #cfc4ac;
	box-shadow: 0 1px 2px rgba(17, 29, 7, 0.05), 0 8px 22px rgba(17, 29, 7, 0.08);
}

/* Focus ring lives on the group, not the input — the input's own outline is
   suppressed so the pill reads as one control. */
.fy-searchbar__form.is-focused {
	border-color: #2d4a0e;
	box-shadow: 0 0 0 3px rgba(246, 176, 30, 0.3), 0 8px 22px rgba(17, 29, 7, 0.09);
}

.fy-searchbar__field {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1 1 auto;
	min-width: 0;
	padding-left: 20px;
}

.fy-searchbar__icon {
	flex: 0 0 auto;
	color: #8d8570;
	pointer-events: none;
	transition: color 0.18s ease;
}

.fy-searchbar__form.is-focused .fy-searchbar__icon {
	color: #2d4a0e;
}

/* Descendant selector, not a bare class: Storefront styles `input[type="search"]`
   (0,1,1), which outranks `.fy-searchbar__input` (0,1,0) and was painting the
   field grey with an inset shadow and its own padding. */
.fy-searchbar .fy-searchbar__input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	height: 50px;
	margin: 0;
	padding: 0 8px 0 12px;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	font-family: 'Lato', sans-serif;
	font-size: 0.95rem;
	line-height: normal;
	letter-spacing: 0.015em;
	color: #1a2a0a;
	-webkit-appearance: none;
	appearance: none;
}

.fy-searchbar .fy-searchbar__input::placeholder {
	color: #9a927e;
	opacity: 1;
}

.fy-searchbar .fy-searchbar__input:focus {
	outline: none;
	background: transparent;
	box-shadow: none;
}

/* Kill the native WebKit clear affordance — we render our own. */
.fy-searchbar__input::-webkit-search-decoration,
.fy-searchbar__input::-webkit-search-cancel-button,
.fy-searchbar__input::-webkit-search-results-button {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.fy-searchbar__clear {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	margin-right: 6px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #efeadf;
	color: #6c6455;
	cursor: pointer;
	transition: background 0.16s ease, color 0.16s ease;
}

.fy-searchbar__clear:hover {
	background: #e2dacb;
	color: #2d4a0e;
}

.fy-searchbar__clear:focus-visible {
	outline: 2px solid #2d4a0e;
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. SUBMIT BUTTON
   -------------------------------------------------------------------------- */

.fy-searchbar__submit {
	/* ReviewX ships an unscoped `button { display: flex; width: 100% }` rule
	   (loaded only on single-product pages) that becomes this button's flex-basis
	   since `flex: 0 0 auto` alone doesn't declare `width` — same landmine as
	   `.fyonli-pill` in woocommerce.css. Explicit `width: auto` overrides it. */
	width: auto;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 122px;
	height: 50px;
	margin: -1.5px -1.5px -1.5px 6px;
	padding: 0 28px;
	border: 0;
	border-radius: 999px;
	background: #f6b01e;
	color: #1a2a0a;
	font-family: 'Lato', sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	line-height: 1;
	cursor: pointer;
	transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.fy-searchbar__submit:hover {
	background: #e9a20c;
	box-shadow: 0 4px 12px rgba(246, 176, 30, 0.42);
}

.fy-searchbar__submit:active {
	transform: translateY(1px);
	box-shadow: none;
}

.fy-searchbar__submit:focus-visible {
	outline: 2px solid #2d4a0e;
	outline-offset: 2px;
}

/* Icon is the mobile-only fallback for the text label. */
.fy-searchbar__submit-icon {
	display: none;
}

/* --------------------------------------------------------------------------
   4. AUTOCOMPLETE PANEL
   -------------------------------------------------------------------------- */

.fy-searchbar__panel {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	z-index: 9999;
	max-height: 60vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #ffffff;
	border: 1px solid #ece5d8;
	border-radius: 16px;
	box-shadow: 0 14px 42px rgba(17, 29, 7, 0.16);
	padding: 6px;
}

.fy-searchbar__panel[hidden] {
	display: none;
}

/* `a.` qualifiers throughout this block are deliberate. Elementor's global kit
   ships `.elementor-kit-271 a { color: var(--e-global-color-accent) }` at
   specificity (0,1,1), which beats a bare `.fy-searchbar__item` (0,1,0) and was
   painting every link in the panel terracotta. */
.fy-searchbar a.fy-searchbar__item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 9px 12px;
	border-radius: 11px;
	text-decoration: none;
	color: #1a2a0a;
	transition: background 0.14s ease;
}

.fy-searchbar a.fy-searchbar__item:hover,
.fy-searchbar a.fy-searchbar__item:focus,
.fy-searchbar a.fy-searchbar__item.is-active {
	background: #f7f3ea;
	text-decoration: none;
	color: #1a2a0a;
}

.fy-searchbar__thumb {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: 9px;
	object-fit: cover;
	background: #f5f1e8;
	border: 1px solid #efe9dc;
}

.fy-searchbar__meta {
	flex: 1 1 auto;
	min-width: 0;
}

.fy-searchbar__name {
	display: block;
	font-family: 'Lato', sans-serif;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.35;
	color: #1a2a0a;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fy-searchbar__name mark {
	background: transparent;
	color: #2d4a0e;
	font-weight: 800;
	padding: 0;
}

.fy-searchbar__price {
	display: block;
	margin-top: 3px;
	font-family: 'Lato', sans-serif;
	font-size: 0.82rem;
	font-weight: 600;
	color: #6d7a54;
}

.fy-searchbar__oos {
	display: inline-block;
	margin-left: 8px;
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #a8624a;
	vertical-align: middle;
}

.fy-searchbar a.fy-searchbar__all {
	display: block;
	margin: 4px 0 0;
	padding: 12px;
	border-top: 1px solid #f0ebe0;
	font-family: 'Lato', sans-serif;
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-align: center;
	color: #2d4a0e;
	text-decoration: none;
	border-radius: 0 0 11px 11px;
	transition: background 0.14s ease;
}

.fy-searchbar a.fy-searchbar__all:hover,
.fy-searchbar a.fy-searchbar__all:focus,
.fy-searchbar a.fy-searchbar__all.is-active {
	background: #f7f3ea;
	color: #2d4a0e;
	text-decoration: none;
}

/* --- panel: loading + empty ------------------------------------------------ */

.fy-searchbar__loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 22px 12px;
	font-family: 'Lato', sans-serif;
	font-size: 0.85rem;
	color: #8d8570;
}

.fy-searchbar__spinner {
	width: 15px;
	height: 15px;
	border: 2px solid #e6dfd0;
	border-top-color: #2d4a0e;
	border-radius: 50%;
	animation: fySearchSpin 0.7s linear infinite;
}

@keyframes fySearchSpin {
	to { transform: rotate(360deg); }
}

.fy-searchbar__none {
	padding: 26px 20px 22px;
	text-align: center;
}

.fy-searchbar__none-title {
	margin: 0 0 6px;
	font-family: 'Playfair Display', serif;
	font-size: 1.06rem;
	font-weight: 400;
	color: #1a2a0a;
}

.fy-searchbar__none-text {
	margin: 0 0 16px;
	font-family: 'Lato', sans-serif;
	font-size: 0.84rem;
	line-height: 1.5;
	color: #7d7666;
}

.fy-searchbar a.fy-searchbar__browse {
	display: inline-block;
	padding: 11px 26px;
	border-radius: 999px;
	background: #2d4a0e;
	color: #ffffff;
	font-family: 'Lato', sans-serif;
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background 0.18s ease, box-shadow 0.18s ease;
}

.fy-searchbar a.fy-searchbar__browse:hover,
.fy-searchbar a.fy-searchbar__browse:focus,
.fy-searchbar a.fy-searchbar__browse.is-active {
	background: #1f350a;
	color: #ffffff;
	text-decoration: none;
	box-shadow: 0 4px 14px rgba(45, 74, 14, 0.28);
}

/* --------------------------------------------------------------------------
   5. RESULTS-PAGE EMPTY STATE
   -------------------------------------------------------------------------- */

.fy-search-empty {
	max-width: 520px;
	margin: 48px auto 64px;
	padding: 0 20px;
	text-align: center;
	color: #b3aa95;
}

.fy-search-empty__title {
	margin: 18px 0 10px;
	font-family: 'Playfair Display', serif;
	font-size: 1.6rem;
	font-weight: 400;
	color: #1a2a0a;
}

.fy-search-empty__text {
	margin: 0 0 24px;
	font-family: 'Lato', sans-serif;
	font-size: 0.94rem;
	line-height: 1.65;
	color: #6f6857;
}

.fy-search-empty a.fy-search-empty__btn {
	display: inline-block;
	padding: 13px 34px;
	border-radius: 999px;
	background: #2d4a0e;
	color: #ffffff;
	font-family: 'Lato', sans-serif;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background 0.18s ease, box-shadow 0.18s ease;
}

.fy-search-empty a.fy-search-empty__btn:hover,
.fy-search-empty a.fy-search-empty__btn:focus {
	background: #1f350a;
	color: #ffffff;
	text-decoration: none;
	box-shadow: 0 5px 16px rgba(45, 74, 14, 0.3);
}

/* --------------------------------------------------------------------------
   6. TABLET
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) and (min-width: 769px) {
	.fy-searchbar__inner {
		max-width: 100%;
		padding: 12px 24px;
	}
}

/* --------------------------------------------------------------------------
   7. MOBILE  (matches the theme's 768px breakpoint)
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
	/* The one deliberate rule in this file outside the .fy-searchbar namespace.
	   style.css hides Storefront's built-in header search only inside its
	   `min-width: 769px` block, so below that the stock widget was still
	   rendering — overlapping the cart icon, and now sitting directly above a
	   second, better search. Hiding it removes both problems. */
	.site-header .site-search {
		display: none !important;
	}

	.fy-searchbar__inner {
		max-width: 100%;
		padding: 10px 14px;
	}

	.fy-searchbar__form {
		border-radius: 12px;
		box-shadow: 0 1px 2px rgba(17, 29, 7, 0.05);
	}

	.fy-searchbar__field {
		padding-left: 13px;
	}

	/* Must match the specificity of the base rule above (which is raised to
	   `.fy-searchbar .fy-searchbar__input` to outrank Storefront's
	   `input[type="search"]`) — a media query does not add specificity, so a
	   bare class here would silently lose and leave the field 50px tall inside
	   a 44px button row. */
	.fy-searchbar .fy-searchbar__input {
		height: 44px;
		padding-left: 9px;
		/* 16px prevents iOS Safari from zooming the viewport on focus, which
		   would otherwise register as a layout shift. */
		font-size: 16px;
	}

	.fy-searchbar__submit {
		min-width: 0;
		height: 44px;
		padding: 0 16px;
		margin: -1.5px -1.5px -1.5px 4px;
		border-radius: 12px;
		gap: 0;
	}

	.fy-searchbar__panel {
		top: calc(100% + 8px);
		border-radius: 12px;
		max-height: 62vh;
	}

	.fy-searchbar__thumb {
		width: 46px;
		height: 46px;
	}

	.fy-searchbar__name {
		font-size: 0.86rem;
	}
}

/* Very narrow phones: drop the word, keep the icon — the button stays a
   44px-square tap target and the input keeps its usable width. */
@media (max-width: 400px) {
	.fy-searchbar__submit {
		width: 44px;
		padding: 0;
	}

	.fy-searchbar__submit-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.fy-searchbar__submit-icon {
		display: block;
	}
}

/* --------------------------------------------------------------------------
   8. MOTION PREFERENCES
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.fy-searchbar__form,
	.fy-searchbar__submit,
	.fy-searchbar__item,
	.fy-searchbar__clear,
	.fy-searchbar__browse,
	.fy-search-empty__btn {
		transition: none;
	}

	.fy-searchbar__spinner {
		animation: none;
	}
}
