/**
 * Clinic map (directory-map.php + directory-map.js): the block, pins, controls, phone full screen and floating button.
 * Shared by the directory page and the clinic search archive; where the block sits (sticky column, height) stays in each
 * page's own CSS. Architecture: docs/website-redesign/map-architecture.md.
 */
/* Clinic map (integration-architecture.md §7; pilot on «دانا تهران», directory-map-2026-10-27.md).
   Desktop: a sticky white block at the end of the sidebar, under the related articles; it stops above the compact signup card.
   Phones: no map in the page; the «نقشه» button in the search box opens it full screen. */
.fkz-directory-map {
	background: var(--fkz-bg-surface);
	border-radius: 20px;
	box-shadow: 0 4px 20px rgba(18, 44, 58, 0.05);
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	padding: 6px; /* thin white frame (Sina 2026-10-28); the map's corner is 20 − 6 = 14px so the two curves stay parallel */
}

.fkz-directory-map[hidden] {
	display: none !important;
}

.fkz-directory-map__head {
	align-items: center;
	display: flex;
	gap: 8px;
	min-height: 32px;
	padding: 0 6px 8px;
}

.fkz-directory-map__title {
	color: var(--fkz-ink);
	font-size: var(--fkz-fs-body);
	font-weight: 700;
}

.fkz-directory-map__count {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-caption);
}

.fkz-directory-map__close,
.fkz-directory-map__close:hover,
.fkz-directory-map__close:focus,
.fkz-directory-map__close:active {
	align-items: center;
	background: var(--fkz-neutral-btn);
	border: 0;
	border-radius: 50%;
	color: var(--fkz-ink);
	cursor: pointer;
	display: none;
	height: 36px;
	justify-content: center;
	margin-inline-start: auto;
	padding: 0;
	width: 36px;
}

.fkz-directory-map__canvas {
	background: var(--fkz-neutral);
	border-radius: 14px;
	font-family: var(--fkz-font);
	overflow: hidden;
	position: relative;
	z-index: 0;
}

.fkz-map-pin {
	--pin: var(--fkz-badge-insurance-fg); /* paid and free the same dark colour; free is only smaller (Sina 2026-10-28) */
	background: var(--pin);
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(18, 44, 58, 0.35);
	box-sizing: border-box;
}

/* thin stem under the circle; its tip is the place (directory-map.js PIN_STEM = 5px) */
.fkz-map-pin::after {
	background: var(--pin);
	border-radius: 0 0 1px 1px;
	content: "";
	height: 5px;
	left: 50%;
	position: absolute;
	top: 100%;
	transform: translateX(-50%);
	width: 2px;
}

.fkz-map-pin.is-paid {
	--pin: var(--fkz-badge-insurance-fg);
}

.fkz-map-pin.is-boost {
	outline: 3px solid var(--fkz-badge-insurance-bg);
}

/* Free pins that sit close together: one white circle with the count (§7.3); a click zooms in. */
.fkz-directory-map .fkz-map-cluster {
	align-items: center;
	background: var(--fkz-bg-surface);
	border: 2px solid var(--fkz-muted);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(18, 44, 58, 0.25);
	box-sizing: border-box;
	color: var(--fkz-ink);
	display: flex;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-caption);
	font-weight: 700;
	justify-content: center;
}

/* paid names that would cover another (directory-map.js declutter); hover or the card still shows them */
.fkz-directory-map .leaflet-tooltip.fkz-map-label.is-hidden:not(.is-hot) {
	display: none;
}

.fkz-directory-map .leaflet-tooltip.fkz-map-label {
	background: var(--fkz-bg-surface);
	border: 1px solid var(--fkz-card-line);
	border-radius: 8px;
	box-shadow: none;
	color: var(--fkz-ink);
	direction: rtl;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-caption);
	font-weight: 700;
	padding: 2px 8px;
}

/* Free pins: the name on hover, as the site's dark tag. */
.fkz-directory-map .leaflet-tooltip.fkz-map-label.is-hover {
	background: var(--fkz-ink);
	border-color: var(--fkz-ink);
	color: #fff;
}

.fkz-directory-map .leaflet-tooltip.fkz-map-label::before {
	display: none;
}

