/* =========================================================================
   Bonyan Zamin – Iran Interactive Map
   همه‌ی استایل‌ها با پیشوند .bnz-map-root محدود شده‌اند تا با قالب/دیوی تداخل نکنند.
   ========================================================================= */

.bnz-map-root,
.bnz-map-root * {
	box-sizing: border-box;
}

.bnz-map-root {
	--bnz-accent: #2c7da0;
	--bnz-accent-strong: #14556f;
	--bnz-prov: #cdd7e0;
	--bnz-prov-active: #cdd7e0;
	--bnz-stroke: rgba(255, 255, 255, 0.85);
	--bnz-ink: #1f2a37;
	--bnz-muted: #64748b;

	position: relative;
	width: 100%;
	margin: 0 auto;
	font-family: inherit;
	color: var(--bnz-ink);
	-webkit-tap-highlight-color: transparent;
}

.bnz-title {
	text-align: center;
	margin: 0 0 14px;
	font-weight: 700;
	font-size: clamp(18px, 2.4vw, 26px);
	letter-spacing: 0.2px;
}

/* ---------- Layout ---------- */
.bnz-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: clamp(12px, 2vw, 28px);
	width: 100%;
}

.bnz-map-wrap {
	position: relative;
	flex: 1 1 58%;
	min-width: 300px;
	border-radius: 22px;
	padding: 6px;
}

.bnz-panel {
	flex: 1 1 34%;
	min-width: 280px;
	display: flex;
}

.bnz-no-panel .bnz-panel {
	display: none;
}

.bnz-no-panel .bnz-map-wrap {
	flex-basis: 100%;
}

/* ---------- SVG map ---------- */
.bnz-svg {
	display: block;
	width: 100%;
	height: auto;
	max-height: var(--bnz-map-max-h, 520px);
	overflow: hidden; /* crop zoom/pan inside the map box */
	touch-action: pan-y;
	cursor: grab;
}

.bnz-svg.is-panning {
	cursor: grabbing;
}

.bnz-zoom {
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
	transform-origin: center center;
}

.bnz-zoom.no-anim {
	transition: none;
}

/* رنگ پیش‌فرض استان‌ها به‌صورت inline در SVG هم ست شده است
   (در bonyan-iran-map.php از ثابت‌های BNZMAP_COLOR_*)، بنابراین حتی اگر
   افزونه‌ی کش این فایل را حذف کند، نقشه سیاه نمی‌شود. */
.bnz-province {
	transition: fill 0.35s ease, opacity 0.35s ease, filter 0.35s ease;
	outline: none;
}

/* ---------- Seas & lake ---------- */
.bnz-sea {
	fill: var(--bnz-sea, #6caed8);
	stroke: none;
	pointer-events: none;
}

.bnz-province.is-active {
	cursor: pointer;
}

.bnz-province.is-active:hover,
.bnz-province.is-active:focus-visible {
	fill: var(--bnz-accent);
	filter: drop-shadow(0 4px 10px rgba(20, 85, 111, 0.35));
}

.bnz-province.is-selected {
	fill: var(--bnz-accent-strong) !important;
	filter: drop-shadow(0 5px 14px rgba(20, 85, 111, 0.45));
}

/* استان‌های بدون اطلاعات: کم‌رنگ و غیرفعال */
.bnz-province:not(.is-active) {
	opacity: 0.55;
}

/* ---------- Logos ---------- */
.bnz-logo {
	transform-box: fill-box;
	transform-origin: center;
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
	pointer-events: none;
	filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.28));
}

.bnz-logo.is-emph {
	transform: scale(1.16);
}

/* ---------- Tooltip ---------- */
.bnz-tooltip {
	position: absolute;
	z-index: 6;
	top: 0;
	left: 0;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	color: #fff;
	white-space: nowrap;
	background: rgba(20, 30, 40, 0.82);
	border-radius: 999px;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	pointer-events: none;
	opacity: 0;
	transform: translate(-50%, -140%) scale(0.9);
	transition: opacity 0.18s ease, transform 0.18s ease;
}

