/**
 * PSV Hessen Karte – Frontend.
 *
 * Steuerbar über CSS-Variablen, z. B. im Divi-Modul unter „Erweitert → Eigenes CSS“
 * oder global:  .psvk { --psvk-map-height: 70vh; --psvk-color: #005a32; }
 */

.psvk {
	--psvk-map-height: 560px;
	--psvk-map-height-mobile: 440px;
	--psvk-map-width: 100%;
	--psvk-color: #024B9A;
	--psvk-color-contrast: #fff;
	--psvk-mask: #2c3338;
	--psvk-border: #dcdcde;
	--psvk-muted: #50575e;
	--psvk-radius: 6px;

	width: var(--psvk-map-width);
	max-width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
}

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

/* ---------- Legende und Typ-Umschalter ---------- */

.psvk-kinds {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1.25em;
	margin: 0 0 1em;
	padding: 0;
	border: 0;
}

.psvk-kinds legend {
	width: 100%;
	margin-bottom: 0.4em;
	padding: 0;
	font-weight: 600;
	font-size: 0.9em;
}

.psvk .psvk-kind {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	min-height: 2.2em;
	cursor: pointer;
}

.psvk .psvk-kind input {
	width: 1.15em;
	height: 1.15em;
	margin: 0;
}

.psvk .psvk-kind img,
.psvk .psvk-legend img,
.psvk .psvk-item-icon {
	display: inline-block;
	width: auto;
	max-width: none;
	vertical-align: middle;
}

.psvk-legend {
	display: flex;
	align-items: center;
	gap: 0.4em;
	margin: 0 0 0.75em !important;
	padding: 0 !important;
	color: var(--psvk-muted);
	font-size: 0.9em;
}

.psvk-list-heading {
	margin: 1.5em 0 0.75em !important;
	font-size: 1.15em;
}

.psvk-list-group[hidden] {
	display: none;
}

.psvk-item--verein {
	border-left-color: #024B9A !important;
}

.psvk-item--betrieb {
	border-left-color: #BF0000 !important;
}

.psvk-popup-krb {
	color: var(--psvk-muted);
	font-size: 0.925em;
}

/* ---------- Filter ---------- */

.psvk-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75em 1em;
	margin-bottom: 1em;
}

.psvk-filter[hidden] {
	display: none;
}

.psvk-filter-field {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	min-width: 10em;
}

.psvk-filter-field:first-child {
	flex: 1 1 14em;
}

.psvk-filter label {
	font-weight: 600;
	font-size: 0.9em;
}

.psvk .psvk-filter select,
.psvk .psvk-filter input[type="date"] {
	min-height: 2.6em;
	padding: 0.4em 0.6em;
	border: 1px solid var(--psvk-border);
	border-radius: var(--psvk-radius);
	background: #fff;
	color: inherit;
	font: inherit;
	width: 100%;
}

.psvk button.psvk-filter-reset,
.psvk button.psvk-show,
.psvk button.psvk-consent-load {
	min-height: 2.6em;
	padding: 0.4em 1em;
	border: 1px solid var(--psvk-color);
	border-radius: var(--psvk-radius);
	background: #fff;
	color: var(--psvk-color);
	font: inherit;
	cursor: pointer;
}

.psvk button.psvk-consent-load {
	background: var(--psvk-color);
	color: var(--psvk-color-contrast);
}

.psvk button:focus-visible,
.psvk select:focus-visible,
.psvk input:focus-visible,
.psvk a:focus-visible {
	outline: 2px solid var(--psvk-color);
	outline-offset: 2px;
}

.psvk-count {
	flex-basis: 100%;
	margin: 0 !important;
	padding: 0 !important;
	color: var(--psvk-muted);
	font-size: 0.9em;
}

.psvk-load-error {
	margin: 0 0 1em !important;
	padding: 0.6em 0.9em !important;
	border-left: 4px solid #dba617;
	background: #fcf9e8;
	font-size: 0.9em;
}

