/* Live search box ([farin_search]). Loaded only on pages that show it. */

.farin-search {
	position: relative;
	inline-size: 100%;
	max-inline-size: 640px;
	margin: 0;
	font-size: 14px;
}

.farin-search__field {
	position: relative;
	display: flex;
	align-items: center;
}

.farin-search__icon {
	position: absolute;
	inset-inline-start: 14px;
	color: #6b6580;
	pointer-events: none;
}

.farin-search input[type="search"] {
	inline-size: 100%;
	min-block-size: 44px;
	margin: 0;
	padding: 8px 44px 8px 16px;
	padding-inline: 44px 16px;
	border: 1px solid #e8e5ef;
	border-radius: 12px;
	background: #f6f5f9;
	color: #1d1730;
	font: inherit;
	appearance: none;
}

/* The browser's own blue «×» does not match; Escape still clears the field. */
.farin-search input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

/*
 * The phone sheet («جست‌وجو» in the bottom bar): one rounded field
 * with the button inside it, at its end. Enter searches too.
 */
.fbb-sheet .farin-search__field {
	gap: 4px;
	padding: 4px;
	padding-inline-start: 40px;
	border: 1px solid #e8e5ef;
	border-radius: 14px;
	background: #f6f5f9;
	transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.fbb-sheet .farin-search__field:focus-within {
	/* Focus shows in the edge alone, no glow around it. */
	border-color: color-mix(in srgb, #7b2cbf 55%, #e8e5ef);
	background: #fff;
}

.fbb-sheet .farin-search__field input[type="search"],
.fbb-sheet .farin-search__field input[type="search"]:focus {
	flex: 1;
	min-inline-size: 0;
	min-block-size: 40px;
	padding-inline: 0 4px;
	border: 0;
	background: transparent;
	box-shadow: none;
}

.fbb-sheet .farin-search__go {
	inline-size: 40px;
	block-size: 40px;
	border-radius: 10px;
}

.farin-search input[type="search"]:focus {
	outline: none;
	border-color: color-mix(in srgb, #7b2cbf 55%, #e8e5ef);
	background: #fff;
}

.farin-search__panel {
	position: absolute;
	inset-inline: 0;
	inset-block-start: calc(100% + 8px);
	z-index: 1000;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-block-size: min(70vh, 560px);
	overflow-x: hidden;
	overflow-y: auto;
	padding: 16px;
	border: 1px solid #e8e5ef;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 12px 40px rgb(29 23 48 / 0.12);
}

.farin-search__panel[hidden] {
	display: none;
}

.farin-search__idle {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.farin-search__idle[hidden] {
	display: none;
}

.farin-search__banner {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 12px;
	aspect-ratio: 1080 / 300;
	color: #fff;
	text-decoration: none;
}

.farin-search__banner img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.farin-search__banner-text {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	padding: 12px 16px;
	background: linear-gradient(to left, rgb(0 0 0 / 0.55), transparent 70%);
	/* White on the picture, whatever colour links have where the box sits (the header's are dark). */
	color: #fff;
}

.farin-search__banner-text em {
	font-style: normal;
	font-weight: 700;
	text-decoration: underline;
}

.farin-search__head {
	margin: 4px 0 0;
	font-size: 12px;
	font-weight: 700;
	color: #6b6580;
}

.farin-search__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.farin-search__chips a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-block-size: 36px;
	padding: 4px 12px 4px 4px;
	padding-inline: 4px 12px;
	border: 1px solid #e8e5ef;
	border-radius: 999px;
	color: #1d1730;
	text-decoration: none;
}

.farin-search__chips.is-plain a {
	padding-inline: 12px;
}

.farin-search__chips a:hover {
	border-color: #7b2cbf;
	color: #5f1f99;
}

.farin-search__chips img {
	inline-size: 28px;
	block-size: 28px;
	border-radius: 50%;
	object-fit: cover;
}

.farin-search__results {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.farin-search__results[hidden] {
	display: none;
}

.farin-search__row {
	display: grid;
	grid-template-columns: 44px 1fr auto;
	align-items: center;
	gap: 12px;
	min-block-size: 56px;
	padding: 6px 8px;
	border-radius: 10px;
	color: #1d1730;
	text-decoration: none;
}

.farin-search__row:not(:has(img)) {
	grid-template-columns: 1fr auto;
}

.farin-search__row:hover,
.farin-search__row[aria-selected="true"] {
	background: #f5edfc;
}

.farin-search__row img {
	inline-size: 44px;
	block-size: 44px;
	border-radius: 8px;
	object-fit: cover;
}

.farin-search__name {
	min-inline-size: 0;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	font-size: 14px;
	line-height: 1.7;
}

/* Now on its own line, the price before a sale small and struck above it. */
.farin-search__price {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	margin: 0;
	white-space: nowrap;
	line-height: 1.4;
}

.farin-search__price b {
	font-size: 14px;
	font-weight: 800;
}

.farin-search__price del {
	color: #9a94ab;
	font-size: 12px;
}

.farin-search__empty {
	margin: 0;
	padding: 8px;
	color: #6b6580;
}

.farin-search__all {
	margin-block-start: 4px;
	padding: 10px 8px;
	border-block-start: 1px solid #e8e5ef;
	color: #5f1f99;
	font-weight: 700;
	text-decoration: none;
}
