/* Випадайка пошуку. Розмітку будує search.js.

   Тема має свої правила для button і a всередині шапки, і вони перебивають
   звичайну специфічність — там, де це важливо для вигляду, стоїть !important. */

.sh-sd-host {
	position: relative;
}

/* Штатний контейнер підказок теми — на випадок, якщо ajax колись увімкнуть назад. */
.wd-search-form .wd-search-results-wrapper {
	display: none !important;
}

.sh-sd[hidden] {
	display: none !important;
}

.sh-sd {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 500;
	display: flex;
	flex-direction: column;
	width: 520px;
	max-width: calc(100vw - 24px);
	border-radius: var(--sh-r-xl, 16px);
	background: var(--sh-surface, #fff);
	box-shadow: 0 24px 60px -16px rgba(14, 27, 43, .35), 0 2px 8px rgba(14, 27, 43, .08);
	overflow: hidden;
	font-family: var(--sh-font, Manrope, system-ui, sans-serif);
	text-align: start;
	animation: sh-sd-in .16s ease-out;
}

@keyframes sh-sd-in {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sh-sd {
		animation: none;
	}
}

/* Поки летить відповідь, старий список лишається — просто пригашений. */
.sh-sd.is-busy .sh-sd-list,
.sh-sd.is-busy .sh-sd-chips {
	opacity: .55;
}

/* ── Шапка ───────────────────────────────────────────────────────── */

.sh-sd-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px 10px;
}