/* ---------- Karte ---------- */

.psvk-skip {
	position: absolute;
	left: -9999px;
}

.psvk-skip:focus {
	position: static;
	display: inline-block;
	margin-bottom: 0.5em;
}

.psvk-map-wrap {
	position: relative;
	width: 100%;
	height: var(--psvk-map-height);
	border: 1px solid var(--psvk-border);
	border-radius: var(--psvk-radius);
	overflow: hidden;
	background: #eef1f3;
}

.psvk-map {
	width: 100%;
	height: 100%;
	z-index: 0;
}

/* Divi und andere Themes setzen Bildbreiten/Listenstile, die Leaflet stören. */
.psvk .leaflet-container img {
	max-width: none !important;
	max-height: none !important;
}

.psvk .leaflet-container {
	font: inherit;
	font-size: 0.875rem;
}

.psvk-consent {
	position: absolute;
	inset: 0;
	z-index: 500;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	padding: 1.5em;
	text-align: center;
	background: #eef1f3;
}

.psvk-consent[hidden] {
	display: none;
}

.psvk-consent p {
	max-width: 34em;
	margin: 0 !important;
	padding: 0 !important;
}

.psvk-consent-remember {
	font-size: 0.875em;
	color: var(--psvk-muted);
}

.psvk-hint {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 1000;
	transform: translate(-50%, -50%);
	max-width: 80%;
	padding: 0.75em 1em;
	border-radius: var(--psvk-radius);
	background: rgba(0, 0, 0, 0.72);
	color: #fff;
	text-align: center;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
}

.psvk-hint.is-visible {
	opacity: 1;
}

.psvk-noscript {
	padding: 1em;
}

/* Marker als Stecknadel in der Akzentfarbe. */
.psvk-marker {
	background: none;
	border: 0;
}

.psvk-pin {
	position: absolute;
	left: 3px;
	top: 1px;
	width: 22px;
	height: 22px;
	border-radius: 50% 50% 50% 0;
	background: var(--psvk-color);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
	transform: rotate(-45deg);
	transform-origin: center;
	margin-top: 4px;
}

.psvk-pin::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 5px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
}

/* Cluster in der Akzentfarbe statt Grün/Gelb/Orange (ersetzt MarkerCluster.Default.css). */
.psvk .marker-cluster {
	background-color: rgba(2, 75, 154, 0.3);
	background-color: color-mix(in srgb, var(--psvk-color) 30%, transparent);
	background-clip: padding-box;
	border-radius: 20px;
}

.psvk .marker-cluster div {
	width: 30px;
	height: 30px;
	margin-left: 5px;
	margin-top: 5px;
	border-radius: 15px;
	background-color: var(--psvk-color);
	color: var(--psvk-color-contrast);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
}

.psvk .marker-cluster span {
	line-height: 30px;
}

/* Popup */
.psvk .leaflet-popup-content {
	margin: 12px 14px;
	line-height: 1.4;
}

.psvk-popup p {
	margin: 0 0 0.4em !important;
	padding: 0 !important;
}

.psvk-popup-title {
	font-weight: 700;
	font-size: 1.05em;
}

.psvk-popup-date {
	color: var(--psvk-muted);
}

.psvk-consent-revoke {
	margin: 0.4em 0 0 !important;
	padding: 0 !important;
	font-size: 0.85em;
	color: var(--psvk-muted);
	text-align: right;
}

.psvk-consent-revoke[hidden] {
	display: none;
}

