/*
 * Header search panel (plan: kategorie-i-menu/wyszukiwarka.md). The panel sits under the search field; on a
 * computer it is 820 px wide with two columns (phrases, categories, brands, guide | products) and dims the page;
 * on phones the open form takes the whole screen with a cancel button. Colours and type from tokens.css.
 */

/* ------------------------------------------------------------------
   Field
   ------------------------------------------------------------------ */
.site-search form.woocommerce-product-search {
	position: relative;
}
.site-search form.sz-search-open .search-field,
.site-search .search-field:focus {
	border-color: var(--sz-navy);
	box-shadow: 0 0 0 1px var(--sz-navy);
}
/* While the answer is on its way the theme's magnifier in the field turns into a small ring. */
.site-search form.sz-search-loading::before {
	box-sizing: border-box;
	border: 2px solid var(--sz-line);
	border-top-color: var(--sz-navy);
	border-radius: 50%;
	background-color: transparent;
	-webkit-mask-image: none;
	mask-image: none;
	animation: sz-search-spin 0.8s linear infinite;
}
@keyframes sz-search-spin {
	to { transform: rotate(360deg); }
}
.sz-search__cancel {
	display: none;
}

/* The page behind an open panel steps back: the veil is an element of the form, so the header, which is its
   own stacking context, cannot come between it and the panel; the field and the magnifier stay above the veil. */
.site-search form.sz-search-open {
	z-index: 999;
}
.sz-search__veil {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 998;
	background: rgba(20, 20, 20, 0.32);
}
.site-search form.sz-search-open .sz-search__veil {
	display: block;
}
.site-search form.sz-search-open .search-field {
	position: relative;
	z-index: 1001;
}
.site-search form.sz-search-open::before {
	z-index: 1002;
}

/* ------------------------------------------------------------------
   Panel
   ------------------------------------------------------------------ */
.sz-search {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 1000;
	width: min(820px, calc(100vw - 32px));
	max-height: calc(100vh - 140px);
	overflow: auto;
	border: 1px solid var(--sz-line);
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 16px 40px rgba(20, 20, 20, 0.18);
	font-family: Inter, sans-serif;
	text-align: left;
}
.sz-search[hidden] {
	display: none;
}
/* Narrow computers and tablets in landscape: the field starts about 250 px from the left edge, the panel
   has to end before the right one. */
@media (min-width: 993px) and (max-width: 1140px) {
	.sz-search {
		width: min(720px, calc(100vw - 300px));
	}
	.sz-search__panel--results.has-aside {
		grid-template-columns: 240px minmax(0, 1fr);
	}
}
.sz-search__panel {
	padding: 18px 24px 14px;
}
.sz-search__panel--results.has-aside {
	display: grid;
	grid-template-columns: 280px minmax(0, 1fr);
	gap: 0 24px;
	padding-bottom: 0;
}
.sz-search__aside {
	padding-right: 24px;
	border-right: 1px solid var(--sz-line);
	padding-bottom: 14px;
}
.sz-search__main {
	min-width: 0;
	display: flex;
	flex-direction: column;
}
.sz-search__section + .sz-search__section {
	margin-top: 16px;
}
.sz-search__section-title {
	margin: 0 0 6px;
	font-size: 11.5px;
	line-height: 16px;
	letter-spacing: 0.7px;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--sz-mute);
}
.sz-search__section-title span {
	font-weight: 400;
}
.sz-search__list {
	display: flex;
	flex-direction: column;
}

/* Items: every clickable row shares one look; the active one (keyboard, or the mouse where there is one) has
   a grey ground. Hover rules live in the block at the end of this section, so a finger leaves no mark. */
