/**
 * Business Area Map — front end styles.
 * Light values live on the wrapper; .bam-is-dark overrides them.
 */

.bam-map-wrap {
	--bam-bg: #ffffff;
	--bam-fg: #1f2937;
	--bam-muted: #6b7280;
	--bam-border: rgba(15, 23, 42, 0.12);
	--bam-shadow: 0 6px 24px rgba(15, 23, 42, 0.14);
	--bam-hover: rgba(15, 23, 42, 0.05);
	--bam-accent: #2563eb;
	--bam-radius: 10px;

	position: relative;
	margin: 0 0 1.5em;
}

.bam-map-wrap.bam-is-dark {
	--bam-bg: #111827;
	--bam-fg: #e5e7eb;
	--bam-muted: #9ca3af;
	--bam-border: rgba(255, 255, 255, 0.14);
	--bam-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
	--bam-hover: rgba(255, 255, 255, 0.08);
	--bam-accent: #3b82f6;
}

.bam-map {
	width: 100%;
	min-height: 240px;
	border-radius: var(--bam-radius);
	overflow: hidden;
	background: #e5e7eb;
	z-index: 0;
}

.bam-map-wrap.bam-is-dark .bam-map {
	background: #1f2937;
}

.bam-noscript {
	padding: 1em;
	border: 1px solid var(--bam-border);
	border-radius: var(--bam-radius);
}

/* Leaflet chrome ------------------------------------------------------- */

.bam-map .leaflet-bar a,
.bam-map .leaflet-bar a:hover {
	background: var(--bam-bg);
	color: var(--bam-fg);
	border-bottom-color: var(--bam-border);
}

.bam-map .leaflet-bar a:hover {
	background: var(--bam-hover);
}

.bam-map .leaflet-control-attribution {
	background: var(--bam-bg);
	color: var(--bam-muted);
	font-size: 11px;
}

.bam-map .leaflet-control-attribution a {
	color: var(--bam-muted);
}

/* Layer panel ---------------------------------------------------------- */

.bam-panel {
	width: 234px;
	max-width: min(78vw, 300px);
	background: var(--bam-bg);
	color: var(--bam-fg);
	border: 1px solid var(--bam-border);
	border-radius: var(--bam-radius);
	box-shadow: var(--bam-shadow);
	font-size: 13px;
	line-height: 1.35;
	overflow: hidden;
}

.bam-panel__title {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 10px 12px;
	background: none;
	border: 0;
	border-radius: 0;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

.bam-panel__title:hover {
	background: var(--bam-hover);
}

.bam-panel__caret {
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-top: 6px solid currentColor;
	transition: transform 0.15s ease;
	flex: 0 0 auto;
}

.bam-panel.is-collapsed .bam-panel__caret {
	transform: rotate(-90deg);
}

.bam-panel.is-collapsed .bam-panel__body {
	display: none;
}

.bam-panel__body {
	border-top: 1px solid var(--bam-border);
	padding: 6px;
	max-height: 320px;
	overflow-y: auto;
}

.bam-panel__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bam-panel__item {
	margin: 0;
	padding: 0;
}

.bam-panel__label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 7px 8px;
	border-radius: 6px;
	cursor: pointer;
	margin: 0;
}

.bam-panel__label:hover {
	background: var(--bam-hover);
}

.bam-panel__label input[type="checkbox"] {
	margin: 2px 0 0;
	flex: 0 0 auto;
	accent-color: currentColor;
}

