/*
 * Search panel (ARKAN-324 S03). A non-modal dialog printed inside the fixed header: the overlay controller
 * (assets/js/overlay.js, variant "search") fades it in with the page dim. Numbers measured on the reference
 * (specs/measure-P1.md): panel 76.8 high at >=700 (padding 24, row 28.8) and 47.8 below (padding 12);
 * typed state 250px rail + product area from 1000px, one column with horizontal cards below.
 */

.header-search {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	z-index: 0; /* the mega panel (z-index 1 in the header) stays openable above it */
	max-height: calc(100vh - var(--qilaada-top));
	max-height: calc(100dvh - var(--qilaada-top));
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: none;
	background: var(--qilaada-color-white);
	color: var(--qilaada-color-text);
}

.header-search::-webkit-scrollbar {
	display: none;
}

.header-search__container {
	padding-inline: 20px;
}

/* Field row: magnifier 20, input, close 16. */
.header-search__form-control {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr) 16px;
	align-items: center;
	column-gap: 12px;
	padding-block: 12px;
}

.header-search__form-control > .icon {
	width: 20px;
	height: 20px;
	color: var(--qilaada-color-text);
}

input.header-search__input {
	width: 100%;
	min-width: 0;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--qilaada-color-text);
	font-family: var(--qilaada-font-heading);
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.14em;
	line-height: 1.7;
	text-transform: uppercase;
	outline: none;
	appearance: none;
}

input.header-search__input:focus,
input.header-search__input:focus-visible {
	border: 0;
	outline: none;
}

input.header-search__input::placeholder {
	color: rgb(28 27 27 / 0.65);
	opacity: 1;
	font-family: inherit;
	letter-spacing: inherit;
	text-transform: uppercase;
}

input.header-search__input::-webkit-search-cancel-button,
input.header-search__input::-webkit-search-decoration {
	display: none;
	appearance: none;
}

.header-search__close {
	display: block;
	width: 16px;
	height: 16px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--qilaada-color-text);
	cursor: pointer;
}

.header-search__close .icon {
	display: block;
	width: 16px;
	height: 16px;
}

/* Predictive layout ------------------------------------------------------ */

.predictive-search[hidden],
.predictive-search__results[hidden],
.predictive-search__rail[hidden],
.predictive-search__panel[hidden],
.predictive-search__empty[hidden],
.predictive-search__more[hidden] {
	display: none;
}

.predictive-search__results {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 40px;
	padding: 20px 0 32px;
}

.predictive-search__rail {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-content: start;
	gap: 24px;
}

.predictive-search__category,
.predictive-search__tab,
.predictive-search__none,
.predictive-search__collection-name {
	font-family: var(--qilaada-font-heading);
	font-size: 12px;
	font-weight: 400;
	letter-spacing: 1.68px;
	line-height: 20.4px;
	text-transform: uppercase;
}

.predictive-search__category {
	margin: 0;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--qilaada-color-border);
	color: var(--qilaada-color-text-muted);
}

/* Suggestions: a horizontal, edge-bleeding row below 700px, a column from 700px. */
.predictive-search__suggestions {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: max-content;
	gap: 20px 24px;
	margin-inline: -20px;
	padding-inline: 20px;
	overflow-x: auto;
	scrollbar-width: none;
}

.predictive-search__suggestions::-webkit-scrollbar {
	display: none;
}

.predictive-search__suggestions > div,
.predictive-search__pages > div {
	font-family: var(--qilaada-font-ui);
	font-size: 14px;
	line-height: 23.1px;
}

.predictive-search__suggestions mark {
	background: transparent;
	color: var(--qilaada-color-black);
	font-weight: 700;
}

/* Underline that sweeps in on hover (the reference's .link-reverse). */
.predictive-search .link-reverse {
	display: inline;
	background-image: linear-gradient(to right, currentColor, currentColor);
	background-position: 0 min(100%, 27.7125px);
	background-repeat: no-repeat;
	background-size: 0 1px;
	color: var(--qilaada-color-text);
	text-decoration: none;
	transition: background-size 0.3s ease-in-out;
}

