/* FZ Map – nutzt die globalen Elementor-Variablen (--color-*), Fallbacks = aktuelle Werte. */

.kb-map-interactive {
	--kb-map-radius: 12px;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
	min-width: 0;
	font-family: inherit;
}

/* ---------- Steuerung (Hintergrund + Ebenen) */
.kb-map-interactive__toggle {
	display: none;
}

@media (max-width: 767px) {
	.kb-map-interactive__toggle {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 12px 16px;
		border: 1px solid var(--color-eyebrow-border, rgba(30, 57, 84, .25));
		border-radius: 999px;
		background: var(--color-surface, #fff);
		color: var(--color-primary, #1e3954);
		font: inherit;
		font-size: 16px;
		font-weight: 600;
		cursor: pointer;
	}

	.kb-map-interactive__toggle svg {
		width: 20px;
		height: 20px;
		transition: transform .2s;
	}

	.is-controls-open .kb-map-interactive__toggle svg {
		transform: rotate(180deg);
	}

	.kb-map-interactive .kb-map-interactive__controls {
		display: none;
	}

	.kb-map-interactive.is-controls-open .kb-map-interactive__controls {
		display: flex;
	}
}

.kb-map-interactive__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 16px 32px;
}

.kb-map-interactive__group {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.kb-map-interactive__legend-title {
	margin-bottom: 8px;
	padding: 0;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--color-text-muted, #5b5e62);
}

.kb-map-interactive__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.kb-map-interactive__segmented {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--color-eyebrow-border, rgba(30, 57, 84, .25));
	border-radius: 999px;
	background: var(--color-surface, #fff);
}

.kb-map-interactive__segment {
	position: relative;
	cursor: pointer;
}

.kb-map-interactive__segment input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.kb-map-interactive__segment span {
	display: block;
	padding: 7px 14px;
	border-radius: 999px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--color-text, #14191e);
	transition: background .2s, color .2s;
}

.kb-map-interactive__segment input:checked + span {
	background: var(--color-primary, #1e3954);
	color: #fff;
}

.kb-map-interactive__segment input:focus-visible + span {
	outline: 2px solid var(--color-blue, #0c436b);
	outline-offset: 2px;
}

.kb-map-interactive__chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px 6px 6px;
	border: 1px solid var(--color-eyebrow-border, rgba(30, 57, 84, .25));
	border-radius: 999px;
	background: var(--color-surface, #fff);
	color: var(--color-text, #14191e);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	user-select: none;
	transition: opacity .2s, border-color .2s;
}

.kb-map-interactive__chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.kb-map-interactive__chip:has(input:focus-visible) {
	outline: 2px solid var(--color-blue, #0c436b);
	outline-offset: 2px;
}

.kb-map-interactive__chip--radio:has(input:checked) {
	border-color: var(--color-primary, #1e3954);
	box-shadow: inset 0 0 0 1px var(--color-primary, #1e3954);
}

.kb-map-interactive__chip--radio {
	padding-left: 14px;
}

.kb-map-interactive__chip--radio:has(input:checked) {
	padding-left: 6px;
}

.kb-map-interactive__chip--radio:has(input:not(:checked)) .kb-map-interactive__swatch {
	display: none;
}

.kb-map-interactive__chip:not(.kb-map-interactive__chip--radio):has(input:not(:checked)) {
	opacity: .5;
	border-style: dashed;
}

.kb-map-interactive__swatch {
	display: inline-grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--kb-map-layer);
	color: #fff;
}

.kb-map-interactive__swatch svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.kb-map-interactive__swatch--region {
	background: none;
	border: 3px solid var(--color-primary, #1e3954);
	box-sizing: border-box;
}

.kb-map-interactive__swatch--gemeinden {
	background: none;
	border: 1.5px dashed var(--color-primary, #1e3954);
	box-sizing: border-box;
}

.kb-map-interactive__swatch--rail {
	background: repeating-linear-gradient(90deg, #fff 0 5px, var(--color-primary, #1e3954) 5px 10px);
	box-shadow: inset 0 0 0 5px var(--color-primary, #1e3954);
	border-radius: 4px;
	height: 12px;
}

.kb-map-interactive__swatch--railregional {
	background: repeating-linear-gradient(90deg, #fff 0 4px, var(--color-bg-blue, #7490a6) 4px 8px);
	box-shadow: inset 0 0 0 3px var(--color-bg-blue, #7490a6);
	border-radius: 4px;
	height: 9px;
}

.kb-map-interactive__swatch--motorway {
	background: #d9480f;
	box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px rgba(20, 25, 30, .2);
	border-radius: 4px;
	height: 10px;
}

.kb-map-interactive__swatch--stations {
	background: var(--color-primary, #1e3954) no-repeat center / 15px 15px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' fill-rule='evenodd' d='M8 2h8a4 4 0 0 1 4 4v9a3 3 0 0 1-3 3l2 3h-2.4l-2-3H9.4l-2 3H5l2-3a3 3 0 0 1-3-3V6a4 4 0 0 1 4-4zM7 6v5h10V6H7zm1.5 7.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm7 0a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z'/%3E%3C/svg%3E");
}

.kb-map-interactive__swatch--school_ahs { background: #0c436b; border-radius: 5px; height: 18px; }
.kb-map-interactive__swatch--school_bhs { background: #2e7d32; border-radius: 5px; height: 18px; }
.kb-map-interactive__swatch--school_fs { background: #7b3fa0; border-radius: 5px; height: 18px; }
.kb-map-interactive__swatch--school_bs { background: #00838f; border-radius: 5px; height: 18px; }

.kb-map-interactive__swatch--heat {
	background: radial-gradient(circle, #a8261d 0%, #e5732a 30%, #f0d100 55%, #8fa8bd 80%, #b8c7d4 100%);
}

.kb-map-interactive__chip:has(input:not(:checked)) .kb-map-interactive__swatch {
	background: var(--color-text-muted, #5b5e62);
	border-color: var(--color-text-muted, #5b5e62);
	filter: grayscale(1);
	opacity: .5;
}

/* ---------- Karte */
.kb-map-interactive__canvas {
	/* Volle Inhaltsbreite; Höhe aus der Form der Region (Südweststeiermark ≈ 1,31 : 1, inkl. Innenabstand),
	   begrenzt auf 320 px … 80 % der Bildschirmhöhe. */
	width: 100%;
	aspect-ratio: var(--kb-map-aspect, 1.28);
	min-height: 320px;
	max-height: 80vh;
	max-height: 80svh;
	border-radius: var(--kb-map-radius);
	background: var(--color-bg-subtle, #eaeff2);
	overflow: hidden;
	position: relative;
	z-index: 0; /* eigener Stacking-Context: Leaflet-Panes nicht über Header/Menü */
	font: inherit;
}

/* Handy: Karte von Rand zu Rand (aus dem Seitenrand des Inhaltsbereichs herausgezogen) */
@media (max-width: 767px) {
	.kb-map-interactive:not(.is-fullscreen) .kb-map-interactive__canvas {
		width: 100vw;
		max-width: none;
		margin-inline: calc(50% - 50vw);
		border-radius: 0;
	}
}

.kb-map-interactive__canvas:focus-visible {
	outline: 2px solid var(--color-blue, #0c436b);
	outline-offset: 2px;
}

.kb-map-interactive .leaflet-container,
.fz-map-admin .leaflet-container {
	background: var(--color-bg-subtle, #eaeff2);
	font: inherit;
}

/* Eigene Kartengrafik „Übersicht“ (base.json) */
.leaflet-container path.fz-map-plan-land {
	fill: var(--color-surface, #fff);
	fill-opacity: .45;
	stroke: var(--color-blue-30, rgba(12, 67, 107, .3));
	stroke-width: 1.2;
}

.leaflet-container path.fz-map-plan-focus {
	fill: var(--color-surface, #fff);
	fill-opacity: 1;
}

.leaflet-container path.fz-map-plan-bezirk {
	stroke: var(--color-blue-30, rgba(12, 67, 107, .3));
	stroke-opacity: .7;
	stroke-dasharray: 3 3;
}

.leaflet-container path.fz-map-plan-focus-line {
	stroke: var(--color-blue, #0c436b);
	stroke-linejoin: round;
}

.leaflet-container path.fz-map-plan-water {
	fill: #b9d4e6;
	fill-opacity: 1;
}

.leaflet-container path.fz-map-plan-river {
	stroke: #8fb8d4;
	stroke-linejoin: round;
	stroke-linecap: round;
}

.fz-z-lt10 path.fz-map-plan-river:not(.is-major) {
	display: none;
}

.leaflet-container path.fz-map-plan-rail {
	stroke: var(--color-text-muted, #5b5e62);
	stroke-opacity: .75;
	stroke-linejoin: round;
}

/* Grenzen (Statistik Austria) */
.leaflet-container path.fz-map-gemeinde {
	fill: transparent;
	stroke: var(--color-primary, #1e3954);
	stroke-opacity: .35;
	stroke-dasharray: 4 3;
}

.leaflet-container path.fz-map-gemeinde.leaflet-interactive {
	cursor: pointer;
}

/* Hover/aktiv: Rand mit weißem Saum + leichter weißer Schleier – auch über der Heatmap sichtbar */
.leaflet-container path.fz-map-gemeinde:hover,
.leaflet-container path.fz-map-gemeinde.is-active {
	fill: #fff;
	fill-opacity: .18;
	stroke: var(--color-primary, #1e3954);
	stroke-opacity: .85;
	stroke-width: 2px;
	stroke-dasharray: none;
	stroke-linejoin: round;
	filter: drop-shadow(0 0 1px #fff);
}

/* Bei aktiver Heatmap Grenzlinien etwas kräftiger */
.is-heat-active .leaflet-container path.fz-map-gemeinde:not(:hover):not(.is-active) {
	stroke-opacity: .6;
}

.leaflet-container path.fz-map-region {
	fill: none;
	stroke: var(--color-primary, #1e3954);
	stroke-linejoin: round;
}

[data-basemap="ortho"] path.fz-map-region,
[data-basemap="ortho"] path.fz-map-gemeinde {
	stroke: #fff;
}

/* Verkehrsachsen (basemap.at / GIP) */
.leaflet-container path.fz-map-rail-casing {
	stroke: var(--color-primary, #1e3954);
}

.leaflet-container path.fz-map-railregional-casing {
	stroke: var(--color-bg-blue, #7490a6);
}

.leaflet-container path.fz-map-rail-inner {
	stroke: #fff;
}

.leaflet-container path.fz-map-motorway-casing {
	stroke: #fff;
}

.leaflet-container path.fz-map-motorway-inner {
	stroke: #d9480f;
}

.leaflet-container path.fz-map-line-hit {
	stroke: var(--color-accent, #f0d100);
	cursor: help;
}

.leaflet-container path.is-tunnel {
	stroke-dasharray: 4 5;
	stroke-opacity: .6;
}

.leaflet-container path.fz-map-rail-inner.is-tunnel,
.leaflet-container path.fz-map-motorway-casing.is-tunnel {
	display: none;
}

/* Bahnhaltestellen: Bahnhof-Icon im kleinen Schild */
.fz-map-station {
	background: none;
	border: 0;
}

.fz-map-station__pin {
	display: grid;
	place-items: center;
	width: 22px;
	height: 22px;
	border: 1.5px solid #fff;
	border-radius: 50%;
	background: var(--color-primary, #1e3954);
	color: #fff;
	box-shadow: 0 1px 4px rgba(20, 25, 30, .3);
	box-sizing: border-box;
	transition: transform .15s;
}

.fz-map-station__pin svg {
	width: 13px;
	height: 13px;
	fill: currentColor;
}

.fz-map-station:hover .fz-map-station__pin,
.fz-map-station:focus-visible .fz-map-station__pin {
	transform: scale(1.2);
}

/* Schulen: Kürzel im farbigen Schild */
.fz-map-school {
	background: none;
	border: 0;
}

.fz-map-school__pin {
	display: grid;
	place-items: center;
	width: 34px;
	height: 22px;
	border: 2px solid #fff;
	border-radius: 6px;
	background: var(--kb-map-layer);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .02em;
	line-height: 1;
	box-shadow: 0 2px 5px rgba(20, 25, 30, .3);
	box-sizing: border-box;
}

.fz-map-school:hover .fz-map-school__pin,
.fz-map-school:focus-visible .fz-map-school__pin {
	transform: scale(1.12);
}

/* Heatmap-Bild nimmt keine Maus-Ereignisse (Gemeinde-Tooltips darunter bleiben erreichbar) */
.leaflet-container img.fz-map-heat {
	pointer-events: none;
	image-rendering: auto;
}

.kb-map-interactive__heat-legend {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 14px;
	color: var(--color-text-muted, #5b5e62);
}

.kb-map-interactive__heat-legend[hidden] {
	display: none;
}

.kb-map-interactive__heat-legend p {
	margin: 0;
}

.kb-map-interactive__heat-head {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	align-items: baseline;
}

.kb-map-interactive__heat-label {
	font-weight: 600;
	color: var(--color-text, #14191e);
}

.kb-map-interactive__heat-count {
	color: var(--color-text, #14191e);
}

.kb-map-interactive__heat-unit {
	font-size: 13px;
}

.kb-map-interactive__heat-classes {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
	color: var(--color-text, #14191e);
}

.kb-map-interactive__heat-classes li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.kb-map-interactive__heat-swatch {
	width: 18px;
	height: 12px;
	border-radius: 3px;
	opacity: .85;
}

.kb-map-interactive__heat-note {
	font-size: 12px;
}

/* Marker */
.fz-map-marker {
	background: none;
	border: 0;
}

.fz-map-marker__pin {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--kb-map-layer, #0c436b);
	color: #fff;
	box-shadow: 0 2px 6px rgba(20, 25, 30, .3);
	box-sizing: border-box;
	transition: transform .15s;
}

.fz-map-marker__pin svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.fz-map-marker:hover .fz-map-marker__pin,
.fz-map-marker:focus-visible .fz-map-marker__pin,
.fz-map-marker.is-selected .fz-map-marker__pin {
	transform: scale(1.15);
}

.fz-map-marker:focus-visible {
	outline: none;
}

.fz-map-marker:focus-visible .fz-map-marker__pin,
.fz-map-marker.is-selected .fz-map-marker__pin {
	box-shadow: 0 0 0 3px var(--color-accent, #f0d100), 0 2px 6px rgba(20, 25, 30, .3);
}

/* Popup + Tooltip */
.fz-map-popup-wrap .leaflet-popup-content-wrapper {
	border-radius: 8px;
	box-shadow: 0 6px 24px rgba(20, 25, 30, .18);
}

.fz-map-popup-wrap .leaflet-popup-content {
	margin: 16px 20px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--color-text, #14191e);
}

.fz-map-popup p {
	margin: 0;
}

.fz-map-popup__title {
	font-weight: 600;
	font-size: 17px;
	color: var(--color-primary, #1e3954);
}

.fz-map-popup__title + .fz-map-popup__text {
	margin-top: 4px;
}

.fz-map-popup__text {
	white-space: pre-line;
	color: var(--color-text-muted, #5b5e62);
}

.fz-map-popup__link {
	display: inline-block;
	margin-top: 12px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--color-accent, #f0d100);
	color: var(--color-primary, #1e3954) !important;
	font-weight: 600;
	text-decoration: none;
}

.fz-map-popup__link:hover,
.fz-map-popup__link:focus-visible {
	background: var(--color-accent-dark, #deb600);
}

.fz-map-tooltip {
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	color: var(--color-primary, #1e3954);
}

.kb-map-interactive .leaflet-control-attribution {
	font-size: 11px;
	background: var(--color-surface-overlay, rgba(255, 255, 255, .75));
}

.kb-map-interactive .leaflet-bar a {
	color: var(--color-primary, #1e3954);
}

/* ---------- Textliste: nur für Screenreader/Suchmaschinen sichtbar */
.kb-map-interactive__list {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.kb-map-interactive__empty {
	padding: 40px;
	border: 1px dashed var(--color-blue-30, rgba(12, 67, 107, .3));
	border-radius: 12px;
	text-align: center;
	color: var(--color-text-muted, #5b5e62);
}

/* ---------- Vollbild */
.fz-map-fullscreen__btn {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: #fff;
	color: var(--color-primary, #1e3954);
	cursor: pointer;
}

.fz-map-fullscreen__btn:hover {
	background: #f4f4f4;
}

.fz-map-fullscreen__btn:focus-visible {
	outline: 2px solid var(--color-blue, #0c436b);
	outline-offset: 2px;
}

.fz-map-fullscreen__btn svg {
	width: 18px;
	height: 18px;
}

.kb-map-interactive.is-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 100000;
	box-sizing: border-box;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	padding: 16px;
	overflow-y: auto;
	background: var(--color-surface, #fff);
}

.kb-map-interactive.is-fullscreen .kb-map-interactive__canvas {
	flex: 1 1 auto;
	aspect-ratio: auto;
	min-height: 320px;
	max-height: none;
}

/* Seite dahinter nicht scrollen (CSS-Vollbild ohne Browser-Vollbild) */
.fz-map-has-fullscreen,
.fz-map-has-fullscreen body {
	overflow: hidden;
}

/* Karten-Buttons (Ebenen-Toggle, Vollbild): Marineblau mit weißer Schrift.
   Alle Zustände explizit, sonst greift das Theme (Hello Elementor: button:hover/:focus pink, bleibt am Handy nach Tippen hängen). */
.kb-map-interactive .kb-map-interactive__toggle,
.kb-map-interactive .kb-map-interactive__toggle:focus,
.kb-map-interactive .kb-map-interactive__toggle:active,
.kb-map-interactive .fz-map-fullscreen__btn,
.kb-map-interactive .fz-map-fullscreen__btn:focus,
.kb-map-interactive .fz-map-fullscreen__btn:active {
	border-color: var(--color-primary, #1e3954);
	background-color: var(--color-primary, #1e3954);
	color: #fff;
	text-decoration: none;
}

.kb-map-interactive .kb-map-interactive__toggle:hover,
.kb-map-interactive .fz-map-fullscreen__btn:hover {
	border-color: var(--color-blue, #0c436b);
	background-color: var(--color-blue, #0c436b);
	color: #fff;
}

.kb-map-interactive .fz-map-fullscreen {
	border: 0;
}

.kb-map-interactive .kb-map-interactive__toggle:focus:not(:focus-visible),
.kb-map-interactive .fz-map-fullscreen__btn:focus:not(:focus-visible) {
	outline: none;
}

.kb-map-interactive .kb-map-interactive__toggle:focus-visible,
.kb-map-interactive .fz-map-fullscreen__btn:focus-visible {
	outline: 2px solid var(--color-accent, #f0d100);
	outline-offset: 2px;
}

/* Handy: feinere Grenzlinien, Hervorhebung passend zum kleineren Maßstab */
@media (max-width: 767px) {
	.leaflet-container path.fz-map-region {
		stroke-width: 2px;
	}

	.leaflet-container path.fz-map-gemeinde {
		stroke-width: 1px;
		stroke-dasharray: 3 2;
	}

	.leaflet-container path.fz-map-gemeinde:hover,
	.leaflet-container path.fz-map-gemeinde.is-active {
		stroke-width: 1.5px;
		stroke-dasharray: none;
		fill-opacity: .22;
	}

	.fz-map-popup-wrap .leaflet-popup-content {
		margin: 12px 14px;
		font-size: 14px;
	}

	.fz-map-popup__title {
		font-size: 16px;
	}

	.fz-map-popup__link {
		margin-top: 8px;
		padding: 6px 14px;
	}
}