/* phones: a long name is cut with «…» (the pin's card shows it whole); declutter() hides one that still passes the edge */
@media (max-width: 899px) {
	.fkz-directory-map .leaflet-tooltip.fkz-map-label {
		max-width: 170px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
}

.fkz-directory-map .leaflet-control-attribution {
	font-size: var(--fkz-fs-micro);
}

/* The card a pin points to lights up for a moment. */
.fkc-po.is-map-hit .fkc-pc,
.fkc-cc.is-map-hit {
	outline: 2px solid var(--fkz-badge-insurance-fg);
	outline-offset: 2px;
}

/* Desktop: the pin of the card under the mouse — 8px bigger (new icon, directory-map.js), dark ink with a thick white ring,
   its name tag dark too; a light halo did not stand out on the light map (Sina 2026-10-28). */
.fkz-directory-map .fkz-map-pin.is-hot {
	--pin: var(--fkz-ink);
	border-width: 3px;
	box-shadow: 0 2px 8px rgba(18, 44, 58, 0.45);
}


.fkz-directory-map .leaflet-tooltip.fkz-map-label.is-hot {
	background: var(--fkz-ink);
	border-color: var(--fkz-ink);
	color: #fff;
}

.fkz-directory-map .fkz-map-cluster.is-hot {
	background: var(--fkz-ink);
	border-color: #fff;
	box-shadow: 0 2px 8px rgba(18, 44, 58, 0.45);
	color: #fff;
}

/* «موقعیت من»: hidden until directory-map.js moves it under the zoom buttons. */
.fkz-directory-map > .fkz-directory-map__me {
	display: none;
}

/* Map buttons (zoom, «موقعیت من»): white rounded boxes with a soft shadow instead of Leaflet's grey-bordered squares. */
.fkz-directory-map .leaflet-container .leaflet-bar {
	border: 0;
	border-radius: 12px;
	box-shadow: 0 2px 10px rgba(18, 44, 58, 0.16);
	overflow: hidden;
}

.fkz-directory-map .leaflet-container .leaflet-bar a,
.fkz-directory-map .leaflet-container .leaflet-bar a:hover,
.fkz-directory-map .leaflet-container .leaflet-bar a:focus {
	background: var(--fkz-bg-surface);
	border-bottom: 1px solid var(--fkz-card-line);
	color: var(--fkz-ink);
	font: 400 20px/36px var(--fkz-font);
	height: 36px;
	text-decoration: none;
	width: 36px;
}

.fkz-directory-map .leaflet-container .leaflet-bar a:last-child {
	border-bottom: 0;
}

.fkz-directory-map .leaflet-container .leaflet-bar a:hover {
	background: var(--fkz-neutral-btn);
}

body .fkz-directory-map__me,
body .fkz-directory-map__me:hover,
body .fkz-directory-map__me:focus,
body .fkz-directory-map__me:active {
	align-items: center;
	background: var(--fkz-bg-surface);
	border: 0;
	border-radius: 12px;
	box-shadow: 0 2px 10px rgba(18, 44, 58, 0.16);
	color: var(--fkz-ink);
	cursor: pointer;
	display: flex;
	height: 36px;
	justify-content: center;
	padding: 0;
	width: 36px;
}

body .fkz-directory-map__me:hover {
	background: var(--fkz-neutral-btn);
}

.fkz-directory-map__me.is-busy {
	color: var(--fkz-muted);
}

.fkz-directory-map .fkz-map-me i {
	background: #1a73e8; /* the usual «you are here» blue: unlike the teal clinic pins */
	border: 3px solid #fff;
	border-radius: 50%;
	box-shadow: 0 0 0 6px rgba(26, 115, 232, 0.2), 0 1px 3px rgba(18, 44, 58, 0.4);
	box-sizing: border-box;
	display: block;
	height: 100%;
	width: 100%;
}

/* Phones: the small card a pin tap opens at the bottom of the full-screen map. */
.fkz-directory-map__sheet {
	background: var(--fkz-bg-surface);
	border-radius: var(--fkz-radius-xl);
	bottom: calc(18px + env(safe-area-inset-bottom));
	box-shadow: 0 8px 24px rgba(18, 44, 58, 0.2);
	box-sizing: border-box;
	left: 18px;
	padding: 14px 14px 12px;
	position: absolute;
	right: 18px;
	z-index: 1000;
}

.fkz-directory-map__sheet[hidden] {
	display: none !important;
}

.fkz-directory-map__sheet-name {
	color: var(--fkz-ink);
	font-size: var(--fkz-fs-body);
	font-weight: 700;
	line-height: 1.6;
	padding-inline-end: 36px;
}

.fkz-directory-map__sheet-addr {
	color: var(--fkz-subtle);
	font-size: var(--fkz-fs-secondary);
	line-height: var(--fkz-lh-secondary);
	margin: 2px 0 12px;
}

.fkz-directory-map__sheet-act {
	display: flex;
	gap: 8px;
}

.fkz-directory-map__sheet-call,
.fkz-directory-map__sheet-call:hover,
.fkz-directory-map__sheet-call:focus,
.fkz-directory-map__sheet-call:active,
.fkz-directory-map__sheet-btn,
.fkz-directory-map__sheet-btn:hover,
.fkz-directory-map__sheet-btn:focus,
.fkz-directory-map__sheet-btn:active {
	align-items: center;
	background: var(--fkz-neutral-btn);
	border: 0;
	border-radius: 12px;
	color: var(--fkz-ink);
	cursor: pointer;
	display: inline-flex;
	flex: 1;
	font: inherit;
	font-size: var(--fkz-fs-secondary);
	font-weight: 700;
	justify-content: center;
	min-height: 40px;
	padding: 0 8px;
	text-decoration: none;
}

/* Our palette, never the theme link blue / gold hover (J1.9): dark teal with white text, ink on hover. */
.fkz-directory-map__sheet-call,
.fkz-directory-map__sheet-call:visited,
.fkz-directory-map__sheet-call:focus {
	background: var(--fkz-badge-insurance-fg) !important;
	color: #fff !important;
}

.fkz-directory-map__sheet-call:hover,
.fkz-directory-map__sheet-call:focus-visible,
.fkz-directory-map__sheet-call:active {
	background: var(--fkz-ink) !important;
	color: #fff !important;
}

/* Waiting for a pin's details: only a centred spinner, at the card's own height. */
.fkz-directory-map__sheet-wait {
	display: none;
}

.fkz-directory-map__sheet.is-waiting > * {
	display: none !important;
}

.fkz-directory-map__sheet.is-waiting > .fkz-directory-map__sheet-wait {
	align-items: center;
	display: flex !important;
	justify-content: center;
	min-height: 92px;
}

.fkz-directory-map__sheet-spin {
	animation: fkz-map-spin 0.8s linear infinite;
	border: 2px solid var(--fkz-border);
	border-radius: 50%;
	border-top-color: var(--fkz-badge-insurance-fg);
	height: 22px;
	width: 22px;
}

.fkz-directory-map__sheet-call[hidden],
.fkz-directory-map__sheet-btn[hidden] {
	display: none !important;
}

.fkz-directory-map__sheet-x,
.fkz-directory-map__sheet-x:hover,
.fkz-directory-map__sheet-x:focus,
.fkz-directory-map__sheet-x:active {
	align-items: center;
	background: var(--fkz-neutral-btn);
	border: 0;
	border-radius: 50%;
	color: var(--fkz-ink);
	cursor: pointer;
	display: flex;
	height: 30px;
	inset-inline-end: 10px;
	justify-content: center;
	padding: 0;
	position: absolute;
	top: 10px;
	width: 30px;
}

/* The card's «مسیریابی» sheet must open above the full-screen map and the floating «نقشه» button. */
html:root body .fkc-navsheet {
	z-index: 2147483100;
}

/* Phones: floating «نقشه» while the list is on screen and the search box is not. */
body .fkz-map-fab,
body .fkz-map-fab:hover,
body .fkz-map-fab:focus,
body .fkz-map-fab:active {
	align-items: center;
	background: var(--fkz-ink);
	border: 0;
	border-radius: 999px;
	/* above a Yektanet bottom unit when there is one (measured in site-shell.js, J1.3) */
	bottom: calc(20px + env(safe-area-inset-bottom) + var(--fkz-ad-bottom, 0px));
	box-shadow: 0 6px 18px rgba(18, 44, 58, 0.25);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-secondary);
	font-weight: 700;
	gap: 6px;
	left: 50%;
	min-height: 44px;
	padding: 0 18px;
	position: fixed;
	transform: translateX(-50%);
	z-index: 1000;
}

