/**
 * Three-term search bar (خدمت · شهر · بیمه) — shared by the homepage hero and every clinic archive.
 * Desktop: one joined bar (fields split by a hairline). Phone: stacked fields; on archives a full-screen form.
 * Field: 56px tall, label 11px above a 14px bold value (docs/website-redesign/archive-types.md).
 */

.fkz-sb {
	font-family: var(--fkz-font);
}

.fkz-sb--hero {
	background: transparent;
	margin-top: 12px;
	padding: 0;
	text-align: right;
	width: 100%;
}

.fkz-sb--hero .fkz-sb__fields {
	box-shadow: 0 8px 28px rgba(18, 44, 58, 0.08);
}

.fkz-sb__summary,
.fkz-sb__head,
.fkz-sb__field--area {
	display: none;
}

.fkz-sb__form {
	align-items: stretch;
	display: flex;
	gap: 10px;
	margin: 0;
}

/* ---------- joined bar ---------- */
.fkz-sb__fields {
	background: var(--fkz-neutral-btn);
	border: 1px solid var(--fkz-border);
	border-radius: var(--fkz-radius-xl);
	display: flex;
	flex: 1;
	min-width: 0;
}

.fkz-sb--hero .fkz-sb__fields {
	background: var(--fkz-bg-surface);
}


.fkz-sb__field {
	display: flex;
	flex: 1 1 0;
	min-width: 0;
	position: relative;
}

/* Empty fields: a short, faint hairline. Next to a filled (tinted) field: a full-height gap in the bar's own colour
   (white in the hero, the bar's grey in archives), so each term reads on its own. */
.fkz-sb__field + .fkz-sb__field::before {
	background: var(--fkz-border);
	bottom: 12px;
	content: "";
	position: absolute;
	right: 0;
	top: 12px;
	width: 1px;
	z-index: 1;
}

/* Archives only: between two empty fields the hairline is a bit stronger so it reads on the grey. */
.fkz-sb--archive .fkz-sb__field + .fkz-sb__field::before {
	background: #cfd7db;
}

.fkz-sb--archive .fkz-sb__field.is-filled + .fkz-sb__field::before,
.fkz-sb--archive .fkz-sb__field + .fkz-sb__field.is-filled::before,
.fkz-sb__field.is-filled + .fkz-sb__field::before,
.fkz-sb__field + .fkz-sb__field.is-filled::before {
	background: var(--fkz-neutral-btn);
	bottom: 0;
	top: 0;
	width: 2px;
}

.fkz-sb--hero .fkz-sb__field.is-filled + .fkz-sb__field::before,
.fkz-sb--hero .fkz-sb__field + .fkz-sb__field.is-filled::before {
	background: var(--fkz-bg-surface);
}

.fkz-sb__field:first-child {
	border-radius: 0 var(--fkz-radius-xl) var(--fkz-radius-xl) 0;
}

.fkz-sb__field:last-child,
.fkz-sb__field:nth-last-child(2):has(+ .fkz-sb__field--area) {
	border-radius: var(--fkz-radius-xl) 0 0 var(--fkz-radius-xl);
}

.fkz-sb__field.is-filled {
	background: var(--fkz-badge-insurance-bg);
}

.fkz-sb__field.is-open::before,
.fkz-sb__field.is-open + .fkz-sb__field::before {
	opacity: 0;
}

.fkz-sb__field.is-open {
	background: var(--fkz-bg-surface);
	border-radius: var(--fkz-radius-xl);
	box-shadow: 0 0 0 2px var(--fkz-primary);
	/* above the archive's sticky side column (.fkz-search__side, z 2, later in the page): with a tie the column covered
	   the open list (Mehdi 2026-11-10) */
	z-index: 5;
}

.fkz-sb__trigger {
	align-items: center;
	background: transparent !important;
	border: 0 !important;
	border-radius: inherit;
	box-shadow: none !important;
	color: var(--fkz-ink) !important;
	cursor: pointer;
	display: flex;
	flex: 1;
	font-family: var(--fkz-font);
	gap: 10px;
	min-height: 56px;
	min-width: 0;
	padding: 0 14px 0 40px;
	text-align: right;
}

.fkz-sb__icon {
	color: var(--fkz-muted);
	display: inline-flex;
	flex: none;
}

