/* WIR Karte – Kategorienfilter für MapPress */

mappress-map.wkf-on,
.mapp-layout.wkf-on {
	--wkf-green: #3f966a;
	--wkf-green-light: #57cc99;
	--wkf-green-soft: #eaf7f0;
	--wkf-blue: #22577a;
	--wkf-text: #1f2d27;
	--wkf-muted: #6b7c74;
	--wkf-line: #e4ece8;
	--wkf-hover: #f4f9f6;
	--wkf-font: Lato, Helvetica, Arial, sans-serif;
}

/* MapPress setzt Schrift und Farbe auf jedes Element (.mapp-layout *) */
.wkf-on .mapp-filter-all .mapp-dropdown-content,
.wkf-on .mapp-filter-all .mapp-dropdown-content * {
	font-family: var(--wkf-font);
}

.wkf-tree .wkf-label {
	color: var(--wkf-text);
}

/* ---------- Panel ---------- */

.wkf-on .mapp-filter-all .mapp-dropdown-content {
	display: flex;
	flex-direction: column;
	width: 390px;
	max-width: calc(100vw - 24px);
	padding: 0;
	border: 0;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 16px 48px rgba(20, 45, 35, .18), 0 2px 8px rgba(20, 45, 35, .08);
	overflow: hidden;
	font-family: inherit;
	color: var(--wkf-text);
	z-index: 1100; /* über den Leaflet-Kartenknöpfen (1000) */
}

.wkf-on .mapp-filter-all .mapp-filter-wrapper {
	flex: 1 1 auto;
	min-height: 0;
	max-height: none;
	overflow-y: auto;
	padding: 22px 20px 10px;
	-webkit-overflow-scrolling: touch;
}

.wkf-on .mapp-filter-wrapper > div + div {
	margin-top: 22px;
}

/* Überschriften (Suche + Kategorien) */
.wkf-on .mapp-filter-wrapper .mapp-filter-label,
.wkf-title {
	margin: 0 0 10px;
	padding: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .01em;
	color: var(--wkf-blue);
	text-transform: none;
}

/* Suchfeld */
.wkf-on .mapp-filter-wrapper .mapp-filter-text-values input[type="text"] {
	width: 100%;
	height: 48px;
	padding: 0 16px;
	border: 2px solid var(--wkf-line);
	border-radius: 12px;
	background: #fff;
	font-size: 17px;
	color: var(--wkf-text);
	box-shadow: none;
	transition: border-color .15s;
}

.wkf-on .mapp-filter-wrapper .mapp-filter-text-values input[type="text"]:focus {
	border-color: var(--wkf-green-light);
	outline: none;
}

/* Originale Liste bleibt für MapPress im DOM, wird aber ausgeblendet */
.wkf-enhanced > .mapp-filter-label,
.wkf-enhanced > .mapp-filter-values {
	display: none !important;
}

/* ---------- Baum ---------- */

