/**
 * Den Hartog Locatiekaart — frontend styles.
 * Full-bleed map met een zwevend paneel (overlay) + gegroepeerde checkbox-
 * filters met iconen. Theme-onafhankelijk (Avada-proof): alle interactieve
 * elementen zijn scoped en resetten Avada's globale button/anchor-overrides.
 */

.dhmap {
	--dh-orange: #d75915;     /* merk-oranje — markers/accenten */
	--dh-orange-ink: #b34d12; /* AA: ~5.3:1 op wit — tekst/badges */
	--dh-ev: #1b9e5a;
	--dh-wex: #33415c;
	--dh-ink: #1f2733;
	--dh-muted: #6b7686;
	--dh-line: #e7eaef;
	--dh-bg: #ffffff;
	--dh-soft: #f5f7fa;
	--dh-radius: 20px;
	--dh-radius-sm: 13px;
	--dh-radius-xs: 9px;
	--dh-shadow: 0 12px 40px rgba(18, 28, 45, 0.16);
	--dh-shadow-sm: 0 2px 10px rgba(18, 28, 45, 0.08);

	position: relative;
	/* Responsive default: ~72% of the viewport, clamped so it works on short
	   laptops and very tall/ultrawide screens. A `height` shortcode attr (px)
	   overrides this via --dhmap-height. */
	height: var(--dhmap-height, clamp(460px, 72vh, 900px));
	border-radius: var(--dh-radius);
	overflow: hidden;
	box-shadow: var(--dh-shadow-sm);
	font-family: inherit;
	color: var(--dh-ink);
	box-sizing: border-box;
}

.dhmap *,
.dhmap *::before,
.dhmap *::after { box-sizing: border-box; }

.dhmap button {
	font-family: inherit !important;
	line-height: 1.2 !important;
	cursor: pointer;
	border: 0;
	margin: 0;
	text-transform: none !important;
	letter-spacing: normal !important;
	box-shadow: none;
}

/* ---------- Map ---------- */

.dhmap__map { position: absolute; inset: 0; }
.dhmap__map:focus { outline: none; }

.dhmap__loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--dh-soft);
	z-index: 3;
	transition: opacity 0.3s ease;
}
.dhmap__loader.is-hidden { opacity: 0; pointer-events: none; }
.dhmap__spinner {
	width: 34px; height: 34px;
	border: 3px solid rgba(215, 89, 21, 0.25);
	border-top-color: var(--dh-orange);
	border-radius: 50%;
	animation: dhmap-spin 0.8s linear infinite;
}
@keyframes dhmap-spin { to { transform: rotate(360deg); } }

/* Cluster bubbles — crisp HTML markers (not SDF map text) */
.dhmap-cluster {
	display: flex; align-items: center; justify-content: center;
	border-radius: 50%;
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
	border: 3px solid #fff;
	box-shadow: 0 3px 10px rgba(18, 28, 45, 0.28);
	cursor: pointer;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	transition: transform 0.12s ease;
}
.dhmap-cluster:hover { transform: scale(1.06); }
.dhmap-cluster--wex { opacity: 0.94; font-weight: 600; }

/* "You are here" marker */
.dhmap-origin {
	width: 18px; height: 18px;
	border-radius: 50%;
	background: #2b6cff;
	border: 3px solid #fff;
	box-shadow: 0 0 0 4px rgba(43, 108, 255, 0.25);
}

/* ---------- Floating panel ---------- */

.dhmap__panel {
	position: absolute;
	top: 16px;
	left: 16px;
	z-index: 2;
	width: clamp(300px, 26vw, 400px);
	max-width: calc(100% - 32px);
	max-height: calc(100% - 32px);
	display: flex;
	flex-direction: column;
	background: var(--dh-bg);
	border-radius: var(--dh-radius);
	box-shadow: var(--dh-shadow);
	overflow: hidden;
}

.dhmap__panel-top {
	padding: 16px 16px 12px;
	border-bottom: 1px solid var(--dh-line);
	display: flex;
	flex-direction: column;
	gap: 12px;
}
/* Theme-proof: Avada styles h2 met hoge specificiteit, dus hard overschrijven. */
.dhmap h2.dhmap__title,
.dhmap .dhmap__title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 16px !important;
	line-height: 1.25 !important;
	font-weight: 700 !important;
	letter-spacing: -0.01em;
	color: var(--dh-ink) !important;
}