.bnz-tooltip.is-visible {
	opacity: 1;
	transform: translate(-50%, -160%) scale(1);
}

/* ---------- Controls ---------- */
.bnz-controls {
	position: absolute;
	left: 14px;
	bottom: 14px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.bnz-controls-mid,
.bnz-controls-zoom {
	display: flex;
	align-items: center;
	gap: 4px;
}

/* keep left button on the left even inside an RTL page */
.bnz-controls-mid {
	direction: ltr;
}

.bnz-controls-zoom {
	margin-top: 6px;
	flex-direction: column;
	gap: 2px;
}

.bnz-btn {
	width: 30px;
	height: 30px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #1a1a1a;
	cursor: pointer;
	border: 0;
	background: transparent;
	padding: 0;
	transition: transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
	filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.7));
}

.bnz-btn svg {
	width: 20px;
	height: 20px;
	display: block;
}

.bnz-ico-chevron {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bnz-ico-home {
	fill: currentColor;
	stroke: none;
}

.bnz-home {
	width: 40px;
	height: 40px;
}

.bnz-home svg {
	width: 26px;
	height: 26px;
}

.bnz-btn:hover {
	color: var(--bnz-accent);
	transform: scale(1.18);
}

.bnz-btn:active {
	transform: scale(0.92);
}

/* ---------- Info panel (glass) ---------- */
.bnz-panel-inner {
	position: relative;
	width: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: clamp(18px, 2.5vw, 32px);
	border-radius: 24px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.28));
	backdrop-filter: blur(18px) saturate(1.25);
	-webkit-backdrop-filter: blur(18px) saturate(1.25);
	overflow: hidden;
}

.bnz-panel-empty {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-align: center;
	padding: 26px 10px;
	animation: bnz-fade 0.6s ease both;
}

.bnz-panel-empty-title {
	font-size: clamp(20px, 2.6vw, 30px);
	font-weight: 800;
	color: rgba(31, 42, 55, 0.28);
	letter-spacing: 0.5px;
}

.bnz-panel-empty-sub {
	font-size: 14px;
	font-weight: 500;
	color: rgba(31, 42, 55, 0.4);
}

.bnz-panel-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid rgba(31, 42, 55, 0.12);
}

.bnz-panel-province {
	font-size: clamp(18px, 2.2vw, 24px);
	font-weight: 800;
	color: var(--bnz-accent-strong);
}

.bnz-panel-count {
	font-size: 13px;
	font-weight: 600;
	color: var(--bnz-muted);
	white-space: nowrap;
}

.bnz-project-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: calc(var(--bnz-map-max-h, 520px) - 120px);
	overflow-y: auto;
}

.bnz-project-list::-webkit-scrollbar {
	width: 6px;
}
.bnz-project-list::-webkit-scrollbar-thumb {
	background: rgba(31, 42, 55, 0.2);
	border-radius: 999px;
}

.bnz-project {
	padding: 14px 16px;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.5);
	box-shadow: 0 4px 14px rgba(31, 42, 55, 0.08);
	opacity: 0;
	transform: translateY(12px);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bnz-project.bnz-in {
	animation: bnz-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.bnz-project:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(31, 42, 55, 0.14);
}

.bnz-project-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.6;
	margin: 0 0 4px;
	color: var(--bnz-ink);
}

.bnz-project-employer {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.6;
	color: var(--bnz-muted);
}

.bnz-project-employer::before {
	content: "کارفرما: ";
	color: rgba(31, 42, 55, 0.45);
}

.bnz-project-empty {
	text-align: center;
	color: var(--bnz-muted);
	font-size: 14px;
	padding: 20px 0;
}

/* ---------- Legend (راهنما) ---------- */
.bnz-legend {
	--bnz-legend-logo: 26px;
	position: absolute;
	top: 14px;
	z-index: 7;
}

.bnz-legend-right { right: 14px; }
.bnz-legend-left  { left: 14px; }

