/**
 * BTW Maps – Frontend.
 * Nur Flexbox, keine Grid-/aspect-ratio-Regeln. Breakpoints: Bootstrap (bis 280px).
 * Farben/Abstände über Custom Properties – im Theme überschreibbar.
 */

.btw_maps {
	--btw-maps-accent: #1f2937;
	--btw-maps-accent-text: #fff;
	--btw-maps-border: #d1d5db;
	--btw-maps-muted: #6b7280;
	--btw-maps-bg: #fff;
	--btw-maps-radius: 4px;
	--btw-maps-gap: 24px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
	/* Listen-Spalten richten sich nach der Modulbreite, nicht nach dem Fenster. */
	container: btw_maps / inline-size;
}

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

.btw_maps [hidden] {
	display: none !important;
}

.btw_maps_sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Links: :visited/:focus/:active explizit, sonst greift a:visited des Themes. */
.btw_maps .btw_maps_link,
.btw_maps .btw_maps_link:visited,
.btw_maps .btw_maps_link:focus,
.btw_maps .btw_maps_link:active {
	color: var(--btw-maps-accent);
	text-decoration: underline;
}
.btw_maps .btw_maps_link:hover {
	text-decoration: none;
}

/* ------------------------------------------------------------------ */
/* Suche                                                               */
/* ------------------------------------------------------------------ */

.btw_maps_search {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.btw_maps_search_field {
	flex: 1 1 160px;
	min-width: 0;
}

/* Auswahlfelder nie schmaler als ihr Inhalt; das Suchfeld bekommt den Rest. */
.btw_maps_search_country,
.btw_maps_search_radius {
	flex: 1 0 auto;
}

/* Die Reihe bricht je nach Containerbreite um. */
.btw_maps_search_q {
	flex: 999 1 220px;
}

.btw_maps_search_field input,
.btw_maps_search_field select {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	font: inherit;
	color: inherit;
	background: var(--btw-maps-bg);
	border: 1px solid var(--btw-maps-border);
	border-radius: var(--btw-maps-radius);
}

.btw_maps_search_actions {
	display: flex;
	flex-wrap: wrap;
	flex: 1 1 auto;
	gap: 8px;
}

.btw_maps_submit,
.btw_maps_locate,
.btw_maps_all,
.btw_maps_consent_btn,
.btw_maps_more,
.btw_maps_show {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 8px 18px;
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	border-radius: var(--btw-maps-radius);
	transition: opacity .2s;
}

.btw_maps_submit,
.btw_maps_consent_btn {
	flex: 1 1 auto;
	color: var(--btw-maps-accent-text);
	background: var(--btw-maps-accent);
	border: 1px solid var(--btw-maps-accent);
}

.btw_maps_locate,
.btw_maps_all,
.btw_maps_more,
.btw_maps_show {
	flex: 0 1 auto;
	color: var(--btw-maps-accent);
	background: transparent;
	border: 1px solid var(--btw-maps-accent);
}

.btw_maps_show {
	min-height: 0;
	padding: 4px 10px;
	font-size: .875em;
}

.btw_maps_submit:hover,
.btw_maps_locate:hover,
.btw_maps_all:hover,
.btw_maps_more:hover,
.btw_maps_consent_btn:hover,
.btw_maps_show:hover {
	opacity: .85;
}

.btw_maps_locate[disabled] {
	opacity: .5;
	cursor: progress;
}

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

.btw_maps_filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
}

.btw_maps_chip {
	position: relative;
	display: inline-flex;
	cursor: pointer;
}

.btw_maps_chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.btw_maps_chip span {
	padding: 6px 14px;
	border: 1px solid var(--btw-maps-border);
	border-radius: 999px;
	transition: opacity .2s;
}

.btw_maps_chip input:checked + span {
	color: var(--btw-maps-accent-text);
	background: var(--btw-maps-accent);
	border-color: var(--btw-maps-accent);
}

.btw_maps_chip input:focus-visible + span {
	outline: 2px solid var(--btw-maps-accent);
	outline-offset: 2px;
}

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

.btw_maps_map_wrap {
	position: relative;
	width: 100%;
	height: var(--btw-maps-h-sm, 380px);
	overflow: hidden;
	background: #e5e7eb;
	border-radius: var(--btw-maps-radius);
}