.psvk button.psvk-linkbutton {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* Button „Zur Anmeldung“ in Popup und Liste */
.psvk a.psvk-button {
	display: inline-block;
	padding: 0.35em 0.9em;
	border-radius: var(--psvk-radius);
	background: var(--psvk-color);
	color: var(--psvk-color-contrast) !important;
	font-weight: 600;
	text-decoration: none;
}

.psvk a.psvk-button:hover,
.psvk a.psvk-button:focus-visible {
	filter: brightness(1.1);
	text-decoration: underline;
}

.psvk-popup-art {
	font-weight: 600;
}

.psvk-popup-disziplin,
.psvk-item-disziplin {
	color: var(--psvk-muted);
	font-size: 0.925em;
}

/* ---------- Liste ---------- */

.psvk-list {
	margin-top: 1.5em;
}

.psvk-list:focus {
	outline: none;
}

.psvk .psvk-items {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(17em, 1fr));
	gap: 1em;
}

.psvk .psvk-item {
	list-style: none !important;
	margin: 0 !important;
	padding: 1em;
	border: 1px solid var(--psvk-border);
	border-left: 4px solid var(--psvk-color);
	border-radius: var(--psvk-radius);
	background: #fff;
}

.psvk .psvk-item[hidden] {
	display: none;
}

.psvk-item p {
	margin: 0 0 0.4em !important;
	padding: 0 !important;
}

.psvk-item-title {
	font-weight: 700;
	font-size: 1.05em;
}

.psvk-item-meta {
	color: var(--psvk-muted);
	font-size: 0.925em;
}

.psvk-item-art::before {
	content: "· ";
}

.psvk-item-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em 1em;
	margin-top: 0.6em !important;
}

.psvk .psvk-item-links button.psvk-show {
	min-height: 2.2em;
	padding: 0.2em 0.8em;
	font-size: 0.9em;
}

.psvk-item-links button[hidden] {
	display: none;
}

/* ---------- Formular ---------- */

.psvk-form-wrap {
	--psvk-color: #024B9A;
	--psvk-color-contrast: #fff;
	--psvk-border: #8c8f94;
	--psvk-muted: #50575e;
	--psvk-error: #b32d2e;
	--psvk-radius: 6px;

	max-width: 46em;
}

.psvk-form-wrap *,
.psvk-form-wrap *::before,
.psvk-form-wrap *::after {
	box-sizing: border-box;
}

.psvk-form fieldset {
	margin: 0 0 1.5em;
	padding: 0;
	border: 0;
}

.psvk-form legend {
	margin-bottom: 0.6em;
	padding: 0;
	font-weight: 700;
	font-size: 1.15em;
}

.psvk-field {
	margin-bottom: 1em;
}

.psvk-field label {
	display: block;
	margin-bottom: 0.3em;
	font-weight: 600;
}

.psvk-form input[type="text"],
.psvk-form input[type="email"],
.psvk-form input[type="tel"],
.psvk-form input[type="url"],
.psvk-form input[type="date"],
.psvk-form select,
.psvk-form textarea {
	width: 100%;
	min-height: 2.75em;
	padding: 0.5em 0.7em;
	border: 1px solid var(--psvk-border);
	border-radius: var(--psvk-radius);
	background: #fff;
	color: inherit;
	font: inherit;
}

.psvk-form input[type="file"] {
	max-width: 100%;
	font: inherit;
}

.psvk-form :focus-visible {
	outline: 2px solid var(--psvk-color);
	outline-offset: 2px;
}

.psvk-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 1em;
}

.psvk-field-row--plz {
	grid-template-columns: 8em 1fr;
}

.psvk-field--check {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.3em 0.6em;
	align-items: start;
}

.psvk-field--check input {
	width: 1.25em;
	height: 1.25em;
	margin: 0.15em 0 0;
}

.psvk-field--check label {
	font-weight: 400;
}

.psvk-field--check .psvk-field-error {
	grid-column: 2;
}

.psvk-form-note,
.psvk-hint-text {
	margin: 0 0 1em !important;
	padding: 0 !important;
	color: var(--psvk-muted);
	font-size: 0.9em;
}

.psvk-hint-text {
	margin: 0.3em 0 0 !important;
}

