/* Търсачка в header-а: предложения, докато се пише (assets/js/search.js, inc/search.php). */

.header-search .sld-search input[type="search"] {
	padding-right: 94px;
}

.header-search .sld-search input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.header-search .sld-search .sld-search__clear {
	position: absolute;
	top: 0;
	right: 52px;
	display: grid;
	place-items: center;
	width: 38px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #8a919c;
	cursor: pointer;
}

.header-search .sld-search .sld-search__clear[hidden] {
	display: none;
}

.header-search .sld-search .sld-search__clear:hover {
	color: #20242b;
}

.sld-search__clear svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 2;
}

.sld-search__spinner {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid rgb(255 255 255 / 30%);
	border-top-color: #fff;
	border-radius: 50%;
	animation: sld-search-spin 700ms linear infinite;
}

.sld-search.is-loading .sld-search__submit svg {
	display: none;
}

.sld-search.is-loading .sld-search__spinner {
	display: block;
}

/* Падащо меню */

.sld-search-panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 1100;
	width: max(100%, 580px);
	max-width: calc(100vw - 24px);
	max-height: min(660px, calc(100vh - 130px));
	padding: 6px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid rgb(18 35 63 / 10%);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 24px 60px rgb(10 23 43 / 22%), 0 4px 12px rgb(10 23 43 / 8%);
	color: var(--color-text);
	font-size: 0.92rem;
	font-style: normal;
	line-height: 1.4;
	text-align: left;
	scrollbar-width: thin;
}

.sld-search-panel[hidden] {
	display: none;
}

.sld-search-panel__list {
	transition: opacity 160ms ease;
}

.sld-search-panel.is-loading .sld-search-panel__list {
	opacity: 0.55;
}

.sld-search-panel__group + .sld-search-panel__group {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid #f0f1f4;
}

.sld-search-panel__heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 10px 5px;
	color: var(--color-muted);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
}

.sld-search-panel .sld-search-panel__heading-action {
	margin: 0;
	padding: 2px 4px;
	border: 0;
	border-radius: 6px;
	background: none;
	color: var(--color-orange-dark);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
}

.sld-search-panel .sld-search-panel__heading-action:hover {
	background: #fff4ee;
}

.sld-search-panel mark {
	background: linear-gradient(transparent 58%, rgb(239 108 47 / 24%) 0);
	color: inherit;
	font-weight: 800;
}

/* Продукти */

.sld-search-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 7px 10px;
	border-radius: 10px;
	color: inherit;
	text-decoration: none;
}

.sld-search-item.is-active {
	background: #fff4ee;
}

.sld-search-item__media {
	flex: 0 0 56px;
	width: 56px;
	height: 56px;
	overflow: hidden;
	border-radius: 10px;
	background: #f6f4f1;
}

.sld-search-item__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.sld-search-item__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}

.sld-search-item__title {
	display: -webkit-box;
	overflow: hidden;
	color: var(--color-heading);
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.3;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.sld-search-item__sku {
	overflow: hidden;
	color: var(--color-muted);
	font-size: 0.76rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sld-search-item__price {
	flex: 0 0 auto;
	margin-left: 6px;
	color: var(--color-orange-dark);
	font-size: 0.9rem;
	font-weight: 800;
	line-height: 1.25;
	text-align: right;
	white-space: nowrap;
}

.sld-search-item__price del {
	display: block;
	color: var(--color-muted);
	font-size: 0.74rem;
	font-weight: 600;
}

.sld-search-item__price ins {
	text-decoration: none;
}

/* Категории и популярни търсения */

.sld-search-cats,
.sld-search-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 2px 10px 10px;
}

.sld-search-cat,
.sld-search-panel .sld-search-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	min-height: 34px;
	margin: 0;
	padding: 5px 12px;
	border: 1px solid var(--color-line);
	border-radius: 999px;
	background: #fff;
	color: var(--color-heading);
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 140ms ease, background-color 140ms ease;
}

.sld-search-cat {
	padding-right: 6px;
}

.sld-search-cat.is-active,
.sld-search-panel .sld-search-chip.is-active {
	border-color: var(--color-orange);
	background: #fff4ee;
}

.sld-search-cat__count {
	min-width: 24px;
	padding: 2px 7px;
	border-radius: 999px;
	background: #f2f4f7;
	color: var(--color-muted);
	font-size: 0.72rem;
	font-weight: 700;
	text-align: center;
}

.sld-search-chip svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: var(--color-orange);
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

/* Последно търсени */

.sld-search-recent {
	display: flex;
	align-items: center;
}

.sld-search-panel .sld-search-recent__phrase {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	gap: 10px;
	min-width: 0;
	min-height: 40px;
	margin: 0;
	padding: 8px 10px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--color-text);
	font-size: 0.92rem;
	font-weight: 500;
	text-align: left;
	cursor: pointer;
}