.dhmap__panel-body {
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	padding: 4px 16px 16px;
}

/* ---------- Search ---------- */

.dhmap__search { position: relative; margin: 0; }

.dhmap__search-field {
	display: flex;
	align-items: center;
	gap: 8px;
	background: var(--dh-bg);
	border: 1px solid var(--dh-line);
	border-radius: 999px;
	padding: 5px 5px 5px 14px;
	box-shadow: var(--dh-shadow-sm);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dhmap__search-field:focus-within {
	border-color: var(--dh-orange);
	box-shadow: 0 0 0 3px rgba(215, 89, 21, 0.14);
}
.dhmap__search-icon { color: var(--dh-muted); flex: 0 0 auto; }
.dhmap__search-input {
	flex: 1 1 auto;
	border: 0 !important;
	outline: 0;
	background: transparent !important;
	font-size: 16px; /* >=16px: voorkomt iOS Safari auto-zoom bij focus */
	padding: 8px 0 !important;
	color: var(--dh-ink);
	min-width: 0;
	box-shadow: none !important;
}
.dhmap__locate {
	flex: 0 0 auto;
	width: 38px; height: 38px;
	border-radius: 999px !important;
	background: var(--dh-soft) !important;
	color: var(--dh-ink) !important;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
	padding: 0 !important;
}
.dhmap__locate:hover { background: var(--dh-orange-ink) !important; color: #fff !important; }
.dhmap__locate.is-busy { animation: dhmap-spin 0.8s linear infinite; }

.dhmap__suggest {
	position: absolute;
	z-index: 5;
	top: calc(100% + 6px);
	left: 0; right: 0;
	margin: 0; padding: 6px;
	list-style: none;
	background: var(--dh-bg);
	border: 1px solid var(--dh-line);
	border-radius: var(--dh-radius-sm);
	box-shadow: var(--dh-shadow);
	max-height: 280px; overflow: auto;
}
.dhmap__suggest-item {
	padding: 9px 12px;
	border-radius: var(--dh-radius-xs);
	font-size: 14px;
	cursor: pointer;
	display: flex; align-items: center; gap: 9px;
}
.dhmap__suggest-item:hover,
.dhmap__suggest-item.is-active { background: var(--dh-soft); }
.dhmap__suggest-item svg { color: var(--dh-muted); flex: 0 0 auto; }

/* ---------- Layer toggles ---------- */

.dhmap__layers { display: flex; flex-wrap: wrap; gap: 7px; }

.dhmap__layer {
	display: inline-flex; align-items: center; gap: 7px;
	background: var(--dh-bg) !important;
	color: var(--dh-muted) !important;
	border: 1px solid var(--dh-line) !important;
	border-radius: 999px !important;
	padding: 6px 11px !important;
	font-size: 12.5px; font-weight: 600;
	transition: all 0.15s ease;
}
.dhmap__layer-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dh-wex); }
.dhmap__layer.is-own .dhmap__layer-dot { background: var(--dh-orange); }
.dhmap__layer-count { color: var(--dh-muted); font-weight: 600; opacity: 0.7; }
.dhmap__layer.is-active { color: var(--dh-ink) !important; border-color: var(--dh-ink) !important; background: var(--dh-soft) !important; }
.dhmap__layer.is-own.is-active { color: #fff !important; background: var(--dh-orange-ink) !important; border-color: var(--dh-orange-ink) !important; }
.dhmap__layer.is-own.is-active .dhmap__layer-dot { background: #fff; }
.dhmap__layer.is-own.is-active .dhmap__layer-count { color: rgba(255, 255, 255, 0.85); }

/* ---------- Filters (grouped checkboxes + icons) ---------- */

.dhmap__filters { display: flex; flex-direction: column; gap: 18px; padding-top: 14px; }
.dhmap__facet:first-child { margin-top: 0; }
.dhmap__facet-title {
	margin: 0 0 6px;
	font-size: 12px; font-weight: 700;
	text-transform: uppercase; letter-spacing: 0.05em;
	color: var(--dh-muted);
}

.dhmap__check {
	display: flex; align-items: center; gap: 11px;
	padding: 7px 2px;
	cursor: pointer;
	font-size: 14.5px;
	border-radius: var(--dh-radius-xs);
}
.dhmap__check:hover { background: var(--dh-soft); }
.dhmap__check[hidden] { display: none; }
.dhmap__check input { position: absolute; opacity: 0; width: 0; height: 0; }

.dhmap__check-box {
	flex: 0 0 auto;
	width: 20px; height: 20px;
	border: 2px solid var(--dh-line);
	border-radius: 7px;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background 0.12s ease, border-color 0.12s ease;
}
.dhmap__check-box svg { opacity: 0; color: #fff; transition: opacity 0.12s ease; }
.dhmap__check input:checked + .dhmap__check-box { background: var(--dh-orange); border-color: var(--dh-orange); }
.dhmap__check input:checked + .dhmap__check-box svg { opacity: 1; }
.dhmap__check input:focus-visible + .dhmap__check-box { box-shadow: 0 0 0 3px rgba(215, 89, 21, 0.25); }

.dhmap__check-icon { flex: 0 0 auto; width: 24px; color: var(--dh-muted); display: inline-flex; align-items: center; justify-content: center; }
.dhmap__check-name { flex: 1 1 auto; min-width: 0; }
.dhmap__check-count { color: var(--dh-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.dhmap__more {
	background: transparent !important;
	color: var(--dh-orange-ink) !important;
	border: 0 !important;
	padding: 6px 2px !important;
	font-size: 13.5px; font-weight: 600;
	display: inline-flex; align-items: center; gap: 5px;
}
.dhmap__more:hover { text-decoration: underline; }

.dhmap__filters-foot { display: flex; justify-content: flex-end; padding-top: 12px; }
.dhmap__reset {
	background: transparent !important;
	color: var(--dh-muted) !important;
	border: 0 !important;
	padding: 4px 2px !important;
	font-size: 13px; font-weight: 600;
	text-decoration: underline;
}
.dhmap__reset:hover { color: var(--dh-ink) !important; }

/* ---------- Results ---------- */

.dhmap__results { margin-top: 18px; border-top: 1px solid var(--dh-line); }
.dhmap__results-head {
	padding: 12px 2px 8px;
	font-size: 12px; font-weight: 700;
	text-transform: uppercase; letter-spacing: 0.05em;
	color: var(--dh-muted);
}
.dhmap__list { list-style: none; margin: 0; padding: 0; }
.dhmap__item {
	display: flex; align-items: flex-start; gap: 11px;
	padding: 11px 2px;
	border-top: 1px solid var(--dh-line);
	cursor: pointer;
	transition: background 0.12s ease;
}
.dhmap__item:hover { background: var(--dh-soft); }
.dhmap__item-dot {
	width: 11px; height: 11px; border-radius: 50%;
	margin-top: 4px; flex: 0 0 auto;
	background: var(--dh-wex);
	box-shadow: 0 0 0 3px rgba(51, 65, 92, 0.12);
}
.dhmap__item-dot--station { background: var(--dh-orange); box-shadow: 0 0 0 3px rgba(215, 89, 21, 0.15); }
.dhmap__item-dot--laadpunt { background: var(--dh-ev); box-shadow: 0 0 0 3px rgba(27, 158, 90, 0.15); }
.dhmap__item-body { flex: 1 1 auto; min-width: 0; }
.dhmap__item-title { display: block; font-weight: 600; font-size: 14.5px; }
.dhmap__item-addr {
	display: block; font-size: 13px; color: var(--dh-muted);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dhmap__item-dist {
	flex: 0 0 auto; font-size: 12px; font-weight: 700;
	color: var(--dh-orange-ink); background: rgba(215, 89, 21, 0.10);
	border-radius: 999px; padding: 3px 9px; margin-top: 2px;
}
.dhmap__badge {
	display: inline-block; font-size: 10px; font-weight: 700;
	text-transform: uppercase; letter-spacing: 0.03em;
	color: #fff; background: var(--dh-orange-ink);
	border-radius: 999px; padding: 2px 7px;
	vertical-align: middle; margin-left: 4px;
}
.dhmap__empty { padding: 18px 2px; color: var(--dh-muted); font-size: 14px; }

/* ---------- Info card (popup) ---------- */

/* Keep the info card above the HTML cluster markers. */
.dhmap-popup.maplibregl-popup { z-index: 5; }
.dhmap-cluster { z-index: 1; }
.dhmap-popup .maplibregl-popup-content {
	padding: 0; border-radius: var(--dh-radius); overflow: hidden;
	box-shadow: 0 14px 40px rgba(18, 28, 45, 0.22); font-family: inherit;
}
.dhmap-popup .maplibregl-popup-close-button {
	width: 28px; height: 28px; font-size: 20px; color: #fff;
	right: 6px; top: 6px; border-radius: 50%;
	background: rgba(0, 0, 0, 0.35); z-index: 2;
}
.dhmap-popup .maplibregl-popup-tip { display: none; }
.dhmap-card { width: 320px; max-width: 82vw; }
.dhmap-card__img { display: block; position: relative; height: 150px; background-size: cover; background-position: center; background-color: var(--dh-soft); }
a.dhmap-card__img { cursor: pointer; transition: filter 0.15s ease; }
a.dhmap-card__img:hover { filter: brightness(0.94); }

/* Status pill overlaid on the photo (or in body when no photo) */
.dhmap-card__status {
	position: absolute; left: 12px; bottom: 12px;
	display: inline-flex; align-items: center; gap: 7px;
	background: #fff; color: #137a44;
	font-size: 13px; font-weight: 700;
	border: 1.5px solid var(--dh-ev);
	border-radius: 999px; padding: 5px 12px;
	box-shadow: var(--dh-shadow-sm);
}
.dhmap-card__status::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--dh-ev); }
.dhmap-card__status--own { color: var(--dh-orange-ink); border-color: var(--dh-orange); }
.dhmap-card__status--own::before { background: var(--dh-orange); }
.dhmap-card__status-row { margin-bottom: 10px; }
.dhmap-card__status-row .dhmap-card__status { position: static; }

.dhmap-card__body { padding: 16px 18px 18px; }
.dhmap-card__title { margin: 0 0 12px; font-size: 20px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }

/* Address row with orange route/navigation circle */
.dhmap-card__addr-row { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.dhmap-card__nav {
	flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%;
	background: var(--dh-orange); color: #fff !important;
	display: inline-flex; align-items: center; justify-content: center;
	text-decoration: none !important; transition: filter 0.12s ease;
}
.dhmap-card__nav:hover { filter: brightness(0.93); }
.dhmap-card__addr { font-size: 14.5px; line-height: 1.3; color: var(--dh-muted); }

.dhmap-card__specs { display: flex; gap: 18px; margin: 0 0 14px; }
.dhmap-card__specs div { margin: 0; }
.dhmap-card__specs dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--dh-muted); }
.dhmap-card__specs dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; }

.dhmap-card__facs-title { margin: 0 0 10px; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.dhmap-card__facs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
/* Round, icon-only facility chips (name in tooltip/aria-label) */
.dhmap-card__fac {
	width: 46px; height: 46px; border-radius: 50%;
	background: var(--dh-soft); color: var(--dh-ink);
	display: inline-flex; align-items: center; justify-content: center;
}
.dhmap-card__fac--fuel { color: var(--dh-orange-ink); }
.dhmap-card__fac--ev { color: #137a44; }

/* Den Hartog icon images: sized per context (card chip vs filter row). */
.dhmap-fac-img { object-fit: contain; display: block; }
.dhmap-card__fac .dhmap-fac-img { width: 28px; height: 28px; }
.dhmap__check-icon .dhmap-fac-img { width: 22px; height: 22px; }

.dhmap-card__actions { display: flex; }
.dhmap-card__btn {
	flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	text-decoration: none !important; font-size: 16px; font-weight: 700;
	border-radius: 999px; padding: 14px 18px;
	background: var(--dh-soft); color: var(--dh-ink) !important;
	transition: filter 0.12s ease;
}
.dhmap-card__btn:hover { filter: brightness(0.96); }
.dhmap-card__btn--primary { background: var(--dh-orange); color: #fff !important; }

/* ---------- Responsive: panel wordt onderblad onder de kaart ---------- */

/* Phone: stack als uitleg (titel + zoekbalk) → kaart → filters/resultaten, zodat
   het adresveld meteen bovenaan staat en de kaart volledig aanklikbaar blijft. */
@media (max-width: 768px) {
	.dhmap {
		height: auto;
		display: flex;
		flex-direction: column;
		background: var(--dh-bg);
		border-radius: var(--dh-radius);
	}
	/* Paneel "uitpakken" zodat zijn twee helften om de kaart heen kunnen staan. */
	.dhmap__panel { display: contents; }
	.dhmap__panel-top { order: 1; background: var(--dh-bg); }
	.dhmap__map {
		order: 2;
		position: relative;
		height: 50vh; min-height: 300px;
		border-radius: 0;
	}
	.dhmap__panel-body {
		order: 3;
		background: var(--dh-bg);
		max-height: none;   /* meelopen in de pagina; geen geneste scroll */
		overflow: visible;
		border-top: 1px solid var(--dh-line);
	}
}

/* ---------- Mobiel: info-card als bottom sheet ---------- */

/* In <body> gerenderd (zodat geen themed transform de position:fixed breekt);
   draagt eigen design-tokens zodat de card identiek aan de desktop-popup oogt. */
.dhmap-sheet-backdrop {
	position: fixed; inset: 0; z-index: 99998;
	background: rgba(18, 28, 45, 0.45);
	opacity: 0; transition: opacity 0.2s ease;
}
.dhmap-sheet-backdrop.is-open { opacity: 1; }

.dhmap-sheet {
	--dh-orange: #d75915; --dh-orange-ink: #b34d12; --dh-ev: #1b9e5a;
	--dh-ink: #1f2733; --dh-muted: #6b7686; --dh-line: #e7eaef;
	--dh-bg: #ffffff; --dh-soft: #f5f7fa;
	--dh-radius: 20px; --dh-radius-sm: 13px; --dh-radius-xs: 9px;
	--dh-shadow-sm: 0 2px 10px rgba(18, 28, 45, 0.08);

	position: fixed; left: 0; right: 0; bottom: 0; z-index: 99999;
	max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
	background: var(--dh-bg);
	border-radius: var(--dh-radius) var(--dh-radius) 0 0;
	box-shadow: 0 -12px 40px rgba(18, 28, 45, 0.28);
	font-family: inherit; color: var(--dh-ink);
	transform: translateY(100%);
	transition: transform 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
.dhmap-sheet.is-open { transform: translateY(0); }
.dhmap-sheet *, .dhmap-sheet *::before, .dhmap-sheet *::after { box-sizing: border-box; }

.dhmap-sheet__close {
	position: absolute; right: 12px; top: 12px; z-index: 2;
	width: 36px; height: 36px; border: 0; border-radius: 50%;
	background: rgba(0, 0, 0, 0.4); color: #fff;
	font-size: 24px; line-height: 1; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.dhmap-sheet .dhmap-card { width: 100%; max-width: none; }
.dhmap-sheet .dhmap-card__img { height: 180px; }
/* Theme-proof binnen de sheet (buiten .dhmap, dus Avada-koppen hard overschrijven). */
.dhmap-sheet .dhmap-card__title { font-size: 19px !important; line-height: 1.15 !important; margin: 0 0 12px !important; }
.dhmap-sheet .dhmap-card__facs-title { font-size: 16px !important; margin: 0 0 10px !important; }

/* ---------- Touch-apparaten: comfortabele tap-targets (>=44px) ---------- */

/* Alleen op coarse pointers (vinger) — desktop blijft compact. */
@media (pointer: coarse) {
	.dhmap__locate { width: 44px; height: 44px; }
	.dhmap__check { min-height: 44px; }
	.dhmap__layer { padding: 9px 13px !important; }
	.dhmap__suggest-item { padding: 12px 12px; }
	.dhmap__more { padding: 10px 2px !important; }
	.dhmap__reset { padding: 9px 2px !important; }
	.dhmap-popup .maplibregl-popup-close-button { width: 36px; height: 36px; font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.dhmap__spinner, .dhmap__locate.is-busy { animation: none; }
	.dhmap * { transition: none !important; }
}