.sz-search__item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	margin: 0 -10px;
	border-radius: 6px;
	font-size: 14px;
	line-height: 20px;
	color: var(--sz-ink);
	text-decoration: none;
}
.sz-search__item.is-active {
	background: var(--sz-bg2);
	color: var(--sz-ink);
}
.sz-search__item strong {
	font-weight: 600;
}
.sz-search__term {
	justify-content: space-between;
}
.sz-search__hub {
	color: var(--sz-mute);
}
.sz-search__count {
	flex: none;
	font-size: 13px;
	color: var(--sz-mute);
}
.sz-search__icon {
	flex: none;
	width: 16px;
	height: 16px;
	background: no-repeat center / 16px 16px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4'/%3E%3C/svg%3E");
}
.sz-search__icon--trend {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 17l6-6 4 4 6-7'/%3E%3Cpath d='M15 8h5v5'/%3E%3C/svg%3E");
}
.sz-search__icon--book {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h6a3 3 0 0 1 3 3v12a2 2 0 0 0-2-2H4z'/%3E%3Cpath d='M20 5h-6a3 3 0 0 0-3 3v12a2 2 0 0 1 2-2h7z'/%3E%3C/svg%3E");
}
.sz-search__icon--arrow {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b3a67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E");
}

/* Products: photo, brand, name in two lines, availability, price. */
.sz-search__product {
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
}
.sz-search__thumb {
	flex: none;
	width: 64px;
	height: 64px;
	object-fit: contain;
	border-radius: 4px;
	background: #f7f8fa;
	mix-blend-mode: multiply;
}
.sz-search__body {
	flex-grow: 1;
	min-width: 0;
}
.sz-search__brand {
	display: block;
	font-size: 11px;
	line-height: 15px;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--sz-mute);
}
.sz-search__model {
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 3px;
	background: var(--sz-bg2);
	font-size: 11px;
	letter-spacing: 0;
	text-transform: none;
	color: var(--sz-ink2);
}
.sz-search__name {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	font-size: 14.5px;
	line-height: 20px;
	color: var(--sz-ink);
}
.sz-search__avail {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	font-size: 12px;
	line-height: 16px;
	color: var(--sz-ink2);
}
.sz-search__avail::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--sz-ok);
}
.sz-search__avail.is-out {
	color: var(--sz-warn);
}
.sz-search__avail.is-out::before {
	background: #d97706;
}
.sz-search__price {
	flex: none;
	text-align: right;
	font-family: Poppins, sans-serif;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--sz-ink);
	white-space: nowrap;
}
.sz-search__price del {
	font-family: Inter, sans-serif;
	font-size: 12px;
	font-weight: 400;
	color: var(--sz-mute);
}
.sz-search__price ins {
	text-decoration: none;
	color: var(--sz-accent);
}
.sz-search__price .amount {
	font-weight: inherit;
}

/* The way to the results page closes the product column. */
.sz-search__all {
	justify-content: center;
	gap: 8px;
	height: 46px;
	margin: 10px -24px 0 -24px;
	padding: 0 24px;
	border-top: 1px solid var(--sz-line);
	border-radius: 0;
	background: var(--sz-bg2);
	font-weight: 600;
	color: var(--sz-navy);
}
.sz-search__panel--results.has-aside .sz-search__all {
	margin-left: -24px;
	margin-right: -24px;
}
.sz-search__all.is-active {
	background: #e9ecf3;
	color: var(--sz-navy);
}