.fkz-sb__field.is-filled .fkz-sb__icon {
	color: var(--fkz-badge-insurance-fg);
}

.fkz-sb__texts {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.fkz-sb__label {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-micro);
	font-weight: 700;
	line-height: 1.5;
}

.fkz-sb__value {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-body);
	font-weight: 600;
	line-height: 1.6;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fkz-sb__field.is-filled .fkz-sb__label,
.fkz-sb__field.is-filled .fkz-sb__value {
	color: var(--fkz-badge-insurance-fg);
}

.fkz-sb__field.is-filled .fkz-sb__value {
	font-weight: 800;
}

.fkz-sb__clear {
	align-items: center;
	background: transparent !important;
	border: 0 !important;
	border-radius: var(--fkz-radius-pill);
	box-shadow: none !important;
	color: var(--fkz-badge-insurance-fg) !important;
	cursor: pointer;
	display: inline-flex;
	height: 28px;
	justify-content: center;
	left: 8px;
	padding: 0;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 28px;
	z-index: 1;
}

.fkz-sb__clear[hidden] {
	display: none;
}

/* ---------- dropdown ---------- */
.fkz-sb__menu {
	background: var(--fkz-bg-surface);
	border-radius: var(--fkz-radius-xl);
	box-shadow: var(--fkz-shadow-card);
	display: flex;
	flex-direction: column;
	gap: 2px;
	left: 0;
	max-height: 340px;
	min-width: 260px;
	padding: 10px;
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	z-index: 40;
}

.fkz-sb__menu[hidden] {
	display: none;
}

.fkz-sb__find {
	align-items: center;
	background: var(--fkz-neutral-btn);
	border: 1px solid var(--fkz-border);
	border-radius: var(--fkz-radius-md);
	color: var(--fkz-subtle);
	display: flex;
	flex: none;
	gap: 8px;
	margin: 0 0 4px;
	padding: 0 12px;
}

.fkz-sb__find input {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	color: var(--fkz-ink);
	flex: 1;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-secondary);
	min-width: 0;
	outline: 0;
	padding: 9px 0 !important;
}

.fkz-sb__list {
	display: flex;
	flex-direction: column;
	gap: 1px;
	overflow-y: auto;
}

.fkz-sb__opt {
	align-items: center;
	background: transparent !important;
	border: 0 !important;
	border-radius: var(--fkz-radius-md);
	box-shadow: none !important;
	color: var(--fkz-ink) !important;
	cursor: pointer;
	display: flex;
	flex: none;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-secondary);
	font-weight: 500;
	gap: 8px;
	justify-content: flex-start;
	padding: 9px 10px;
	text-align: right;
	width: 100%;
}

.fkz-sb__opt small {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-caption);
	margin-inline-start: auto;
}

.fkz-sb__opt:hover,
.fkz-sb__opt:focus-visible,
.fkz-sb__opt.is-current {
	background: var(--fkz-neutral-btn) !important;
	color: var(--fkz-primary-hover) !important;
}

.fkz-sb__opt--near {
	color: var(--fkz-primary) !important;
	font-weight: 800;
}

.fkz-sb__none {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-secondary);
	padding: 10px;
}

/* ---------- button ---------- */
.fkz-sb__go {
	align-items: center;
	background: var(--fkz-primary) !important;
	border: 0 !important;
	border-radius: var(--fkz-radius-xl);
	box-shadow: none !important;
	color: #fff !important;
	cursor: pointer;
	display: inline-flex;
	flex: none;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-body);
	font-weight: 800;
	gap: 8px;
	justify-content: center;
	min-height: 58px;
	padding: 0 28px;
}

.fkz-sb__go:hover,
.fkz-sb__go:focus-visible,
.fkz-sb__go:active {
	background: var(--fkz-primary-hover) !important;
	color: #fff !important;
}

/* Neighbourhoods are a phone-only field; on desktop they live in the «دقیق‌تر کنید» column. */
@media (min-width: 900px) {
	.fkz-sb__field.fkz-sb__field--area {
		display: none;
	}
}

/* Archive on desktop is live: a pick reloads the results, so no button. */
.fkz-sb--archive .fkz-sb__go {
	display: none;
}

.fkz-sb__memo {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-secondary);
	line-height: var(--fkz-lh-secondary);
	margin: 8px 4px 0;
}