.bnz-legend-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	color: var(--bnz-ink);
	cursor: default;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.5);
	backdrop-filter: blur(10px) saturate(1.2);
	-webkit-backdrop-filter: blur(10px) saturate(1.2);
	box-shadow: 0 4px 14px rgba(31, 42, 55, 0.1);
	transition: background 0.25s ease, transform 0.25s ease;
}

.bnz-legend:hover .bnz-legend-toggle,
.bnz-legend:focus-within .bnz-legend-toggle {
	background: rgba(255, 255, 255, 0.72);
	transform: translateY(-1px);
}

.bnz-legend-panel {
	position: absolute;
	top: calc(100% + 10px);
	min-width: 250px;
	padding: 14px 16px;
	border-radius: 18px;
	border: 1px solid rgba(255, 255, 255, 0.6);
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.34));
	backdrop-filter: blur(18px) saturate(1.3);
	-webkit-backdrop-filter: blur(18px) saturate(1.3);
	box-shadow: 0 14px 40px rgba(31, 42, 55, 0.16);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px) scale(0.96);
	transition: opacity 0.28s ease,
		transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
		visibility 0s linear 0.28s;
	pointer-events: none;
}

.bnz-legend-right .bnz-legend-panel { right: 0; transform-origin: top right; }
.bnz-legend-left  .bnz-legend-panel { left: 0;  transform-origin: top left; }

.bnz-legend:hover .bnz-legend-panel,
.bnz-legend:focus-within .bnz-legend-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	transition-delay: 0s;
	pointer-events: auto;
}

.bnz-legend-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: var(--bnz-legend-logo) 1fr;
	gap: 10px 12px;
	align-items: center;
}

/* هر آیتم دو سلول گرید می‌شود تا نوشته‌ها دقیقاً هم‌راستا شروع شوند */
.bnz-map-root .bnz-legend-list .bnz-legend-item {
	display: contents;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bnz-map-root .bnz-legend-list .bnz-legend-item::before,
.bnz-map-root .bnz-legend-list .bnz-legend-item::marker {
	content: none;
}

.bnz-legend-icon {
	width: var(--bnz-legend-logo);
	height: var(--bnz-legend-logo);
	max-width: none;
	object-fit: contain;
	display: block;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
}

.bnz-legend-name {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--bnz-ink);
	white-space: nowrap;
}

/* راهنمای سمت راست (RTL): لوگو سمت راست (حاشیه)، نوشته سمت چپ (داخل باکس) */
.bnz-legend-right .bnz-legend-name {
	text-align: right;
}

/* راهنمای سمت چپ: لوگو سمت چپ (حاشیه)، نوشته سمت راست (داخل باکس) */
.bnz-legend-left .bnz-legend-list {
	direction: ltr;
}

.bnz-legend-left .bnz-legend-name {
	direction: rtl;
	text-align: left;
}

@media (max-width: 767px) {
	.bnz-legend-panel {
		min-width: 210px;
	}
	.bnz-legend-name {
		white-space: normal;
	}
}

/* ---------- Boxed (optional frame) ---------- */
.bnz-boxed .bnz-map-wrap {
	border: 1px solid rgba(31, 42, 55, 0.1);
	background: rgba(255, 255, 255, 0.35);
	box-shadow: 0 12px 40px rgba(31, 42, 55, 0.12);
}

.bnz-boxed .bnz-panel-inner {
	border: 1px solid rgba(255, 255, 255, 0.6);
	box-shadow: 0 12px 40px rgba(31, 42, 55, 0.12);
}

/* ---------- Animations ---------- */
@keyframes bnz-rise {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes bnz-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.bnz-panel-content.bnz-swap {
	animation: bnz-fade 0.35s ease both;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
	.bnz-layout {
		flex-direction: column;
	}
	.bnz-map-wrap,
	.bnz-panel {
		flex-basis: 100%;
		min-width: 0;
	}
	.bnz-svg {
		max-height: calc(var(--bnz-map-max-h, 520px) * 0.72);
	}
	.bnz-project-list {
		max-height: none;
	}
	.bnz-btn {
		width: 38px;
		height: 38px;
		font-size: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bnz-map-root * {
		transition: none !important;
		animation-duration: 0.001s !important;
	}
}