.fkz-map-fab[hidden] {
	display: none !important;
}

/* «موقعیت من» while the browser looks for the position: the icon turns; repeated taps wait. */
.fkz-directory-map__me.is-busy svg {
	animation: fkz-map-spin 0.9s linear infinite;
}

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

/* A message the visitor must see (no position, far away): a dark tag over the top of the map, not in the small count. */
.fkz-directory-map {
	position: relative;
}

.fkz-directory-map__note {
	align-items: center;
	background: var(--fkz-ink);
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(18, 44, 58, 0.25);
	box-sizing: border-box;
	color: #fff;
	cursor: pointer;
	display: flex;
	font-size: var(--fkz-fs-secondary);
	font-weight: 600;
	gap: 8px;
	left: 50%;
	line-height: 1.7;
	max-width: calc(100% - 40px);
	padding: 8px 12px;
	position: absolute;
	top: 56px;
	transform: translateX(-50%);
	width: max-content;
	z-index: 1100;
	animation: fkz-map-note 0.16s ease;
}

/* «جست‌وجو در این محدوده» (clinic archive): after the visitor moves the map; reloads the list for the visible area. */
.fkz-directory-map__area,
.fkz-directory-map__area:hover,
.fkz-directory-map__area:focus,
.fkz-directory-map__area:active {
	background: var(--fkz-bg-surface);
	border: 0;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(18, 44, 58, 0.18);
	color: var(--fkz-ink);
	cursor: pointer;
	font-family: var(--fkz-font);
	font-size: var(--fkz-fs-secondary);
	font-weight: 700;
	left: 50%;
	min-height: 40px;
	padding: 0 16px;
	position: absolute;
	top: 56px;
	transform: translateX(-50%);
	white-space: nowrap;
	z-index: 1050;
}