[dir="rtl"] .predictive-search .link-reverse {
	background-position: 100% min(100%, 27.7125px);
}

@media (hover: hover) {
	.predictive-search .link-reverse:hover {
		background-size: 100% 1px;
		color: var(--qilaada-color-text);
	}
}

/* Tabs ---------------------------------------------------------------------- */

.predictive-search__tablist {
	display: grid;
	grid-auto-flow: column;
	justify-content: start;
	column-gap: 40px;
	margin-bottom: 24px;
	padding-bottom: 1px;
	background: linear-gradient(var(--qilaada-color-border), var(--qilaada-color-border)) bottom / 100% 1px no-repeat;
	overflow-x: auto;
	scrollbar-width: none;
}

.predictive-search__tablist::-webkit-scrollbar {
	display: none;
}

.predictive-search__tab {
	padding: 0 0 10px;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: 0 1px 0 0 transparent;
	color: var(--qilaada-color-text);
	opacity: 0.6;
	text-align: center;
	cursor: pointer;
	transition: opacity 0.2s ease-in, box-shadow 0.2s ease-in;
}

.predictive-search__tab[aria-selected="true"] {
	box-shadow: 0 1px 0 0 var(--qilaada-color-text);
	opacity: 1;
}

.predictive-search__panel {
	display: grid;
	align-content: start;
	gap: 32px;
}

.predictive-search__none {
	margin: 0;
	color: var(--qilaada-color-text-muted);
}