.psvk-field.has-error input,
.psvk-field.has-error select,
.psvk-field.has-error textarea {
	border-color: var(--psvk-error);
	border-width: 2px;
}

.psvk-field-error {
	margin: 0.3em 0 0 !important;
	padding: 0 !important;
	color: var(--psvk-error);
	font-weight: 600;
	font-size: 0.9em;
}

.psvk-error-summary,
.psvk-success {
	margin-bottom: 1.5em;
	padding: 1em 1.2em;
	border-left: 4px solid var(--psvk-error);
	border-radius: var(--psvk-radius);
	background: #fcf0f1;
}

.psvk-success {
	border-left-color: #00a32a;
	background: #edfaef;
}

.psvk-error-summary:focus,
.psvk-success:focus {
	outline: 2px solid var(--psvk-color);
}

.psvk-error-summary p,
.psvk-success p {
	margin: 0 0 0.5em !important;
	padding: 0 !important;
}

.psvk-error-summary ul {
	margin: 0 0 0 1.2em !important;
	padding: 0 !important;
}

.psvk-error-summary a {
	color: var(--psvk-error);
}

.psvk-submit button {
	min-height: 2.9em;
	padding: 0.6em 1.6em;
	border: 0;
	border-radius: var(--psvk-radius);
	background: #024B9A;
	color: var(--psvk-color-contrast);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.psvk-submit button[disabled] {
	opacity: 0.6;
	cursor: wait;
}

/* Disziplin/Bereich: Checkbox-Gruppe */
.psvk-form fieldset.psvk-checks {
	margin-bottom: 1em;
}

.psvk-form .psvk-field-legend {
	margin-bottom: 0.4em;
	font-weight: 600;
	font-size: 1em;
}

.psvk-hint-inline {
	color: var(--psvk-muted);
	font-weight: 400;
	font-size: 0.9em;
}

.psvk-checks-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
	gap: 0.35em 1em;
}

.psvk-form .psvk-check {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin: 0;
	font-weight: 400;
	min-height: 2em;
}

.psvk-form .psvk-check input {
	width: 1.15em;
	height: 1.15em;
	margin: 0;
	flex: none;
}

.psvk-checks.has-error .psvk-checks-grid {
	padding: 0.4em;
	border: 2px solid var(--psvk-error);
	border-radius: var(--psvk-radius);
}

.psvk-hint-after {
	margin: -0.6em 0 1em !important;
}

/* Honeypot: für Menschen unsichtbar, für Bots ein normales Feld. */
.psvk-hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.cf-turnstile {
	margin-bottom: 1em;
}

/* ---------- Smartphone ---------- */

@media (max-width: 600px) {
	.psvk-map-wrap {
		height: var(--psvk-map-height-mobile);
	}

	.psvk-filter-field {
		flex: 1 1 100%;
		min-width: 0;
	}

	/* Von/Bis nebeneinander, um Platz über der Karte zu sparen. */
	.psvk-filter-field:nth-child(2),
	.psvk-filter-field:nth-child(3) {
		flex: 1 1 calc(50% - 0.5em);
	}

	.psvk button.psvk-filter-reset {
		width: 100%;
	}

	.psvk-field-row {
		grid-template-columns: 1fr;
	}

	.psvk-field-row--plz {
		grid-template-columns: 6.5em 1fr;
	}

	.psvk-submit button {
		width: 100%;
	}

	/* Auf dem Smartphone den Sprung zur Liste sichtbar anbieten. */
	.psvk-skip {
		position: static;
		display: inline-block;
		margin-bottom: 0.5em;
		font-size: 0.9em;
	}

	/* Fingerfreundliche Schaltflächen (mind. 44 px). */
	.psvk .psvk-item-links button.psvk-show,
	.psvk button.psvk-filter-reset,
	.psvk button.psvk-consent-load {
		min-height: 44px;
	}

	.psvk .psvk-items {
		grid-template-columns: 1fr;
	}
}