.fkz-directory-map__area:hover {
	color: var(--fkz-primary-hover);
}

.fkz-directory-map__area[hidden] {
	display: none !important;
}

.fkz-directory-map__note[hidden] {
	display: none !important;
}

.fkz-directory-map__note svg {
	flex-shrink: 0;
}

@keyframes fkz-map-note {
	from {
		opacity: 0;
		transform: translate(-50%, -4px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.fkz-directory-map__me.is-busy svg,
	.fkz-directory-map__note {
		animation: none;
	}
}

@media (max-width: 899px) {
	.fkz-directory-map {
		display: none;
	}

	.fkz-directory-map.is-full {
		border-radius: 0;
		display: flex;
		inset: 0;
		position: fixed;
		z-index: 2147483000;
	}

	.fkz-directory-map.is-full .fkz-directory-map__canvas {
		flex: 1;
	}

	.fkz-directory-map.is-full .fkz-directory-map__close {
		display: inline-flex;
	}

	html.fkz-map-open,
	html.fkz-map-open body {
		overflow: hidden;
	}
}

/* Phones: the «نقشه» chip in the list's search box (directory toolbar, archive name search); hidden on desktop. */
.fkz-directory-toolbar__map {
	display: none;
}

@media (max-width: 899px) {
	.fkz-directory-toolbar__map:not([hidden]),
	.fkz-directory-toolbar__map:not([hidden]):hover,
	.fkz-directory-toolbar__map:not([hidden]):focus,
	.fkz-directory-toolbar__map:not([hidden]):active {
		/* a tinted chip (same colours as the signup banner) so it reads as a button inside the search box */
		align-items: center;
		background: var(--fkz-badge-insurance-bg);
		border: 0;
		border-radius: 999px;
		color: var(--fkz-badge-insurance-fg);
		cursor: pointer;
		display: inline-flex;
		flex-shrink: 0;
		font: inherit;
		font-size: var(--fkz-fs-secondary);
		font-weight: 700;
		gap: 4px;
		margin-inline-end: -6px;
		min-height: 32px;
		padding: 0 12px;
	}
}

/* Clinic archive: its <main> is a stacking layer (z-index 1, for the bar's drop-downs) that would trap the full-screen map under
   the sticky header and the admin bar (close button hidden). While the map is open, that layer is dropped. */
html.fkz-map-open .fkz-search {
	z-index: auto;
}

/* spinner over the map while it loads (directory-map.js load(); Mehdi 2026-11-10) */
.fkz-directory-map__wait {
	align-items: center;
	background: var(--fkz-neutral);
	display: flex;
	inset: 0;
	justify-content: center;
	pointer-events: none;
	position: absolute;
	z-index: 1000;
}