.bam-panel__swatch {
	width: 14px;
	height: 14px;
	margin-top: 2px;
	border-radius: 4px;
	flex: 0 0 auto;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.bam-panel__text {
	display: block;
	min-width: 0;
}

/* Group rows (a layer, or a category) and their expander */

.bam-panel__item--group {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
}

.bam-panel__item--group > .bam-panel__label {
	flex: 1;
	min-width: 0;
}

.bam-panel__expand {
	order: 2;
	flex: 0 0 auto;
	width: 26px;
	align-self: stretch;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 6px;
	color: var(--bam-muted);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bam-panel__expand:hover {
	background: var(--bam-hover);
	color: var(--bam-fg);
}

.bam-panel__expand .bam-panel__caret {
	transform: rotate(-90deg);
	transition: transform 0.15s ease;
}

.bam-panel__item--group.is-open .bam-panel__expand .bam-panel__caret {
	transform: none;
}

.bam-panel__item--group > .bam-panel__sub {
	order: 3;
	flex: 1 0 100%;
}

/* Shapes nested under their layer */

.bam-panel__sub {
	list-style: none;
	margin: 0 0 4px;
	padding: 0 0 0 18px;
	border-left: 1px solid var(--bam-border);
	margin-left: 15px;
}

.bam-panel__label--sub {
	padding: 5px 8px;
	font-size: 12.5px;
}

.bam-panel__item--group > .bam-panel__label .bam-panel__name {
	font-weight: 600;
}

/* Swatches shaped like the thing they stand for */

.bam-panel__swatch--dot {
	border-radius: 50%;
}

.bam-panel__swatch--line {
	height: 4px;
	margin-top: 7px;
	border-radius: 2px;
	box-shadow: none;
}

.bam-panel__swatch--glyph {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none !important;
	box-shadow: none;
	width: 15px;
	height: 15px;
	margin-top: 1px;
}

.bam-panel__swatch--glyph svg {
	display: block;
}

.bam-panel__swatch--img {
	background-size: cover;
	background-position: center;
	border-radius: 50%;
}

.bam-panel__name {
	display: block;
	font-weight: 500;
	word-break: break-word;
}

.bam-panel__note {
	display: block;
	color: var(--bam-muted);
	font-size: 11.5px;
	margin-top: 1px;
}

.bam-panel__empty {
	margin: 4px 8px 8px;
	color: var(--bam-muted);
}

.bam-panel__bulk {
	display: flex;
	gap: 6px;
	padding: 6px 4px 0;
}

.bam-panel__btn {
	flex: 1;
	padding: 6px 8px;
	margin-top: 6px;
	background: transparent;
	color: var(--bam-fg);
	border: 1px solid var(--bam-border);
	border-radius: 6px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}

.bam-panel__btn:hover {
	background: var(--bam-hover);
}

.bam-panel__btn--wide {
	display: block;
	width: calc(100% - 8px);
	margin: 6px 4px 4px;
}

/* Toolbar: style switcher, theme and 3D -------------------------------- */

.bam-toolbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
}

.bam-switch {
	display: flex;
	background: var(--bam-bg);
	border: 1px solid var(--bam-border);
	border-radius: 8px;
	box-shadow: var(--bam-shadow);
	overflow: hidden;
}

.bam-switch__btn {
	padding: 0 10px;
	height: 34px;
	background: transparent;
	color: var(--bam-fg);
	border: 0;
	border-right: 1px solid var(--bam-border);
	font: inherit;
	font-size: 12.5px;
	line-height: 34px;
	white-space: nowrap;
	cursor: pointer;
}

.bam-switch__btn:last-child {
	border-right: 0;
}

.bam-switch__btn:hover {
	background: var(--bam-hover);
}

.bam-switch__btn.is-active {
	background: var(--bam-accent, #2563eb);
	color: #fff;
	font-weight: 600;
}

.bam-toolbar__buttons {
	display: flex;
	gap: 6px;
}

.bam-iconbtn {
	width: 34px;
	height: 34px;
	padding: 0;
	background: var(--bam-bg);
	color: var(--bam-fg);
	border: 1px solid var(--bam-border);
	border-radius: 8px;
	box-shadow: var(--bam-shadow);
	font: inherit;
	font-size: 15px;
	line-height: 32px;
	cursor: pointer;
}

.bam-iconbtn--3d {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.bam-iconbtn:hover {
	background: var(--bam-hover);
}

.bam-iconbtn.is-active {
	background: var(--bam-accent, #2563eb);
	border-color: var(--bam-accent, #2563eb);
	color: #fff;
}

/* Monochrome tint swatches */

.bam-tints {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 5px;
	padding: 5px 6px;
	background: var(--bam-bg);
	border: 1px solid var(--bam-border);
	border-radius: 8px;
	box-shadow: var(--bam-shadow);
}

.bam-tints[hidden] {
	/* A class-level display would otherwise beat the UA [hidden] rule. */
	display: none;
}

.bam-tint {
	width: 20px;
	height: 20px;
	padding: 0;
	border: 1px solid var(--bam-border);
	border-radius: 50%;
	cursor: pointer;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.bam-tint.is-active {
	outline: 2px solid var(--bam-fg);
	outline-offset: 1px;
}

/* Basemap treatment (dark / monochrome tint) --------------------------- */

.bam-map .leaflet-tile-pane {
	filter: var(--bam-tile-filter, none);
}

/* Markers and popups --------------------------------------------------- */

.bam-pin {
	background: none;
	border: 0;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.bam-popup-wrap .leaflet-popup-content-wrapper,
.bam-popup-wrap .leaflet-popup-tip {
	background: var(--bam-bg, #fff);
	color: var(--bam-fg, #1f2937);
	box-shadow: var(--bam-shadow);
}

.bam-map-wrap.bam-is-dark .leaflet-popup-content-wrapper,
.bam-map-wrap.bam-is-dark .leaflet-popup-tip {
	background: #111827;
	color: #e5e7eb;
}

.bam-map-wrap.bam-is-dark .leaflet-popup-close-button {
	color: #9ca3af;
}

.bam-popup {
	font-size: 13px;
	line-height: 1.45;
}

.bam-popup__title {
	display: block;
	margin-bottom: 3px;
	font-size: 14px;
}

.bam-popup__link {
	display: inline-block;
	margin-top: 6px;
	word-break: break-all;
}

/* Small screens -------------------------------------------------------- */

@media (max-width: 600px) {
	.bam-panel {
		width: 190px;
		font-size: 12.5px;
	}

	.bam-panel__body {
		max-height: 210px;
	}

	.bam-switch__btn {
		padding: 0 8px;
		font-size: 11.5px;
	}

	.bam-iconbtn {
		width: 30px;
		height: 30px;
		line-height: 28px;
	}
}

/* UI overlay ----------------------------------------------------------- */

.bam-ui {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 1100;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	max-width: calc(100% - 20px);
	max-height: calc(100% - 20px);
}

.bam-map3d {
	width: 100%;
	min-height: 240px;
	border-radius: var(--bam-radius);
	overflow: hidden;
	background: #e5e7eb;
}

.bam-map-wrap.bam-is-dark .bam-map3d {
	background: #1f2937;
}

.bam-pin--3d svg {
	display: block;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.bam-map3d .maplibregl-ctrl-attrib {
	font-size: 11px;
}

.bam-status {
	position: absolute;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	z-index: 1200;
	padding: 7px 14px;
	background: var(--bam-bg);
	color: var(--bam-fg);
	border: 1px solid var(--bam-border);
	border-radius: 999px;
	box-shadow: var(--bam-shadow);
	font-size: 12.5px;
}

/* Satellite imagery reads better with light chrome on top of it */

.bam-map-wrap.bam-basemap-satellite .leaflet-control-attribution {
	background: rgba(255, 255, 255, 0.82);
}

/* Scroll-to-zoom hint --------------------------------------------------- */

.bam-scroll-hint {
	position: absolute;
	inset: 0;
	z-index: 900;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
	background: rgba(17, 24, 39, 0.55);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.18s ease, visibility 0.18s ease;
	pointer-events: none;
}

.bam-map.bam-show-hint .bam-scroll-hint {
	opacity: 1;
	visibility: visible;
}

.bam-popup__address {
	color: var(--bam-muted, #6b7280);
}