/* Empty field: chips of recent searches, popular searches, departments. */
.sz-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.sz-search__chip {
	display: inline-flex;
	align-items: center;
	height: 32px;
	padding: 0 4px 0 12px;
	border: 1px solid #c9ced9;
	border-radius: 16px;
	font-size: 13.5px;
	white-space: nowrap;
}
.sz-search__chip-link {
	margin: 0;
	padding: 0;
	border-radius: 0;
	font-size: 13.5px;
}
.sz-search__chip-link.is-active {
	background: none;
	text-decoration: underline;
}
.sz-search__chip-remove {
	width: 24px;
	height: 24px;
	margin-left: 2px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	font-size: 16px;
	line-height: 24px;
	color: var(--sz-mute);
	cursor: pointer;
}
.sz-search__chip:has(.sz-search__chip-remove) {
	padding-right: 4px;
}
.sz-search__chip:not(:has(.sz-search__chip-remove)) {
	padding-right: 12px;
}
.sz-search__departments {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.sz-search__department {
	height: 36px;
	margin: 0;
	padding: 0 14px;
	border-radius: 6px;
	background: var(--sz-bg2);
	font-size: 13.5px;
	font-weight: 600;
	color: var(--sz-navy);
}
.sz-search__department.is-active {
	background: #e9ecf3;
}

/* Nothing found: what to do and where to go. */
.sz-search__panel--none {
	padding: 22px 24px 20px;
}
.sz-search__none-title {
	font-family: Poppins, sans-serif;
	font-size: 16px;
	line-height: 24px;
	font-weight: 600;
	color: var(--sz-ink);
}
.sz-search__none-help {
	margin-top: 6px;
	font-size: 14px;
	line-height: 21px;
	color: var(--sz-ink2);
}
.sz-search__none-help + .sz-search__section {
	margin-top: 16px;
}

/* Only a real pointer hovers: on a phone the item under the finger would otherwise keep the grey ground. */
@media (hover: hover) {
	.sz-search__item:hover {
		background: var(--sz-bg2);
		color: var(--sz-ink);
	}
	.sz-search__all:hover {
		background: #e9ecf3;
		color: var(--sz-navy);
	}
	.sz-search__chip-link:hover {
		background: none;
		text-decoration: underline;
	}
	.sz-search__chip-remove:hover {
		background: var(--sz-bg2);
		color: var(--sz-ink);
	}
	.sz-search__department:hover {
		background: #e9ecf3;
	}
}

/* ------------------------------------------------------------------
   Phones and tablets: the bar under the header, the open form over the whole screen
   ------------------------------------------------------------------ */
@media (max-width: 992px) {
	/* The open form covers the screen: it has to leave the header's stacking context behind, and in that
	   context the bar sits under the cart icon and the menu. */
	body.sz-search-active .site-header,
	body.sz-search-active .site-header .site-search {
		z-index: 100000;
	}
	.site-search form.sz-search-open {
		position: fixed;
		inset: 0;
		z-index: 100000;
		display: flex;
		flex-wrap: wrap;
		align-content: flex-start;
		gap: 10px;
		padding: 10px 12px 0 16px;
		background: #fff;
		overflow: auto;
	}
	.site-search form.sz-search-open .sz-search__veil {
		display: none;
	}
	.site-search form.sz-search-open .search-field {
		flex: 1 1 auto;
		width: auto;
		height: 44px;
		font-size: 16px;
	}
	.site-search form.sz-search-open button[type="submit"] {
		display: none;
	}
	.site-search form.sz-search-open .sz-search__cancel {
		display: block;
		flex: none;
		height: 44px;
		padding: 0 4px;
		border: 0;
		background: none;
		font-family: Inter, sans-serif;
		font-size: 15px;
		font-weight: 600;
		color: var(--sz-navy);
	}
	/* The magnifier (or the ring) keeps to the field at the top of the screen. */
	.site-search form.sz-search-open::before {
		top: 32px;
		left: 31px;
		margin-top: -8px;
	}
	.site-search form.sz-search-open .sz-search {
		position: static;
		width: 100%;
		max-height: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		overflow: visible;
	}
	.sz-search__panel,
	.sz-search__panel--none {
		padding: 6px 4px 24px;
	}
	.sz-search__panel--results.has-aside {
		display: block;
	}
	.sz-search__aside {
		padding: 0 0 16px;
		border-right: 0;
	}
	.sz-search__thumb {
		width: 56px;
		height: 56px;
	}
	.sz-search__name {
		font-size: 13.5px;
		line-height: 18px;
	}
	.sz-search__all {
		margin: 12px 0 0;
		height: 48px;
		border: 1px solid var(--sz-navy);
		border-radius: 6px;
		background: #fff;
	}
	.sz-search__panel--results.has-aside .sz-search__all {
		margin-left: 0;
		margin-right: 0;
	}
	/* While the panel is open the rest of the page stays put. */
	body.sz-search-active {
		overflow: hidden;
	}
}

/* The price per kg, l or piece (decision 54) and the lowest price of the 30 days before a reduction (short
   wording) under the price of a suggested product. */
.sz-search__unit,
.sz-search__lowest {
	display: block;
	margin-top: 2px;
	font-family: Inter, sans-serif;
	font-size: 11px;
	line-height: 14px;
	font-weight: 400;
	color: var(--sz-mute);
}
