/**
 * Выпадающий поиск в шапке (подсказки).
 */

/* Шапка: Inter (как в UI-макетах); остальной сайт — Nunito с body */
header {
	font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Верхняя полоса: одинаковый шрифт у ссылок и tel: */
.sahalin-header-top-bar__link {
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
	color: inherit;
	text-decoration: none;
	letter-spacing: 0;
	font-variant-numeric: normal;
	font-feature-settings: normal;
}

.sahalin-header-top-bar__link--tel {
	-webkit-text-size-adjust: 100%;
}

/**
 * Логотип: явные max-width / max-height.
 * В собранном main.css часто нет произвольных классов вроде max-w-[150px], базовый img { height: auto } тогда не даёт нужного масштаба.
 */
header .sahalin-header-logo {
	display: block;
	box-sizing: border-box;
	width: auto;
	height: auto;
	max-height: 36px;
	max-width: 175px;
	object-fit: contain;
	object-position: left center;
}

@media (min-width: 640px) {
	header .sahalin-header-logo {
		max-height: 42px;
		max-width: 205px;
	}
}

@media (min-width: 1024px) {
	header .sahalin-header-logo {
		max-height: 46px;
		max-width: 232px;
	}
}

.sahalin-live-search-panel {
	overflow: hidden;
	border-radius: 1rem;
	border: 1px solid #e5e7eb;
	background: #fff;
	box-shadow: 0 16px 48px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.sahalin-live-search-scroll {
	max-height: min(22rem, 90vh);
	overflow-y: auto;
	padding: 0.375rem 0;
}

.sahalin-live-search-section + .sahalin-live-search-section {
	border-top: 1px solid #f3f4f6;
	margin-top: 0.25rem;
	padding-top: 0.25rem;
}

.sahalin-live-search-section__label {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.5rem 0.875rem 0.375rem;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.055em;
	text-transform: uppercase;
	color: #9ca3af;
}

.sahalin-live-search-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0.125rem 0.375rem;
	padding: 0.5rem 0.625rem;
	border-radius: 0.625rem;
	text-decoration: none;
	color: inherit;
	transition: background-color 0.12s ease;
}

.sahalin-live-search-row:hover {
	background: #f9fafb;
}

.sahalin-live-search-row.is-focused {
	background: #e5ecf0;
}

.sahalin-live-search-row--cat .sahalin-live-search-row__main {
	font-size: 0.875rem;
	font-weight: 600;
	color: #1f2937;
	min-width: 0;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sahalin-live-search-row--cat .sahalin-live-search-chevron {
	flex-shrink: 0;
	color: #d1d5db;
}

.sahalin-live-search-icon-cat {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 0.5rem;
	background: #f3f4f6;
	color: #6b7280;
}

.sahalin-live-search-thumb {
	flex-shrink: 0;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 0.625rem;
	overflow: hidden;
	background: #f3f4f6;
}

.sahalin-live-search-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sahalin-live-search-product-body {
	min-width: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.sahalin-live-search-product-title {
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.35;
	color: #111827;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sahalin-live-search-price {
	flex-shrink: 0;
	margin-left: auto;
	padding-left: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: #374151;
	white-space: nowrap;
}

.sahalin-live-search-empty {
	padding: 0.875rem 1rem;
	font-size: 0.875rem;
	color: #6b7280;
}

.sahalin-live-search-footer {
	display: block;
	margin-top: 0.25rem;
	padding: 0.75rem 1rem;
	border-top: 1px solid #f3f4f6;
	text-align: center;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #4b7b9b;
	text-decoration: none;
	transition: background-color 0.12s ease, color 0.12s ease;
}

.sahalin-live-search-footer:hover {
	background: #f8fafc;
	color: #3d637d;
}

/* --- Шапка: сетка мобильная / flex десктоп --- */
.sahalin-header-inner {
	display: grid;
	align-items: center;
	column-gap: 0.5rem;
	row-gap: 0.5rem;
	box-sizing: border-box;
}

@media (max-width: 767px) {
	.sahalin-header-inner {
		grid-template-columns: minmax(0, 1fr) auto auto auto;
		grid-template-areas:
			"logo catalog search cart"
			"cats cats cats cats";
		column-gap: 0.35rem;
		row-gap: 0.5rem;
	}

	.sahalin-header-logo-link {
		grid-area: logo;
		min-width: 0;
	}

	header .sahalin-header-logo {
		max-height: 40px;
		max-width: 182px;
	}

	.sahalin-header-catalog-desktop {
		display: none !important;
	}

	.sahalin-header-catalog-mobile {
		grid-area: catalog;
		min-width: 0;
	}

	.sahalin-header-search-wrap {
		grid-area: search;
		position: static;
		width: auto;
		max-width: none;
		flex: none;
	}

	.sahalin-header-cart-slot {
		grid-area: cart;
	}

	.sahalin-header-quickcats-wrap {
		grid-area: cats;
		min-width: 0;
		margin: 0 -0.25rem;
		padding: 0.125rem 0.25rem 0;
	}

	.sahalin-header-cart-slot .header-cart-link {
		width: 2.75rem;
		height: 2.75rem;
		min-width: 2.75rem;
		padding: 0;
		gap: 0;
	}

	.sahalin-header-cart-slot .header-cart-total {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.sahalin-header-catalog-mobile .sahalin-header-catalog-btn--icon-only .sahalin-header-catalog-btn__label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.sahalin-header-catalog-mobile .sahalin-header-catalog-btn--icon-only {
		min-height: 2.75rem !important;
		height: 2.75rem !important;
		width: 2.75rem !important;
		padding: 0 !important;
		border-radius: 10px !important;
	}

	.sahalin-header-search-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.75rem;
		height: 2.75rem;
		min-width: 2.75rem;
		padding: 0;
		border: 1px solid #e5e7eb;
		border-radius: 10px;
		background: #fff;
		color: #374151;
		cursor: pointer;
		box-sizing: border-box;
		transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	}

	.sahalin-header-search-toggle:hover,
	.sahalin-header-search-toggle:focus-visible {
		border-color: #d1d5db;
		background: #f9fafb;
		color: #003459;
		outline: none;
	}

	.sahalin-header-search-wrap.is-search-open .sahalin-header-search-toggle {
		border-color: #4b7b9b;
		background: #eef4f8;
		color: #003459;
	}

	.sahalin-header-search-field {
		display: none;
	}

	.sahalin-header-main.is-search-open .sahalin-header-search-field {
		display: block;
		position: absolute;
		left: 0;
		right: 0;
		top: 100%;
		z-index: 80;
		padding: 0.5rem var(--sahalin-gutter, 0.6rem) 0.65rem;
		background: #fff;
		border-bottom: 1px solid #e8eaef;
		box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
		box-sizing: border-box;
	}

	.sahalin-header-search-field #sahalin-header-search {
		min-height: 2.75rem !important;
		height: 2.75rem !important;
		font-size: 0.875rem !important;
		padding-left: 0.75rem !important;
		padding-right: 3rem !important;
	}

	.sahalin-header-search-field .sahalin-header-search-field__icon {
		right: 1rem !important;
		width: 1rem;
		height: 1rem;
	}
}

@media (min-width: 768px) {
	.sahalin-header-search-toggle {
		display: none !important;
	}

	.sahalin-header-search-field {
		display: block !important;
		position: relative !important;
		top: auto !important;
		left: auto !important;
		right: auto !important;
		padding: 0 !important;
		border: 0 !important;
		box-shadow: none !important;
		background: transparent !important;
	}
}

@media (min-width: 768px) {
	.sahalin-header-inner {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		gap: 1rem 1.25rem;
	}

	.sahalin-header-catalog-mobile,
	.sahalin-header-quickcats-wrap {
		display: none !important;
	}

	.sahalin-header-logo-link {
		flex-shrink: 0;
	}

	.sahalin-header-catalog-desktop {
		flex-shrink: 0;
	}

	.sahalin-header-search-wrap {
		flex: 0 0 340px;
		width: 340px;
		max-width: 340px;
	}

	.sahalin-header-cart-slot {
		flex-shrink: 0;
		margin-left: auto;
	}
}

.sahalin-header-quickcats__link {
	display: inline-block;
	padding: 0.35rem 0.65rem;
	border-radius: 9999px;
	background: #f3f4f6;
	color: #374151;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sahalin-header-quickcats__link:hover,
.sahalin-header-quickcats__link:focus-visible {
	background: #e8ecf0;
	color: #003459;
}

/* --- Шапка: «Каталог» (фон вне Tailwind-сборки) + поиск 340px от sm --- */
.sahalin-header-toolbar {
	min-width: 0;
}

.sahalin-header-catalog-btn {
	background-color: #003459 !important;
	color: #fff !important;
	border: 1px solid #002a48 !important;
	border-radius: 10px !important;
	font-weight: 500 !important;
	font-size: 0.875rem !important;
	line-height: 1.25 !important;
	box-sizing: border-box !important;
	min-height: 48px !important;
	height: 48px !important;
	cursor: pointer !important;
}

@media (min-width: 640px) {
	.sahalin-header-catalog-btn {
		font-size: 15px !important;
	}
}

.sahalin-header-catalog-btn:hover,
.sahalin-header-catalog-btn:focus-visible {
	background-color: #002a48 !important;
	color: #fff !important;
	border-color: #00223a !important;
}

.sahalin-header-catalog-btn svg {
	color: currentColor;
}

.sahalin-header-catalog-btn > span {
	letter-spacing: 0.02em;
}

.sahalin-header-search-wrap {
	box-sizing: border-box;
}

@media (max-width: 767px) {
	.sahalin-header-search-wrap {
		width: 100%;
		max-width: 100%;
		flex: 0 0 auto;
	}
}

#sahalin-header-search {
	border-radius: 10px !important;
	box-sizing: border-box !important;
	min-height: 48px !important;
	height: 48px !important;
	font-size: 0.875rem !important;
	font-weight: 500 !important;
	line-height: 1.25 !important;
}

@media (min-width: 640px) {
	#sahalin-header-search {
		font-size: 15px !important;
	}
}

#sahalin-header-search::placeholder {
	font-weight: 300 !important;
	font-size: inherit !important;
	line-height: inherit !important;
	opacity: 1 !important;
}

/* Десктоп: фиксированная ширина поиска (правила выше не должны перебиваться общими width:100%) */
@media (min-width: 768px) {
	.sahalin-header-search-wrap {
		flex: 0 0 340px;
		width: 340px;
		max-width: 340px;
		min-width: 0;
	}

	.sahalin-header-cart-slot .header-cart-link {
		min-height: 48px;
		height: 48px;
		box-sizing: border-box;
	}
}

/* Поле поиска: фиксированная ширина — только десктоп (см. .sahalin-header-inner) */