.wkf-tree ul.wkf-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wkf-tree .wkf-node {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wkf-tree > .wkf-list > .wkf-node + .wkf-node {
	border-top: 1px solid var(--wkf-line);
}

.wkf-row {
	display: flex;
	align-items: center;
	gap: 0;
}

.wkf-spacer {
	flex: 0 0 48px;
}

.wkf-tree button {
	margin: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.wkf-check {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	align-items: center;
	gap: 14px;
	min-height: 52px;
	padding: 8px 4px 8px 10px;
	border-radius: 12px;
	text-align: left;
	transition: background-color .15s;
}

.wkf-check:hover,
.wkf-toggle:hover {
	background: var(--wkf-hover);
}

.wkf-check:focus-visible,
.wkf-toggle:focus-visible {
	outline: 3px solid var(--wkf-green-light);
	outline-offset: -3px;
}

.wkf-label {
	flex: 1 1 auto;
	-webkit-hyphens: manual;
	hyphens: manual; /* Theme trennt sonst automatisch ("Gesundheitsversor-gung") */
	font-size: 18px;
	font-weight: 600;
	line-height: 1.25;
}

.wkf-badge {
	flex: 0 0 auto;
	margin-left: -6px;
	min-width: 28px;
	padding: 3px 9px;
	border-radius: 999px;
	background: #f0f3f2;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	color: var(--wkf-muted);
	white-space: nowrap;
}

.wkf-node.is-partial > .wkf-row .wkf-badge,
.wkf-node.is-checked > .wkf-row .wkf-badge {
	background: var(--wkf-green-soft);
	color: var(--wkf-green);
}

/* Checkbox mit Zwischenstatus */
.wkf-box {
	position: relative;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	border: 2px solid #b9c8c1;
	border-radius: 7px;
	background: #fff;
	transition: background-color .15s, border-color .15s;
}

.wkf-node.is-checked > .wkf-row .wkf-box,
.wkf-node.is-partial > .wkf-row .wkf-box {
	border-color: var(--wkf-green);
	background: var(--wkf-green);
}

.wkf-node.is-checked > .wkf-row .wkf-box::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 1px;
	width: 7px;
	height: 13px;
	border: solid #fff;
	border-width: 0 3px 3px 0;
	transform: rotate(45deg);
}

.wkf-node.is-partial > .wkf-row .wkf-box::after {
	content: "";
	position: absolute;
	left: 4px;
	right: 4px;
	top: 9px;
	height: 3px;
	border-radius: 2px;
	background: #fff;
}

/* Aufklapp-Pfeil */
.wkf-toggle {
	position: relative;
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 12px;
	transition: background-color .15s;
}

.wkf-toggle::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 10px;
	height: 10px;
	margin: -7px 0 0 -5px;
	border: solid var(--wkf-muted);
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
	transition: transform .2s, margin .2s;
}

.wkf-node.is-open > .wkf-row .wkf-toggle::before {
	margin-top: -2px;
	transform: rotate(-135deg);
}

/* Unterkategorien */
.wkf-tree .wkf-children {
	display: none;
	margin: 0 0 10px 22px !important;
	padding: 2px 0 2px 14px !important;
	border-left: 2px solid var(--wkf-line);
}

.wkf-node.is-open > .wkf-children {
	display: block;
}

.wkf-children .wkf-check {
	min-height: 44px;
	gap: 12px;
}

.wkf-children .wkf-label {
	font-size: 16px;
	font-weight: 400;
}

.wkf-children .wkf-box {
	width: 22px;
	height: 22px;
}

.wkf-children .wkf-node.is-checked > .wkf-row .wkf-box::after {
	left: 5px;
	width: 6px;
	height: 12px;
}

.wkf-children .wkf-node.is-partial > .wkf-row .wkf-box::after {
	top: 8px;
}

/* ---------- Fußleiste ---------- */

.wkf-on .mapp-filter-all .mapp-filter-toolbar {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 14px 20px;
	border-top: 1px solid var(--wkf-line);
	background: #fff;
}

.wkf-on .mapp-filter-toolbar .mapp-filter-count {
	flex: 1 1 auto;
	margin: 0;
	font-size: 15px;
	line-height: 1.2;
	color: var(--wkf-muted);
	text-align: center;
}

.wkf-on .mapp-filter-all .mapp-filter-toolbar > .mapp-link-button {
	order: -1;
	float: none;
	margin: 0;
	padding: 10px 16px;
	border: 2px solid var(--wkf-line) !important;
	border-radius: 999px !important;
	background: #fff !important;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--wkf-blue) !important;
	text-decoration: none;
	cursor: pointer;
	transition: border-color .15s, background-color .15s;
}

.wkf-on .mapp-filter-all .mapp-filter-toolbar > .mapp-link-button:hover {
	border-color: var(--wkf-green-light) !important;
	background: var(--wkf-hover) !important;
}

.wkf-on .mapp-filter-all .mapp-filter-toolbar > .mapp-submit-button {
	float: none;
	margin: 0;
	padding: 10px 26px;
	border-radius: 999px !important;
	background: var(--wkf-green) !important;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: #fff !important;
	cursor: pointer;
}

/* ---------- Desktop: Panel immer sichtbar ---------- */