/* Products: horizontal cards below 1000px, a 4-column grid from 1000px. The card is the collection card (S11b). */
.header-search .predictive-search__products {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.header-search .predictive-search__products .predictive-search__none-item {
	list-style: none;
}

.header-search .predictive-search__products .product-card {
	display: grid;
	grid-template-columns: 70px minmax(0, 1fr);
	align-items: center;
	column-gap: 24px;
	margin: 0;
	text-align: start;
}

.header-search .predictive-search__products .product-card__body {
	padding-top: 0;
	justify-content: center;
}

.header-search .predictive-search__products .product-card__title {
	max-width: none;
	margin-inline: 0;
}

.header-search .predictive-search__products .product-card__actions {
	display: none;
}

/* A price whose currency sign is Arabic script (QAR) sits in a Latin line: isolate it so the digits and the sign keep one reading order. */
.header-search .predictive-search__products .woocommerce-Price-amount {
	unicode-bidi: isolate;
}

.predictive-search__more {
	justify-self: start;
}

@media (min-width: 700px) {
	.header-search__container {
		padding-inline: 32px;
	}

	.header-search__form-control {
		column-gap: 20px;
		padding-block: 24px;
	}

	input.header-search__input {
		font-size: clamp(16.634px, calc(15.268px + 0.1951vw), 18px);
		line-height: 1.6;
	}

	.predictive-search__results {
		padding: 24px 0 48px;
	}

	.predictive-search__rail {
		gap: 32px;
	}

	.predictive-search__suggestions {
		grid-auto-flow: row;
		grid-auto-columns: auto;
		justify-items: start;
		gap: 12px;
		margin-inline: 0;
		padding-inline: 0;
		overflow: hidden;
	}

	.predictive-search__tablist {
		margin-bottom: 32px;
	}

	.predictive-search__panel {
		gap: 48px;
	}

	.predictive-search__more {
		justify-self: center;
	}

	.header-search .predictive-search__products .product-card {
		grid-template-columns: 100px minmax(0, 1fr);
		column-gap: 32px;
	}
}

@media (min-width: 1000px) {
	.header-search__container {
		padding-inline: 48px;
	}

	.predictive-search__results {
		grid-template-columns: 250px minmax(0, 1fr);
	}

	.predictive-search__tablist {
		column-gap: 70px;
	}

	.header-search .predictive-search__products {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.header-search .predictive-search__products .predictive-search__none-item {
		grid-column: 1 / -1;
	}

	.header-search .predictive-search__products .product-card {
		display: flex;
		align-items: stretch;
		text-align: center;
	}

	.header-search .predictive-search__products .product-card__body {
		flex: 0 0 auto; /* auto height: a long title grows the card downward, keeping the 20px gap */
		justify-content: flex-start;
		padding-top: 20px;
	}

	.header-search .predictive-search__products .product-card__title {
		margin-inline: auto;
		max-width: 178.75px;
	}

	/* Every card's "Add to cart" sits at the bottom of its row, lined up whatever the length of the names above. */
	.header-search .predictive-search__products .product-card__actions {
		display: flex;
		justify-content: center;
		margin-top: auto;
		padding-top: 1.25rem;
	}

	.header-search .predictive-search__products .product-card__actions .button--cart.button--cart {
		padding-inline: 8px;
		letter-spacing: 0.1em;
		text-align: center;
	}
}

/* Collections tab: caption (and a photo when the collection has one). */
.predictive-search__collections {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px;
}

.predictive-search__collection {
	display: grid;
	align-content: start;
	gap: 12px;
	color: var(--qilaada-color-text);
	text-decoration: none;
}

.predictive-search__collection-name {
	color: var(--qilaada-color-text);
}

.predictive-search__collection-media {
	display: block;
	overflow: hidden;
	aspect-ratio: var(--qilaada-ratio-card);
}

.predictive-search__collection-media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

@media (min-width: 700px) {
	.predictive-search__collections {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 48px;
	}

	.predictive-search__collection {
		gap: 20px;
	}

	.predictive-search__collection-name {
		font-size: 14px;
		letter-spacing: 1.96px;
		line-height: 23.8px;
	}
}

.predictive-search__pages {
	display: grid;
	justify-items: start;
	gap: 12px;
}

/* No results at all. */
.predictive-search__empty {
	margin: 0;
	padding: 40px 0 64px;
	font-family: var(--qilaada-font-ui);
	font-size: 16px;
	line-height: 26.4px;
}

@media (min-width: 700px) {
	.predictive-search__empty {
		padding: 76px 0 100px;
	}
}

/* View all results: the collection card button (S11b), 44.2px high. */
.header-search .button--cart.button--cart {
	--cart-ease: cubic-bezier(0.785, 0.135, 0.15, 0.86);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	width: auto;
	min-height: 0;
	padding: 10.4px 28px;
	border: 1px solid #1c1c1c;
	border-radius: 4px;
	background-color: transparent;
	background-image: linear-gradient(#1c1c1c, #1c1c1c), linear-gradient(transparent, transparent);
	background-position: 100% 50%, 100% 50%;
	background-repeat: no-repeat;
	background-size: 101% 101%, 0 101%;
	color: #fff;
	font-family: var(--qilaada-font-heading);
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0.18em;
	line-height: 21.45px;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	cursor: pointer;
	transition:
		background-size 0.45s var(--cart-ease),
		color 0.45s var(--cart-ease),
		border 0.45s var(--cart-ease),
		background-position 0.45s step-end;
}

.header-search .product-card__actions .button--cart.button--cart {
	display: flex;
	width: 100%;
}

[dir="rtl"] .header-search .button--cart.button--cart {
	background-position: 0% 50%, 0% 50%;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.header-search .button--cart.button--cart:not(:disabled, .disabled, .loading):hover {
		background-position: 0% 50%, 0% 50%;
		background-size: 0 101%, 101% 101%;
		color: #1c1c1c;
	}

	[dir="rtl"] .header-search .button--cart.button--cart:not(:disabled, .disabled, .loading):hover {
		background-position: 100% 50%, 100% 50%;
	}
}

@media not all and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.header-search .button--cart.button--cart:hover {
		color: #fff;
	}
}

