/**
 * Header/mobile search — autocomplete dropdown (Phase 11B). Desktop is a
 * toggle button + an absolutely-positioned panel under the header bar
 * (same visual language as the mega menu); mobile is an always-visible
 * inline block inside the mobile nav panel (region-selector.css/
 * theme-toggle's own desktop/mobile split, same reasoning).
 */

.k-search--desktop {
	position: relative;
	display: flex;
	align-items: center;
}

/* The desktop utility bar (Search/Account/Saved/Cart) doesn't fit its own
   content at phone widths — same overflow class the theme toggle and
   region selector already solve this exact way (see header.css/
   region-selector.css's own max-width: 899px rule): the header copy hides,
   the mobile nav panel's always-visible copy (.k-search--mobile) is the
   reachable control below this width instead. */
@media (max-width: 899px) {
	.k-header__utility .k-search--desktop {
		display: none;
	}
}

/* Typography (11px/500/uppercase/tracked) comes from the k-nav-link class
   on the element (search-form.php), same as .k-theme-toggle/.k-header__nav-
   link — not inherit: .k-header__utility deliberately carries no typography
   of its own so it doesn't also reach the search input/results below. */
.k-search__toggle {
	background: none;
	border: 0;
	padding: 6px 0;
	margin: 0;
	color: inherit;
	cursor: pointer;
	border-bottom: 1px solid transparent;
	transition: border-color var(--k-duration-base), color var(--k-duration-base);
}

.k-search__toggle:hover,
.k-search__toggle:focus-visible,
.k-search__toggle[aria-expanded="true"] {
	border-bottom-color: var(--k-color-accent);
	color: var(--k-color-accent);
}

.k-search--desktop .k-search__panel {
	position: absolute;
	top: calc(100% + 14px);
	right: 0;
	width: min(420px, 90vw);
	background: var(--k-color-bg);
	border: 1px solid var(--k-border-hairline);
	box-shadow: 0 24px 48px rgba(10, 10, 9, 0.18);
	z-index: var(--k-z-mega-menu);
	padding: 16px;
}

.k-search--mobile .k-search__panel {
	margin-top: 28px;
}

.k-search__form {
	display: flex;
	align-items: center;
	gap: 10px;
	border-bottom: 1px solid var(--k-border-hairline-strong);
	padding-bottom: 10px;
}

.k-search__input {
	flex: 1 1 auto;
	min-width: 0;
	background: none;
	border: 0;
	font-family: var(--k-font-sans);
	font-size: var(--k-text-body);
	color: var(--k-color-text);
}

.k-search__input::placeholder {
	color: var(--k-color-muted-2);
}

.k-search__input:focus {
	outline: none;
}

.k-search__submit,
.k-search__close {
	background: none;
	border: 0;
	padding: 4px;
	margin: 0;
	color: var(--k-color-muted-2);
	cursor: pointer;
	flex: 0 0 auto;
}

.k-search__submit:hover,
.k-search__submit:focus-visible,
.k-search__close:hover,
.k-search__close:focus-visible {
	color: var(--k-color-accent);
}

/* Minimal, dependency-free glyphs — no icon font/SVG sprite in this theme,
   consistent with the plain-text utility links (Search/Account/Cart) this
   replaces. */
.k-search__submit::before {
	content: "↵";
}

.k-search__close::before {
	content: "×";
	font-size: 18px;
	line-height: 1;
}

.k-search__results {
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
	max-height: 60vh;
	overflow-y: auto;
}

.k-search__result + .k-search__result,
.k-search__view-all {
	border-top: 1px solid var(--k-border-hairline);
}

.k-search__result-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 4px;
	color: inherit;
}

.k-search__result.is-active .k-search__result-link,
.k-search__result-link:hover {
	background: var(--k-color-hover-tint);
}

.k-search__result-image {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: cover;
	background: var(--k-color-surface-light);
}

.k-search__result-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.k-search__result-name {
	font-size: var(--k-text-body-sm);
	color: var(--k-color-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.k-search__result-category {
	font-size: 11px;
	letter-spacing: var(--k-tracking-label);
	text-transform: uppercase;
	color: var(--k-color-muted-2);
}

.k-search__result-price {
	font-size: var(--k-text-body-sm);
	color: var(--k-color-muted-1);
}

.k-search__result-price ins {
	color: var(--k-color-accent);
	text-decoration: none;
}

.k-search__result-price del {
	color: var(--k-color-muted-3);
	opacity: .8;
}

.k-search__result-stock {
	font-size: 11px;
	letter-spacing: var(--k-tracking-label);
	text-transform: uppercase;
	color: var(--k-color-danger);
}

.k-search__empty {
	padding: 16px 4px;
	font-size: var(--k-text-body-sm);
	color: var(--k-color-muted-2);
	text-align: center;
}

.k-search__view-all {
	padding-top: 4px;
}

.k-search__view-all a {
	display: block;
	padding: 10px 4px;
	font-size: 11px;
	letter-spacing: var(--k-tracking-label);
	text-transform: uppercase;
	color: var(--k-color-accent);
	text-align: center;
}

.k-search__view-all a:hover,
.k-search__view-all a:focus-visible {
	text-decoration: underline;
}

/* Full results page heading (search-results.php) — reuses .k-shop-grid/
   .k-shop-pagination/.k-shop-empty from shop.css for the grid itself. */
.k-search-results__header {
	padding: clamp(32px, 5vw, 64px) var(--k-gutter) 0;
}

.k-search-results__header h1 {
	margin-top: 8px;
}