.wkf-desktop .mapp-filter-all > .mapp-dropdown-toggle,
.wkf-desktop .mapp-filter-toolbar .mapp-submit-button {
	display: none !important;
}

/* :not(#wkf) hebt die Spezifität über die Theme-Regel #wirmap .mapp-dropdown-content */
.wkf-desktop:not(#wkf) .mapp-filter-all .mapp-dropdown-content {
	/* unter dem Filterbalken, links neben den Kartenknöpfen */
	margin: 0 !important;
	top: var(--wkf-top, 66px) !important;
	right: 60px !important;
	left: auto !important;
	max-height: calc(100vh - var(--wkf-top, 66px) - 120px) !important;
}

.wkf-desktop .mapp-filter-toolbar .mapp-filter-count {
	text-align: right;
}

/* ---------- Handy ---------- */

.wkf-on:not(.wkf-desktop):not(#wkf) .mapp-filter-all .mapp-dropdown-content {
	margin: 8px 0 0 !important;
	height: auto !important; /* Theme: .mapp-mini … height: 390px */
	max-height: calc(100svh - 320px) !important;
	right: 12px !important;
	left: auto !important;
	width: calc(100vw - 24px);
	max-width: 440px;
}

/* Anzahl der Einträge bei Unterkategorien */
.wkf-num {
	flex: 0 0 auto;
	font-size: 14px;
	font-weight: 400;
	color: var(--wkf-muted);
}

/* Handy: etwas kompakter, damit alle Hauptkategorien ohne Scrollen passen */
@media (max-width: 980px) {
	.wkf-on .mapp-filter-all .mapp-filter-wrapper {
		padding: 16px 16px 6px;
	}

	.wkf-on .mapp-filter-wrapper > div + div {
		margin-top: 12px;
	}

	.wkf-on .mapp-filter-wrapper .mapp-filter-text-values .mapp-filter-label {
		display: none;
	}

	.wkf-on .mapp-filter-wrapper .mapp-filter-label,
	.wkf-title {
		margin-bottom: 6px;
		font-size: 18px;
	}

	.wkf-on .mapp-filter-wrapper .mapp-filter-text-values input[type="text"] {
		height: 44px;
	}

	.wkf-check {
		min-height: 44px;
		padding: 5px 8px;
		gap: 12px;
	}

	.wkf-label {
		min-width: 0;
		overflow: hidden;
		font-size: 16px;
		white-space: nowrap;
		text-overflow: ellipsis; /* Notfall bei sehr schmalen Handys statt Überlauf */
	}

	.wkf-check {
		padding-left: 6px;
	}

	.wkf-dot {
		margin-right: -5px;
	}

	.wkf-toggle {
		width: 40px;
		height: 44px;
	}

	.wkf-spacer {
		flex-basis: 40px;
	}

	.wkf-badge {
		padding: 3px 7px;
	}

	.wkf-on .mapp-filter-all .mapp-filter-toolbar {
		padding: 10px 16px;
	}
}

/* Pin-Farbe der Kategorie */
.wkf-dot {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	margin-right: -4px;
	border-radius: 50%;
	background: var(--wkf-c);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.wkf-children .wkf-dot {
	width: 10px;
	height: 10px;
	margin-left: 2px;
	margin-right: -2px;
}

/* ---------- Lightbox für "mehr Infos" (Maße wie im Divi FilterGrid) ---------- */

.wkf-popup.dp-dfg-popup .mfp-content {
	width: 80%;
	height: 96%;
	max-width: 1080px;
}

.wkf-popup.dp-dfg-popup #dp-dfg-popup-modal-iframe {
	border-style: none;
	border-radius: 3px;
}

@media only screen and (max-width: 980px) {
	.wkf-popup.dp-dfg-popup .mfp-content {
		height: 95%;
	}
}

@media only screen and (max-width: 767px) {
	.wkf-popup.dp-dfg-popup .mfp-content {
		width: 100%;
		height: 90%;
	}
}

.wkf-lb-wait {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1000000;
	background: rgba(11, 11, 11, .8);
}

.wkf-lb-wait .dp-dfg-loader {
	background: transparent !important;
}