.btw_maps_map {
	position: relative;
	width: 100%;
	height: 100%;
}

.btw_maps_gradient {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 1;
	pointer-events: none;
}

.btw_maps_gradient_top {
	top: 0;
}

.btw_maps_gradient_bottom {
	bottom: 0;
}

.btw_maps_failed .btw_maps_map {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	text-align: center;
	color: var(--btw-maps-muted);
}

.btw_maps_consent {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	text-align: center;
	background: #f3f4f6;
}

.btw_maps_consent[hidden] {
	display: none;
}

.btw_maps_consent_inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 420px;
}

.btw_maps_consent_inner p {
	margin: 0;
}

.btw_maps_consent_remember {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .875em;
	cursor: pointer;
}

.btw_maps_wheel_hint {
	position: absolute;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-size: 18px;
	text-align: center;
	color: #fff;
	background: rgba(0, 0, 0, .45);
	pointer-events: none;
	opacity: 0;
	transition: opacity .3s;
}

.btw_maps_wheel_hint.is-visible {
	opacity: 1;
}

.btw_maps_cluster {
	background: transparent;
	border: 0;
}

.btw_maps_cluster span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.btw_maps_cluster_g span {
	width: 38px;
	height: 38px;
}

.btw_maps_iw {
	font-size: 14px;
	line-height: 1.4;
}

.btw_maps_iw p {
	margin: 0 0 6px;
}

.btw_maps_iw .btw_maps_iw_title {
	font-weight: 600;
}

.btw_maps_iw_actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
}

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

.btw_maps_status {
	margin: 0;
	color: var(--btw-maps-muted);
}

.btw_maps_status:empty {
	display: none;
}

.btw_maps_list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--btw-maps-gap);
	transition: opacity .2s;
}

.btw_maps_busy .btw_maps_list {
	opacity: .5;
}

.btw_maps_item {
	flex: 0 0 100%;
	min-width: 0;
}

.btw_maps_item_inner {
	height: 100%;
	padding: 16px;
	border: 1px solid var(--btw-maps-border);
	border-radius: var(--btw-maps-radius);
	overflow-wrap: anywhere;
}

.btw_maps_item_active .btw_maps_item_inner {
	border-color: var(--btw-maps-accent);
	box-shadow: inset 0 0 0 1px var(--btw-maps-accent);
}

.btw_maps_item_inner > * {
	margin: 0 0 8px;
}

.btw_maps_item_inner > :last-child {
	margin-bottom: 0;
}

.btw_maps_item_title {
	font-size: 1.125em;
}

.btw_maps_item_distance {
	color: var(--btw-maps-muted);
	font-size: .875em;
}

.btw_maps_item_address,
.btw_maps_item_contact {
	display: flex;
	flex-direction: column;
}

.btw_maps_item_actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
}

.btw_maps_more_wrap {
	display: flex;
	justify-content: center;
}

.btw_maps_more[hidden] {
	display: none;
}

.btw_maps_notice {
	padding: 12px;
	border: 1px dashed var(--btw-maps-border, #d1d5db);
}

/* ------------------------------------------------------------------ */
/* Öffnungszeiten                                                      */
/* ------------------------------------------------------------------ */

.btw_maps {
	--btw-maps-open: #15803d;
	--btw-maps-closed: #b91c1c;
}

.btw_maps_hours {
	margin: 0 0 8px;
}

.btw_maps_hours_summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	cursor: pointer;
	list-style: none;
}

.btw_maps_hours_summary::-webkit-details-marker {
	display: none;
}

.btw_maps_hours_label {
	color: var(--btw-maps-accent);
	text-decoration: underline;
}

.btw_maps_hours_label::after {
	content: "";
	display: inline-block;
	width: .45em;
	height: .45em;
	margin: 0 0 .2em .45em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform .2s;
}

.btw_maps_hours[open] .btw_maps_hours_label::after {
	transform: rotate(-135deg);
	margin-bottom: -.1em;
}

.btw_maps_hours_summary:focus-visible {
	outline: 2px solid var(--btw-maps-accent);
	outline-offset: 2px;
}

.btw_maps_open {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
}