.sld-search-panel .sld-search-recent__phrase.is-active {
	background: #f4f5f8;
}

.sld-search-recent__phrase svg {
	flex: 0 0 18px;
	width: 18px;
	height: 18px;
	fill: none;
	stroke: #98a2b3;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.sld-search-panel .sld-search-recent__remove {
	display: grid;
	flex: 0 0 32px;
	place-items: center;
	width: 32px;
	height: 32px;
	margin: 0 4px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--color-muted);
	cursor: pointer;
}

.sld-search-panel .sld-search-recent__remove:hover {
	background: #f2f4f7;
	color: var(--color-heading);
}

.sld-search-recent__remove svg {
	width: 14px;
	height: 14px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 2.2;
}

/* Всички резултати и съобщения */

/* „Виж всички“ остава видимо и когато списъкът се превърта. */
.sld-search-panel__all {
	position: sticky;
	bottom: -6px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 6px 0 -6px;
	padding: 12px 14px;
	border-top: 1px solid #eceef2;
	border-radius: 0 0 12px 12px;
	background: #f7f8fa;
	color: var(--color-heading);
	font-size: 0.88rem;
	font-weight: 800;
	text-decoration: none;
	transition: background-color 140ms ease, color 140ms ease;
}

.sld-search-panel__all svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
	transition: transform 140ms ease;
}

.sld-search-panel__all.is-active {
	background: var(--color-orange-strong);
	color: #fff;
}

.sld-search-panel__all.is-active svg {
	transform: translateX(3px);
}

.sld-search-message {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 10px 8px;
}

.sld-search-message svg {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 9px;
	border-radius: 50%;
	background: #f2f4f7;
	fill: none;
	stroke: var(--color-muted);
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.sld-search-message p {
	margin: 0;
	color: var(--color-heading);
	font-weight: 650;
}

.sld-search-panel[data-state="error"] .sld-search-message p {
	color: #b42318;
}

/* Затъмненият фон е под header-а, за да остане полето на светло. */
.sld-search-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99;
	background: rgb(10 23 43 / 32%);
	opacity: 0;
	visibility: hidden;
	transition: opacity 180ms ease, visibility 0s linear 180ms;
}

.sld-search-backdrop.is-visible {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

/* Телефон: търсачката на цял екран със стрелка назад, както във FiboSearch. */
.sld-search__back[hidden] {
	display: none;
}

html.sld-search-overlay-on,
html.sld-search-overlay-on body {
	overflow: hidden;
}

/*
 * Редът на хедъра (закрепен) е под търсачката на цял екран: скрит е, за да не се фокусира и чете отдолу.
 * На вид нищо не се сменя – търсачката го покрива изцяло.
 */
html.sld-search-overlay-on .mobile-menu-toggle,
html.sld-search-overlay-on .site-branding,
html.sld-search-overlay-on .header-phones,
html.sld-search-overlay-on .header-actions {
	visibility: hidden;
}

.header-search .sld-search.is-overlay {
	position: fixed;
	inset: 0;
	z-index: 1200;
	flex-wrap: wrap;
	align-content: flex-start;
	padding: 10px 10px 0 60px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--color-white);
}

.sld-search.is-overlay .sld-search__back {
	position: absolute;
	top: 10px;
	left: 10px;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--surface-muted);
	color: var(--color-heading);
	cursor: pointer;
}

.sld-search__back svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.header-search .sld-search.is-overlay .sld-search__submit {
	top: 10px;
	right: 10px;
}

.header-search .sld-search.is-overlay .sld-search__clear {
	top: 10px;
	right: 62px;
}

/* Последните и популярните търсения и резултатите са на цялата ширина: панелът започва под стрелката назад (-50px от отстъпа ѝ). */
.sld-search.is-overlay .sld-search-panel {
	position: static;
	flex: 0 0 calc(100% + 50px);
	width: calc(100% + 50px);
	max-width: none;
	max-height: none;
	margin: 12px 0 0 -50px;
	padding: 0 0 24px;
	overflow: visible;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

.sld-search.is-overlay .sld-search-panel__all {
	position: static;
	margin: 8px 0 0;
	border-radius: 10px;
}

@keyframes sld-search-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (max-width: 760px) {
	/* 16px, за да не увеличава iPhone страницата при фокус. */
	.header-search .sld-search input[type="search"] {
		font-size: 16px;
	}

	.sld-search-panel {
		right: 0;
		width: auto;
		max-width: none;
		max-height: calc(100vh - 150px);
		max-height: calc(100dvh - 150px);
	}

	.sld-search-item__media {
		flex-basis: 48px;
		width: 48px;
		height: 48px;
	}

	.sld-search-item__title {
		font-size: 0.86rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sld-search-backdrop,
	.sld-search-panel__list {
		transition: none;
	}
}