/* On the hero's coloured background the message is white (design-system: white is allowed on dark grounds). */
.fkz-sb--hero .fkz-sb__memo,
.fkz-sb--hero .fkz-sb__memo strong,
.fkz-sb--hero .fkz-sb__memo a {
	color: #fff;
}

.fkz-sb--hero .fkz-sb__memo {
	margin: 10px 4px 0;
	text-align: right;
}

.fkz-sb__memo[hidden] {
	display: none;
}

.fkz-sb__memo strong {
	color: var(--fkz-ink);
}

.fkz-sb__memo a {
	color: var(--fkz-primary);
	font-weight: 700;
	text-decoration: none;
}

.fkz-sb-picker {
	display: none;
}

/* ---------- phone ---------- */
@media (max-width: 899px) {
	.fkz-sb__form,
	.fkz-sb__fields {
		flex-direction: column;
	}

	/* Phone: the same joined bar, stacked — fields touch top to bottom, split by a hairline. */
	.fkz-sb__fields {
		gap: 0;
	}

	.fkz-sb--hero .fkz-sb__fields {
		box-shadow: none;
	}

	/* Fields take their natural height on the phone (the desktop equal-width rule must not stretch them). */
	.fkz-sb__field {
		flex: none;
		flex-direction: column;
	}

	.fkz-sb__field:first-child {
		border-radius: var(--fkz-radius-xl) var(--fkz-radius-xl) 0 0;
	}

	.fkz-sb__field:last-child,
	.fkz-sb__field:nth-last-child(2):has(+ .fkz-sb__field--area[hidden]) {
		border-radius: 0 0 var(--fkz-radius-xl) var(--fkz-radius-xl);
	}

	.fkz-sb__field + .fkz-sb__field::before {
		bottom: auto;
		height: 1px;
		left: 14px;
		right: 14px;
		top: 0;
		width: auto;
	}

	.fkz-sb__field.is-filled + .fkz-sb__field::before,
	.fkz-sb__field + .fkz-sb__field.is-filled::before {
		height: 2px;
		left: 0;
		right: 0;
		width: auto;
	}


	.fkz-sb__field.is-open {
		border-radius: var(--fkz-radius-xl);
		box-shadow: 0 0 0 2px var(--fkz-primary);
	}

	.fkz-sb__clear {
		top: 28px;
	}

	.fkz-sb__menu {
		box-shadow: none;
		max-height: 240px;
		min-width: 0;
		padding: 0 10px 10px;
		position: static;
	}

	/* 16px keeps iOS from zooming the page while typing. */
	.fkz-sb__find input {
		font-size: 16px;
	}

	.fkz-sb__go {
		min-height: 52px;
		width: 100%;
	}

	/* archive: collapsed summary + full-screen form above the site header */
	.fkz-sb--archive .fkz-sb__summary {
		align-items: center;
		background: var(--fkz-bg-surface) !important;
		border: 1px solid var(--fkz-border) !important;
		border-radius: var(--fkz-radius-lg);
		box-shadow: none !important;
		color: var(--fkz-ink) !important;
		cursor: pointer;
		display: flex;
		font-family: var(--fkz-font);
		gap: 10px;
		justify-content: space-between;
		padding: 8px 10px 8px 8px;
		text-align: right;
		width: 100%;
	}

	.fkz-sb__summary-text {
		display: grid;
		min-width: 0;
	}

	.fkz-sb__summary-text strong {
		font-size: var(--fkz-fs-secondary);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.fkz-sb__summary-text small {
		color: var(--fkz-subtle);
		font-size: var(--fkz-fs-caption);
	}

	.fkz-sb__summary-go {
		align-items: center;
		background: var(--fkz-primary);
		border-radius: var(--fkz-radius-md);
		color: #fff;
		display: inline-flex;
		flex: none;
		height: 36px;
		justify-content: center;
		width: 36px;
	}

	.fkz-sb--archive .fkz-sb__form:not(.fkz-sb-sheet) {
		display: none;
	}

	/* The form is moved under <body> while open (no page layer can cover it) and shows as a bottom sheet:
	   as tall as its content, the page dimmed above it — the same joined fields as the hero. */
	.fkz-sb-sheet {
		background: var(--fkz-bg-surface);
		border-radius: 22px 22px 0 0;
		bottom: 0;
		box-shadow: 0 -10px 30px rgba(18, 44, 58, 0.18);
		display: flex;
		flex-direction: column;
		font-family: var(--fkz-font);
		gap: 0;
		left: 0;
		max-height: 88vh;
		position: fixed;
		right: 0;
		z-index: 2147483000;
	}

	.fkz-sb-backdrop {
		background: rgba(18, 44, 58, 0.45);
		inset: 0;
		position: fixed;
		z-index: 2147482999;
	}

	.fkz-sb-sheet .fkz-sb__head {
		align-items: center;
		display: flex;
		flex: none;
		justify-content: space-between;
		padding: 12px 16px 8px;
	}

	.fkz-sb__title {
		color: var(--fkz-ink);
		font-size: 16px;
		font-weight: 800;
	}

	.fkz-sb__close {
		align-items: center;
		background: var(--fkz-neutral-btn) !important;
		border: 0 !important;
		border-radius: var(--fkz-radius-md);
		box-shadow: none !important;
		color: var(--fkz-ink) !important;
		cursor: pointer;
		display: inline-flex;
		height: 36px;
		justify-content: center;
		padding: 0;
		width: 36px;
	}

	.fkz-sb-sheet .fkz-sb__fields {
		background: var(--fkz-neutral-btn);
		border: 1px solid var(--fkz-border);
		border-radius: var(--fkz-radius-xl);
		flex: 0 1 auto;
		margin: 0 16px 12px;
		overflow-y: auto;
	}

	.fkz-sb-sheet .fkz-sb__field--area:not([hidden]) {
		display: flex;
	}

	.fkz-sb-sheet .fkz-sb__go {
		border-radius: var(--fkz-radius-lg);
		display: inline-flex;
		flex: none;
		margin: 0 16px calc(14px + env(safe-area-inset-bottom, 0px));
		width: calc(100% - 32px);
	}

	/* ---------- phone sheet, v3: rows + a picker screen ---------- */
	.fkz-sb-sheet {
		overflow: hidden;
		position: fixed;
	}

	/* while a picker is open the sheet is tall, so a long list has room */
	.fkz-sb-sheet.is-picking {
		height: 88vh;
	}

	.fkz-sb-sheet .fkz-sb__fields {
		background: transparent;
		border: 0;
		gap: 8px;
		margin: 0 16px 12px;
	}

	.fkz-sb-sheet .fkz-sb__field,
	.fkz-sb-sheet .fkz-sb__field.is-filled {
		border-radius: var(--fkz-radius-lg) !important;
	}

	.fkz-sb-sheet .fkz-sb__field + .fkz-sb__field::before {
		display: none;
	}

	/* a row ends with a «›» (opens the picker) unless it holds a value (then ✕) */
	.fkz-sb-sheet .fkz-sb__field:not(.is-filled) .fkz-sb__trigger::after {
		border-bottom: 2px solid var(--fkz-muted);
		border-left: 2px solid var(--fkz-muted);
		content: "";
		height: 8px;
		margin-inline-start: auto;
		transform: rotate(45deg);
		width: 8px;
	}

	.fkz-sb-sheet .fkz-sb__field .fkz-sb__menu {
		display: none !important;
	}

	.fkz-sb-sheet .fkz-sb__field.is-open {
		box-shadow: none;
	}

	.fkz-sb-picker {
		background: var(--fkz-bg-surface);
		border-radius: 22px 22px 0 0;
		display: flex;
		flex-direction: column;
		inset: 0;
		opacity: 0;
		position: absolute;
		transform: translateX(24px);
		transition: opacity 0.16s ease, transform 0.16s ease;
		z-index: 5;
	}

	.fkz-sb-picker[hidden] {
		display: none;
	}

	.fkz-sb-picker.is-open {
		opacity: 1;
		transform: none;
	}

	.fkz-sb-picker__head {
		align-items: center;
		display: flex;
		flex: none;
		gap: 8px;
		padding: 12px 12px 8px;
	}

	.fkz-sb-picker__back {
		align-items: center;
		background: var(--fkz-neutral-btn) !important;
		border: 0 !important;
		border-radius: var(--fkz-radius-md);
		box-shadow: none !important;
		color: var(--fkz-ink) !important;
		cursor: pointer;
		display: inline-flex;
		height: 36px;
		justify-content: center;
		padding: 0;
		transform: scaleX(-1); /* chevron-left mirrored = points back (right) in RTL */
		width: 36px;
	}

	.fkz-sb-picker__title {
		color: var(--fkz-ink);
		font-size: 16px;
		font-weight: 800;
	}

	.fkz-sb-picker__find {
		flex: none;
		margin: 0 16px 8px;
	}

	.fkz-sb-picker__near {
		flex: none;
		margin: 0 8px;
		width: calc(100% - 16px);
	}

	.fkz-sb-picker__near[hidden] {
		display: none;
	}

	.fkz-sb-picker__list {
		display: flex;
		flex: 1;
		flex-direction: column;
		overflow-y: auto;
		padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px));
	}

	.fkz-sb-picker__row {
		align-items: center;
		background: transparent !important;
		border: 0 !important;
		border-bottom: 1px solid var(--fkz-border) !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		color: var(--fkz-ink) !important;
		cursor: pointer;
		display: flex;
		flex: none;
		font-family: var(--fkz-font);
		font-size: var(--fkz-fs-body);
		gap: 8px;
		min-height: 52px;
		padding: 0 4px;
		text-align: right;
		width: 100%;
	}

	.fkz-sb-picker__row small {
		color: var(--fkz-subtle);
		font-size: var(--fkz-fs-caption);
		margin-inline-start: auto;
	}

	/* the chosen row: the same filled look as the filter buttons (search-archive.css .fkz-sr__qbtn.is-on); no tick (Sina 2026-11-03), aria-selected tells screen readers */
	.fkz-sb-picker__row.is-current {
		background: var(--fkz-badge-insurance-bg) !important;
		border-bottom-color: transparent !important;
		border-radius: var(--fkz-radius-lg) !important;
		color: var(--fkz-badge-insurance-fg) !important;
		font-weight: 800;
		padding: 0 12px;
	}

	.fkz-sb-picker__row.is-current small {
		margin-inline-start: 8px;
	}

	html.fkz-sb-lock,
	html.fkz-sb-lock body {
		overflow: hidden;
	}

	/* the mother sheet's handle (sheet.css): only while the form is the sheet */
	.fkz-sb__form > .fkz-sheet-handle {
		display: none;
	}

	.fkz-sb-sheet > .fkz-sheet-handle {
		display: block;
		margin: 10px auto -4px;
	}

	/* hero (home, 404): a field opens its picker on its own as a bottom sheet, the same screen as the results page
	   (Mehdi 2026-11-10); moved under <body> while open (search-archive.js openSolo) */
	.fkz-sb-picker.fkz-sb-picker--solo {
		bottom: 0;
		box-shadow: 0 -10px 30px rgba(18, 44, 58, 0.18);
		font-family: var(--fkz-font);
		height: 88vh;
		inset: auto 0 0;
		position: fixed;
		transform: translateY(24px);
		z-index: 2147483000;
	}

	.fkz-sb-picker.fkz-sb-picker--solo.is-open {
		transform: none;
	}
}

/* Archive look with hero behaviour (404, J2.2): picks are staged, so the button shows, and on phones the fields stay inline. */
.fkz-sb--archive[data-mode="hero"] .fkz-sb__go {
	display: inline-flex;
}

@media (max-width: 899px) {
	.fkz-sb--archive[data-mode="hero"] .fkz-sb__form:not(.fkz-sb-sheet) {
		display: flex;
	}
}

/* «نمایش نتایج» pressed: a short loading state until the results page opens (J1.6). */
.fkz-sb__form.is-applying .fkz-sb__fields {
	opacity: 0.55;
	pointer-events: none;
}

.fkz-sb__form.is-applying .fkz-sb__go {
	pointer-events: none;
}

.fkz-sb__form.is-applying .fkz-sb__go svg {
	display: none;
}

.fkz-sb__form.is-applying .fkz-sb__go::before {
	animation: fkz-sb-spin 0.8s linear infinite;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-radius: 50%;
	border-top-color: #fff;
	content: "";
	height: 16px;
	width: 16px;
}

@keyframes fkz-sb-spin {
	to {
		transform: rotate(360deg);
	}
}