.btw_maps_open::before {
	content: "";
	flex: 0 0 8px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

.btw_maps_open.is-open {
	color: var(--btw-maps-open);
}

.btw_maps_open.is-closed {
	color: var(--btw-maps-closed);
}

.btw_maps_hours_list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 8px 0 0;
	padding: 0;
	font-size: .875em;
}

.btw_maps_hours_row {
	display: flex;
	flex-wrap: wrap;
	gap: 0 12px;
}

.btw_maps_hours_row dt {
	flex: 0 0 5.5em;
	margin: 0;
	padding: 0;
	font-weight: 400;
}

.btw_maps_hours_row dd {
	flex: 1 1 7em;
	margin: 0;
	padding: 0;
}

.btw_maps_hours_row.is-today {
	font-weight: 600;
}

.btw_maps_hours_ex dt {
	color: var(--btw-maps-muted);
}

.btw_maps_iw .btw_maps_hours {
	min-width: 200px; /* Info-Fenster wird zugeklappt vermessen – Platz für den Wochenplan. */
	margin: 0 0 6px;
}

.btw_maps_iw .btw_maps_hours_row dt {
	flex-basis: 4.75em;
}

.btw_maps_iw .btw_maps_hours_row dd {
	flex-basis: auto;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Breakpoints                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 319.98px) {
	.btw_maps {
		--btw-maps-gap: 12px;
	}
	.btw_maps_hours_row dt {
		flex-basis: 100%;
	}
	.btw_maps_item_inner {
		padding: 12px;
	}
	.btw_maps_submit,
	.btw_maps_locate,
	.btw_maps_all {
		flex: 0 0 100%;
		padding-left: 8px;
		padding-right: 8px;
	}
}

@media (min-width: 768px) {
	.btw_maps_map_wrap {
		height: var(--btw-maps-h, 500px);
	}
}

@container btw_maps (min-width: 576px) {
	.btw_maps_item {
		flex: 0 0 calc((100% - var(--btw-maps-gap)) / 2);
	}
}

@container btw_maps (min-width: 992px) {
	.btw_maps_item {
		flex: 0 0 calc((100% - 2 * var(--btw-maps-gap)) / 3);
	}
}

@media (prefers-reduced-motion: reduce) {
	.btw_maps *,
	.btw_maps *::before,
	.btw_maps *::after {
		transition: none !important;
		animation: none !important;
	}
}

/* Such-Teaser */
.btw_maps_teaser {
	gap: 8px;
}

.btw_maps_teaser_title {
	margin: 0;
	font-weight: 600;
}

.btw_maps .btw_maps_teaser_locate,
.btw_maps .btw_maps_teaser_locate:visited,
.btw_maps .btw_maps_teaser_locate:focus,
.btw_maps .btw_maps_teaser_locate:active {
	color: var(--btw-maps-accent);
	text-decoration: none;
}

/* Vorschaubild vor der Zustimmung */
.btw_maps_consent_has_image {
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}

.btw_maps_consent_has_image::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .55);
}

.btw_maps_consent_has_image .btw_maps_consent_inner {
	position: relative;
	padding: 16px 20px;
	background: rgba(255, 255, 255, .92);
	border-radius: var(--btw-maps-radius);
	box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
}

/* Ansprechpartner */
.btw_maps_contacts[hidden] {
	display: none;
}

.btw_maps_contact_box {
	padding: 16px;
	border: 1px solid var(--btw-maps-accent);
	border-radius: var(--btw-maps-radius);
}

.btw_maps_contact_heading {
	margin: 0 0 12px;
	font-weight: 600;
}

.btw_maps_contact_list {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.btw_maps_contact {
	display: flex;
	flex: 1 1 280px;
	gap: 12px;
	min-width: 0;
}

.btw_maps_contact_image {
	flex: 0 0 72px;
	height: 72px;
	overflow: hidden;
	border-radius: 50%;
}

.btw_maps_contact_image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
}

.btw_maps_contact_body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.btw_maps_contact_body > * {
	margin: 0;
}

.btw_maps_contact_name {
	font-weight: 600;
}

.btw_maps_contact_position {
	color: var(--btw-maps-muted);
	font-size: .875em;
}

.btw_maps_contact_links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
}

@media (max-width: 319.98px) {
	.btw_maps_contact {
		flex-direction: column;
	}
}
