/* ==========================================================================
   بازارچه: نقشه‌ی تمام‌صفحه (موبایل‌محور؛ در دسکتاپ پنل کناری)
   ========================================================================== */

.hm-app .hm-footer { display: none; }
.hm-app .hm-main { display: block; }

.bz {
	position: relative;
	height: calc(100vh - var(--hm-header-h, 100px));
	height: calc(100dvh - var(--hm-header-h, 100px));
	min-height: 460px;
	overflow: hidden;
	background: #dfe9e6;
	--bz-peek: 76px;
}

.bz__map { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
.bz .leaflet-container { font-family: var(--hm-font); }

/* ---------- نوار بالا: شهر + جستجو + چیپ‌ها ---------- */
.bz__top { position: absolute; z-index: 800; inset-inline: 0; top: 0; padding: 10px 12px 0; display: grid; gap: 8px; pointer-events: none; }
.bz__top > * { pointer-events: auto; }
.bz__row { display: flex; gap: 8px; }

.bz__city, .bz__search input, .bz__chip {
	font: inherit; min-height: 44px; border: 0; background: #fff; color: var(--hm-ink);
	box-shadow: 0 2px 10px rgba(10, 40, 38, .22); border-radius: 999px;
}
.bz__city { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; font-weight: 700; cursor: pointer; flex-shrink: 0; max-width: 46%; }
.bz__city span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz__city svg { color: var(--hm-primary); flex-shrink: 0; }
.bz__search { flex: 1; min-width: 0; }
.bz__search input { width: 100%; padding: 0 18px; }
.bz__search input::placeholder { color: #7a8b87; }

.bz__chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.bz__chips::-webkit-scrollbar { display: none; }
.bz__chip { flex-shrink: 0; padding: 0 16px; min-height: 38px; font-size: .875rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.bz__chip.is-on { background: var(--hm-primary); color: #fff; }
.bz__chip--clear { color: var(--hm-danger); }
.bz__chip[hidden] { display: none; }

/* ---------- موقعیت من ---------- */
.bz__locate {
	position: absolute; z-index: 800; inset-inline-start: 12px; top: 112px; width: 46px; height: 46px; border-radius: 50%;
	border: 0; background: #fff; color: var(--hm-primary); box-shadow: 0 2px 10px rgba(10, 40, 38, .25); cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.bz__locate:disabled { opacity: .6; cursor: wait; }

/* ---------- پنل پایین ---------- */
.bz__sheet {
	position: absolute; z-index: 900; inset-inline: 0; bottom: 0; height: var(--bz-peek);
	background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -4px 18px rgba(10, 40, 38, .22);
	display: flex; flex-direction: column; transition: height .22s ease; overflow: hidden;
}
.bz[data-state="open"] .bz__sheet { height: 64%; }
.bz__handle {
	flex: 0 0 var(--bz-peek); border: 0; background: transparent; font: inherit; cursor: pointer; color: var(--hm-ink);
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 6px 16px 8px;
}
.bz__grip { width: 44px; height: 5px; border-radius: 3px; background: #c4d0cd; }
.bz__count { font-weight: 800; font-size: .9375rem; }
.bz__list { flex: 1; overflow-y: auto; padding: 0 12px 16px; overscroll-behavior: contain; }

.bz__item {
	display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border: 0; border-bottom: 1px solid var(--hm-line);
	background: transparent; font: inherit; text-align: right; color: inherit; text-decoration: none; cursor: pointer;
}
.bz__item:hover { background: var(--hm-tint); }
.bz__logo {
	display: inline-flex; align-items: center; justify-content: center; flex: 0 0 52px; width: 52px; height: 52px; border-radius: 12px;
	background: var(--hm-tint); border: 1px solid var(--hm-line); color: var(--hm-primary); font-weight: 800; font-size: 1.25rem; overflow: hidden;
}
.bz__logo img { width: 100%; height: 100%; object-fit: cover; }
.bz__logo--lg { flex-basis: 64px; width: 64px; height: 64px; }
.bz__ibody { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.bz__iname { font-weight: 800; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz__imeta { color: var(--hm-muted); font-size: .8125rem; }
.bz__badge { align-self: flex-start; margin-top: 3px; padding: 1px 10px; border-radius: 6px; font-size: .75rem; font-weight: 700; background: #fff3d6; color: #6b4600; border: 1px solid #ecc977; }
.bz__empty { color: var(--hm-muted); text-align: center; padding: 20px 12px; margin: 0; }
.bz__more { display: block; margin: 12px auto; padding: 8px 22px; border-radius: 999px; border: 2px solid var(--hm-primary); background: #fff; color: var(--hm-primary); font: inherit; font-weight: 700; cursor: pointer; }
.bz__sub { font-size: 1rem; margin: 22px 0 2px; }
.bz__subnote { color: var(--hm-muted); font-size: .8125rem; margin: 0 0 4px; }

/* ---------- کارت فروشگاه انتخاب‌شده ---------- */
.bz__card {
	position: absolute; z-index: 950; inset-inline: 12px; bottom: calc(var(--bz-peek) + 12px);
	background: #fff; border-radius: 16px; box-shadow: 0 6px 24px rgba(10, 40, 38, .3); padding: 12px 14px 14px;
}
.bz__card[hidden] { display: none; }
.bz[data-state="open"] .bz__card { display: none; }
.bz__cclose { position: absolute; inset-inline-start: 8px; top: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--hm-tint); cursor: pointer; font-size: .875rem; }
.bz__ctop { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; padding-inline-start: 34px; }
.bz__cacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bz__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--hm-primary); color: var(--hm-primary); background: #fff; font-weight: 700; font-size: .875rem; text-decoration: none; }
.bz__btn:hover { background: var(--hm-tint); color: var(--hm-primary); }
.bz__btn--main { background: var(--hm-primary); color: #fff; flex: 1 1 100%; }
.bz__btn--main:hover { background: #0a524e; color: #fff; }

/* ---------- نشانگرها ---------- */
.bz-pin, .bz-cl { background: none; border: 0; }
.bz-pin__l {
	position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 8px)); white-space: nowrap;
	background: var(--hm-primary); color: #fff; font: 700 12px/1.6 var(--hm-font); padding: 2px 10px; border-radius: 999px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .35); border: 2px solid #fff;
}
.bz-pin__l::after { content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--hm-primary); }
.bz-pin.is-disc .bz-pin__l { background: var(--hm-accent); color: #1c1403; }
.bz-pin.is-disc .bz-pin__l::after { border-top-color: var(--hm-accent); }
.bz-pin.is-sel .bz-pin__l { background: #fff; color: var(--hm-ink); border-color: var(--hm-ink); font-size: 13px; }
.bz-pin.is-sel .bz-pin__l::after { border-top-color: var(--hm-ink); }
.bz-dot { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--hm-primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
.bz-pin.is-disc .bz-dot { background: var(--hm-accent); }
.bz-cl span {
	display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
	background: rgba(15, 109, 104, .9); color: #fff; font: 800 14px var(--hm-font); border: 3px solid rgba(255, 255, 255, .9);
	box-shadow: 0 0 0 6px rgba(15, 109, 104, .28), 0 2px 8px rgba(0, 0, 0, .3);
}

/* ---------- پنجره‌ی انتخاب شهر / صنف ---------- */
.bz__dlg { border: 0; border-radius: 18px; padding: 0; width: min(100% - 24px, 460px); max-height: 82vh; max-height: 82dvh; color: var(--hm-ink); font-family: var(--hm-font); }
.bz__dlg[open] { display: flex; flex-direction: column; }
.bz__dlg::backdrop { background: rgba(10, 30, 28, .55); }
.bz__dlg-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--hm-line); }
.bz__dlg-head h2 { flex: 1; margin: 0; font-size: 1.0625rem; }
.bz__dlg-head button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--hm-tint); font-size: 1.125rem; cursor: pointer; }
.bz__dlg-head button[hidden] { display: none; }
.bz__dlg-search { margin: 10px 14px 4px; font: inherit; min-height: 42px; padding: 0 14px; border: 1px solid #b9c7c3; border-radius: 10px; }
.bz__dlg-body { overflow-y: auto; padding: 4px 14px 14px; }
.bz__opt { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--hm-line); background: transparent; font: inherit; text-align: right; cursor: pointer; }
.bz__opt small { color: var(--hm-muted); }
.bz__opt.is-on { color: var(--hm-primary); font-weight: 800; }
.bz__opt--sub { padding-inline-start: 24px; font-size: .9375rem; }

/* منبع نقشه */
.bz__attr { position: absolute; z-index: 960; bottom: 3px; inset-inline-end: 10px; font: 11px/1.4 var(--hm-font); color: #55655f; background: rgba(255, 255, 255, .8); padding: 0 6px; border-radius: 4px; }
.bz__attr a { color: #1a5c8a; }
.bz .leaflet-control-zoom { display: none; }
.bz__list { padding-bottom: 26px; }

/* ---------- دسکتاپ: پنل کناری (راست) + نقشه (چپ) ---------- */
@media (min-width: 900px) {
	.bz { display: grid; grid-template-columns: 420px 1fr; grid-template-rows: auto 1fr; background: #fff; }
	.bz__map { position: relative; inset: auto; grid-column: 2; grid-row: 1 / 3; }
	.bz__top { position: relative; grid-column: 1; grid-row: 1; background: #fff; padding: 14px 16px 6px; border-bottom: 1px solid var(--hm-line); pointer-events: auto; z-index: 2; }
	.bz__city, .bz__search input, .bz__chip { box-shadow: none; border: 1px solid #b9c7c3; }
	.bz__chip.is-on { border-color: var(--hm-primary); }
	.bz__sheet { position: relative; grid-column: 1; grid-row: 2; height: auto !important; border-radius: 0; box-shadow: none; transition: none; z-index: 2; }
	.bz__handle { flex: 0 0 auto; cursor: default; align-items: flex-start; padding: 12px 16px 6px; pointer-events: none; }
	.bz__grip { display: none; }
	.bz .leaflet-control-zoom { display: block; }
	.bz__locate { inset-inline-start: auto; left: 10px; top: 104px; width: 34px; height: 34px; border-radius: 4px; box-shadow: 0 1px 5px rgba(0, 0, 0, .4); }
	.bz__locate svg { width: 18px; height: 18px; }
	.bz__attr { inset-inline-end: auto; left: 6px; bottom: 3px; }
	.bz__card { inset-inline: auto; left: 16px; bottom: 16px; width: 380px; max-width: calc(100% - 460px); }
	.bz[data-state="open"] .bz__card { display: block; }
	.bz__card[hidden] { display: none !important; }
}

@media (prefers-reduced-motion: reduce) { .bz__sheet { transition: none; } }
