/* =========================================================
   BUDUPROFI AJAX PRODUCT SEARCH
   ========================================================= */

.bp-header .bp-search,
.bp-header .bp-search-mobile-inner {
	position: relative;
	box-sizing: border-box;
}


/* =========================================================
   SEARCH FORM SAFETY
   ========================================================= */

.bp-header .bp-search form.woocommerce-product-search {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.bp-header .bp-search form.woocommerce-product-search * {
	box-sizing: border-box;
}

.bp-header .bp-search input.search-field,
.bp-header .bp-search input[type="search"] {
	min-width: 0;
}


/* =========================================================
   RESULTS PANEL
   ========================================================= */

.bp-header .bp-search-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;

	z-index: 10020;

	background: #ffffff;

	border: 1px solid rgba(74, 57, 50, 0.10);
	border-radius: 18px;

	box-shadow:
		0 18px 44px rgba(43, 32, 28, 0.12),
		0 4px 12px rgba(43, 32, 28, 0.06),
		0 0 0 100vmax rgba(36, 35, 40, 0.10);

	overflow: hidden;

	max-height: min(500px, 68vh);

	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.bp-header .bp-search-results.is-open {
	overflow-y: auto;
}

.bp-header .bp-search-results[hidden] {
	display: none !important;
}


/* =========================================================
   PRODUCT
   ========================================================= */

.bp-header .bp-search-result {
	display: flex;
	align-items: center;
	gap: 12px;

	width: 100%;
	min-height: 72px;

	padding: 10px 14px;

	background: #ffffff;
	color: #222222;

	text-decoration: none !important;

	border: 0;
	border-bottom: 1px solid #f0eeec;

	transition:
		background-color .15s ease,
		color .15s ease;
}

.bp-header .bp-search-result:last-of-type {
	border-bottom: 0;
}

.bp-header .bp-search-result:hover,
.bp-header .bp-search-result:focus,
.bp-header .bp-search-result.is-active {
	background: #f7f4f2;
	color: #222222;
	text-decoration: none !important;
	outline: none;
}


/* =========================================================
   IMAGE
   ========================================================= */

.bp-header .bp-search-result__image {
	flex: 0 0 52px;

	width: 52px;
	height: 52px;

	display: flex;
	align-items: center;
	justify-content: center;

	background: #faf9f8;
	border-radius: 10px;

	overflow: hidden;
}

.bp-header .bp-search-result__image img {
	display: block;

	width: 100%;
	height: 100%;

	object-fit: contain;
	mix-blend-mode: multiply;
}


/* =========================================================
   TEXT
   ========================================================= */

.bp-header .bp-search-result__content {
	flex: 1;
	min-width: 0;

	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 3px;
}

.bp-header .bp-search-result__name {
	display: -webkit-box;

	margin: 0;

	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.3;

	color: #282421;

	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.bp-header .bp-search-result__price {
	display: block;

	margin: 1px 0 0;

	font-size: 13px;
	font-weight: 600;
	line-height: 1.25;

	color: #4d3931;
}

.bp-header .bp-search-result__price del {
	margin-right: 5px;

	font-size: 11.5px;
	font-weight: 400;

	color: #9b9692;
	opacity: 1;
}

.bp-header .bp-search-result__price ins {
	color: #4d3931;
	text-decoration: none;
}


/* =========================================================
   STATES
   ========================================================= */

.bp-header .bp-search-state {
	padding: 18px 16px;

	font-size: 14px;
	line-height: 1.4;
	text-align: center;

	color: #77716e;
}


/* =========================================================
   ALL RESULTS
   ========================================================= */

.bp-header .bp-search-all {
	display: flex;
	align-items: center;
	justify-content: center;

	min-height: 48px;

	padding: 12px 16px;

	background: #faf9f8;

	border-top: 1px solid #eeecea;

	color: #4d3931 !important;

	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.3;

	text-align: center;
	text-decoration: none !important;

	transition: background-color .15s ease;
}

.bp-header .bp-search-all:hover,
.bp-header .bp-search-all:focus {
	background: #f4f1ef;

	color: #4d3931 !important;
	text-decoration: none !important;

	outline: none;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

	/*
	 * Критично для iOS.
	 * Safari не должен увеличивать viewport при фокусе.
	 */
	.bp-header .bp-search--mobile input.search-field,
	.bp-header .bp-search--mobile input[type="search"] {
		font-size: 16px !important;
		min-width: 0 !important;
	}

	.bp-header .bp-search--mobile,
	.bp-header .bp-search-mobile-inner {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}

	.bp-header .bp-search--mobile form.woocommerce-product-search {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;

		display: flex;
		align-items: center;
	}

	.bp-header .bp-search--mobile form.woocommerce-product-search .search-field {
		flex: 1 1 auto;
		width: auto;
		min-width: 0;
	}

	.bp-header .bp-search--mobile form.woocommerce-product-search .search-submit {
		flex: 0 0 auto;
	}

	/*
	 * На мобильном окно результатов не прилипает к краям
	 * и выглядит отдельным слоем над страницей.
	 * По высоте — примерно 5 товаров в видимой зоне.
	 */
	.bp-header .bp-search--mobile .bp-search-results {
	top: calc(100% + 8px);

	left: 12px;
	right: 12px;

	width: auto;
	max-width: none;

	height: var(--bp-search-mobile-height, 410px);
	max-height: var(--bp-search-mobile-height, 410px);

	border-radius: 18px;

	background: #fff;

	box-shadow:
		0 18px 40px rgba(43, 32, 28, 0.14),
		0 4px 12px rgba(43, 32, 28, 0.06),
		0 0 0 100vmax rgba(36, 35, 40, 0.16);

	overflow-y: auto;
}
	}

	.bp-header .bp-search-result {
		gap: 11px;
		min-height: 72px;
		padding: 10px 12px;
	}

	.bp-header .bp-search-result__image {
		flex-basis: 50px;
		width: 50px;
		height: 50px;
		border-radius: 10px;
	}

	.bp-header .bp-search-result__content {
		gap: 3px;
	}

	.bp-header .bp-search-result__name {
		font-size: 13.5px;
		line-height: 1.3;
	}

	.bp-header .bp-search-result__price {
		font-size: 13px;
	}

	.bp-header .bp-search-result__price del {
		font-size: 11.5px;
	}

	.bp-header .bp-search-all {
		min-height: 48px;
		padding: 12px;
		font-size: 13.5px;
	}

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

	.bp-header .bp-search--mobile .bp-search-results {
		left: 10px;
		right: 10px;
	}

	.bp-header .bp-search-result {
		gap: 10px;
		padding-left: 10px;
		padding-right: 10px;
	}

	.bp-header .bp-search-result__image {
		flex-basis: 48px;
		width: 48px;
		height: 48px;
	}

	.bp-header .bp-search-result__name {
		font-size: 13px;
	}

	.bp-header .bp-search-result__price {
		font-size: 12.5px;
	}

}

.bp-header:has(.bp-search-results.is-open) {
	z-index: 100000 !important;
}