.sh-sd-cap {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .1em;
	line-height: 1.2;
	color: var(--sh-muted, #8b93a5);
}

.sh-sd-total {
	flex: none;
	font-family: var(--sh-font-mono, ui-monospace, monospace);
	font-size: 11px;
	color: var(--sh-muted, #8b93a5);
}

/* ── Плитки категорій ────────────────────────────────────────────── */

.sh-sd-cats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	padding: 4px 18px 16px;
}

.sh-sd .sh-sd-cat {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 9px;
	min-height: 0 !important;
	padding: 14px 8px 12px !important;
	border: 1px solid var(--sh-brd, #e4e7ee) !important;
	border-radius: 14px !important;
	background: var(--sh-surface, #fff) !important;
	color: var(--sh-text, #46506a) !important;
	font-family: inherit;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: background .14s, border-color .14s, color .14s;
}

.sh-sd .sh-sd-cat svg {
	width: 26px;
	height: 26px;
	color: var(--sh-accent, #2f6bf3);
}

.sh-sd .sh-sd-cat span {
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
}

.sh-sd .sh-sd-cat:hover {
	border-color: var(--sh-ink, #14203a) !important;
	color: var(--sh-ink, #14203a) !important;
}

.sh-sd .sh-sd-cat.is-on {
	border-color: var(--sh-ink, #14203a) !important;
	background: var(--sh-ink, #14203a) !important;
	color: #fff !important;
}

.sh-sd .sh-sd-cat.is-on svg {
	color: #93c5fd;
}

/* ── Знайдене ────────────────────────────────────────────────────── */

.sh-sd-list {
	max-height: 396px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.sh-sd .sh-sd-item {
	display: grid;
	grid-template-columns: 64px 1fr auto;
	align-items: center;
	gap: 14px;
	padding: 12px 18px;
	border-top: 1px solid var(--sh-brd-faint, #eef0f5);
	color: var(--sh-text, #46506a);
	text-decoration: none;
}

.sh-sd .sh-sd-item:hover,
.sh-sd .sh-sd-item.is-cur {
	background: #f7f9fb;
	color: var(--sh-text, #46506a);
}

.sh-sd-pic {
	display: block;
	width: 64px;
	height: 64px;
	border-radius: 10px;
	background: #f4f6f9;
	overflow: hidden;
}

.sh-sd-pic img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sh-sd-mid {
	display: block;
	min-width: 0;
}

.sh-sd-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.4;
}

.sh-sd-hit {
	border-radius: 3px;
	background: #e8f7ee;
	font-weight: 800;
	color: var(--sh-ink, #14203a);
}

.sh-sd-meta {
	display: block;
	margin-top: 5px;
	font-family: var(--sh-font-mono, ui-monospace, monospace);
	font-size: 11px;
	color: var(--sh-muted, #8b93a5);
}

.sh-sd-right {
	display: block;
	text-align: end;
}

.sh-sd-price {
	display: block;
	font-family: var(--sh-font-mono, ui-monospace, monospace);
	font-size: 15px;
	font-weight: 700;
	color: var(--sh-ink, #14203a);
	white-space: nowrap;
}

.sh-sd-cur {
	font-size: 11px;
	font-weight: 500;
	color: var(--sh-muted, #8b93a5);
}

.sh-sd-stock {
	display: block;
	margin-top: 4px;
	font-size: 11px;
	font-weight: 600;
	color: var(--sh-badge-new, #16a34a);
	white-space: nowrap;
}

.sh-sd-stock.is-off {
	color: var(--sh-muted, #8b93a5);
}

.sh-sd-none {
	padding: 34px 18px 40px;
	border-top: 1px solid var(--sh-brd-faint, #eef0f5);
	text-align: center;
}

.sh-sd-none-t {
	font-size: 15px;
	font-weight: 700;
	color: var(--sh-ink, #14203a);
}

.sh-sd-none-s {
	margin-top: 6px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--sh-muted, #8b93a5);
}

/* ── Швидкі фільтри ──────────────────────────────────────────────── */

.sh-sd-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 18px;
	border-top: 1px solid var(--sh-brd-faint, #eef0f5);
	background: #fafbfc;
}

.sh-sd-chips[hidden] {
	display: none !important;
}

.sh-sd-chips .sh-sd-cap {
	width: 100%;
}

.sh-sd .sh-sd-chip {
	min-height: 0 !important;
	padding: 7px 12px !important;
	border: 1px solid var(--sh-brd, #e4e7ee) !important;
	border-radius: 8px !important;
	background: #fff !important;
	font-family: var(--sh-font-mono, ui-monospace, monospace) !important;
	font-size: 11.5px !important;
	font-weight: 500;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	color: var(--sh-text, #46506a) !important;
	cursor: pointer;
	transition: border-color .14s, color .14s;
}

.sh-sd .sh-sd-chip:hover {
	border-color: var(--sh-ink, #14203a) !important;
	color: var(--sh-ink, #14203a) !important;
}

/* ── Усі результати ──────────────────────────────────────────────── */

.sh-sd .sh-sd-all {
	width: 100%;
	min-height: 0 !important;
	padding: 15px !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: var(--sh-ink, #14203a) !important;
	color: #fff !important;
	font-family: inherit !important;
	font-size: 12.5px !important;
	font-weight: 700 !important;
	line-height: 1.2;
	letter-spacing: .08em;
	text-transform: none;
	cursor: pointer;
	transition: background .14s;
}

.sh-sd .sh-sd-all:hover {
	background: var(--sh-accent, #2f6bf3) !important;
}

/* ── Вузькі екрани ───────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.sh-sd {
		right: auto;
		left: 0;
		width: 100%;
	}

	.sh-sd-cats {
		grid-template-columns: repeat(2, 1fr);
	}

	.sh-sd .sh-sd-item {
		grid-template-columns: 56px 1fr;
		align-items: start;
		column-gap: 12px;
		row-gap: 6px;
	}

	.sh-sd-pic {
		grid-row: 1 / span 2;
		width: 56px;
		height: 56px;
	}

	.sh-sd-right {
		display: flex;
		align-items: baseline;
		gap: 10px;
		text-align: start;
	}

	.sh-sd-stock {
		margin-top: 0;
	}
}

/* У бічній панелі телефону випадайці нема куди спливати — ставимо в потік. */
.mobile-nav .sh-sd {
	position: static;
	width: auto;
	max-width: none;
	margin-top: 10px;
	border: 1px solid var(--sh-brd, #e4e7ee);
	box-shadow: none;
}

.mobile-nav .sh-sd-list {
	max-height: 300px;
}
