/**
 * PRIMO Haendlersuche — Frontend Styles
 *
 * Charakteristik:
 *   - Karte rechts, voll-Hoehe, dominante Flaeche
 *   - Sidebar links (380 px) mit Suche oben + scrollbarer Liste
 *   - Sehr viel Weiss, fast keine Borders, dezente Schatten
 *   - Akzentfarbe sparsam (Buttons, aktiver Marker, Hover)
 *   - Mobile: Sidebar oben, Karte darunter, Toggle zwischen Liste/Karte
 */

:root {
	--pds-accent:        #FA7900;
	--pds-accent-hover:  #C13004;
	--pds-text:          #1a1a1a;
	--pds-text-muted:    #6b7280;
	--pds-text-soft:     #9ca3af;
	--pds-border:        #e5e7eb;
	--pds-border-soft:   #f3f4f6;
	--pds-bg:            #ffffff;
	--pds-bg-soft:       #f9fafb;
	--pds-shadow-card:   0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
	--pds-shadow-hover:  0 2px 4px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.08);
	--pds-radius:        4px;
	--pds-radius-lg:     6px;
	--pds-trans:         150ms ease;
	--pds-sidebar-w:     380px;
	--pds-height:        680px;
}

/* === Container === */

.pds-haendlersuche {
	max-width: var(--container-max-width, 1536px);
	margin: 1.5rem auto;
	font-family: inherit;
	color: var(--pds-text);
	-webkit-font-smoothing: antialiased;
	box-sizing: border-box;
}

/* Hello-Biz cappt .site-main auf eine schmale Breite — gezielt aufheben,
   aber nur fuer Seiten, die unsere Komponente enthalten. */
body:not([class*=elementor-page-]) .site-main:has(.pds-haendlersuche) {
	max-width: 100% !important;
}

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

/* Reset gegen Theme-Overrides (Hello-Biz, Elementor, …) */

.pds-haendlersuche button {
	padding: 0;
	margin: 0;
	background: transparent;
	border: none;
	border-radius: 0;
	box-shadow: none;
	color: inherit;
	font: inherit;
	text-transform: none;
	letter-spacing: normal;
	line-height: inherit;
	min-width: 0;
	min-height: 0;
	width: auto;
	height: auto;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.pds-haendlersuche input,
.pds-haendlersuche select {
	margin: 0;
	font: inherit;
	color: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.pds-haendlersuche [hidden] {
	display: none !important;
}

/* Focus-Indikator deutlich sichtbar fuer Keyboard-Navigation */
.pds-haendlersuche button:focus-visible,
.pds-haendlersuche input:focus-visible,
.pds-haendlersuche select:focus-visible,
.pds-haendlersuche a:focus-visible,
.pds-haendlersuche [tabindex]:focus-visible {
	outline: 2px solid var(--pds-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Reduced motion respektieren */
@media (prefers-reduced-motion: reduce) {
	.pds-haendlersuche *,
	.pds-haendlersuche *::before,
	.pds-haendlersuche *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* === Shell: Sidebar + Map === */

.pds-haendlersuche .pds-shell {
	display: grid;
	grid-template-columns: var(--pds-sidebar-w) 1fr;
	gap: 0;
	height: var(--pds-height);
	background: var(--pds-bg);
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius-lg);
	overflow: hidden;
	box-shadow: var(--pds-shadow-card);
}

/* === Sidebar links === */

.pds-haendlersuche .pds-sidebar {
	display: flex;
	flex-direction: column;
	background: var(--pds-bg);
	border-right: 1px solid var(--pds-border);
	min-width: 0;
	min-height: 0;
	height: 100%;
	overflow: hidden;
}

.pds-haendlersuche .pds-sidebar__head {
	padding: 1.25rem;
	border-bottom: 1px solid var(--pds-border);
	background: var(--pds-bg);
	flex-shrink: 0;
}

/* Search input */

.pds-haendlersuche .pds-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.pds-haendlersuche .pds-input-wrap__icon {
	position: absolute;
	left: 0.85rem;
	color: var(--pds-text-soft);
	pointer-events: none;
}

.pds-haendlersuche .pds-input {
	width: 100%;
	padding: 0.75rem 2.5rem 0.75rem 2.6rem;
	font-size: 0.95rem;
	font-family: inherit;
	color: var(--pds-text);
	background: var(--pds-bg-soft);
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius);
	transition: all var(--pds-trans);
}

.pds-haendlersuche .pds-input:focus {
	outline: none;
	border-color: var(--pds-text);
	background: var(--pds-bg);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.pds-haendlersuche .pds-input::placeholder {
	color: var(--pds-text-soft);
}

.pds-haendlersuche .pds-input-wrap__gps {
	position: absolute;
	right: 0.4rem;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: var(--pds-text-soft);
	cursor: pointer;
	border-radius: var(--pds-radius);
	transition: all var(--pds-trans);
	padding: 0;
}

.pds-haendlersuche .pds-input-wrap__gps:hover {
	color: var(--pds-text);
	background: var(--pds-border-soft);
}

.pds-haendlersuche .pds-input-wrap__gps--loading {
	color: var(--pds-accent);
	animation: pds-pulse 1s ease-in-out infinite;
}

@keyframes pds-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

/* Radius row */

.pds-haendlersuche .pds-radius-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.85rem;
}

.pds-haendlersuche .pds-radius-label {
	font-size: 0.8rem;
	color: var(--pds-text-muted);
	flex-shrink: 0;
}

.pds-haendlersuche .pds-radius-select {
	flex: 1;
	padding: 0.45rem 2rem 0.45rem 0.6rem;
	font-size: 0.85rem;
	font-family: inherit;
	color: var(--pds-text);
	background-color: var(--pds-bg);
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
	background-repeat: no-repeat;
	background-position: right 0.6rem center;
	background-size: 12px 12px;
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius);
	cursor: pointer;
}

.pds-haendlersuche .pds-radius-select:focus {
	outline: none;
	border-color: var(--pds-text);
}

/* Submit button */

.pds-haendlersuche .pds-submit {
	display: block;
	width: 100%;
	margin-top: 0.85rem;
	padding: 0.75rem 1rem;
	font-size: 0.95rem;
	font-family: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--pds-text);
	border: 1px solid var(--pds-text);
	border-radius: var(--pds-radius);
	cursor: pointer;
	transition: all var(--pds-trans);
}

.pds-haendlersuche .pds-submit:hover {
	background: var(--pds-accent);
	border-color: var(--pds-accent);
}

.pds-haendlersuche .pds-submit:focus-visible {
	outline: 2px solid var(--pds-accent);
	outline-offset: 2px;
}

.pds-haendlersuche .pds-submit:disabled {
	opacity: 0.5;
	cursor: progress;
}

.pds-haendlersuche .pds-submit--ghost {
	color: var(--pds-text);
	background: var(--pds-bg);
	border-color: var(--pds-border);
}

.pds-haendlersuche .pds-submit--ghost:hover {
	background: var(--pds-text);
	border-color: var(--pds-text);
	color: #fff;
}

/* Status + Suggestion */

.pds-haendlersuche .pds-status {
	margin-top: 0.85rem;
	font-size: 0.8rem;
	color: var(--pds-text-muted);
	min-height: 1em;
}

.pds-haendlersuche .pds-suggestion {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.6rem 0.75rem;
	margin-top: 0.65rem;
	background: var(--pds-bg-soft);
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius);
	font-size: 0.8rem;
	color: var(--pds-text-muted);
}

.pds-haendlersuche .pds-suggestion__btn {
	margin-left: auto;
	padding: 0.35rem 0.75rem;
	font-size: 0.78rem;
	font-family: inherit;
	font-weight: 600;
	color: var(--pds-text);
	background: var(--pds-bg);
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius);
	cursor: pointer;
	white-space: nowrap;
	transition: all var(--pds-trans);
}

.pds-haendlersuche .pds-suggestion__btn:hover {
	background: var(--pds-text);
	color: #fff;
	border-color: var(--pds-text);
}

/* === Trefferliste === */

.pds-haendlersuche .pds-list {
	flex: 1 1 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.pds-haendlersuche .pds-list::-webkit-scrollbar {
	width: 6px;
}

.pds-haendlersuche .pds-list::-webkit-scrollbar-thumb {
	background: var(--pds-border);
	border-radius: 3px;
}

.pds-haendlersuche .pds-list::-webkit-scrollbar-thumb:hover {
	background: var(--pds-text-soft);
}

.pds-haendlersuche .pds-list__placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	padding: 3rem 1.5rem;
	color: var(--pds-text-soft);
	text-align: center;
	font-size: 0.875rem;
	line-height: 1.5;
}

.pds-haendlersuche .pds-list__placeholder p {
	margin: 0;
	max-width: 240px;
}

.pds-haendlersuche .pds-list__empty {
	padding: 2rem 1.5rem;
	text-align: center;
	color: var(--pds-text-muted);
	font-size: 0.9rem;
}

/* Skeleton-Loader (waehrend Suche) */
.pds-haendlersuche .pds-skeleton {
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--pds-border-soft);
}
.pds-haendlersuche .pds-skeleton__line {
	height: 12px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--pds-border-soft) 0%, var(--pds-border) 50%, var(--pds-border-soft) 100%);
	background-size: 200% 100%;
	animation: pds-shimmer 1.4s ease-in-out infinite;
	margin-bottom: 0.45rem;
}
.pds-haendlersuche .pds-skeleton__line:last-child { margin-bottom: 0; }
.pds-haendlersuche .pds-skeleton__line--title { width: 70%; height: 14px; }
.pds-haendlersuche .pds-skeleton__line--addr  { width: 90%; }
.pds-haendlersuche .pds-skeleton__line--meta  { width: 50%; }

@keyframes pds-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Card im Listen-Eintrag */

.pds-haendlersuche .pds-card {
	display: block;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--pds-border-soft);
	cursor: pointer;
	transition: background-color var(--pds-trans);
}

.pds-haendlersuche .pds-card:hover,
.pds-haendlersuche .pds-card:focus-within {
	background: var(--pds-bg-soft);
}

.pds-haendlersuche .pds-card--active {
	background: var(--pds-bg-soft);
	border-left: 3px solid var(--pds-accent);
	padding-left: calc(1.25rem - 3px);
}

.pds-haendlersuche .pds-card__logo {
	display: block;
	max-width: 120px;
	max-height: 40px;
	width: auto;
	height: auto;
	object-fit: contain;
	margin-bottom: 0.6rem;
}

.pds-haendlersuche .pds-card__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.2rem;
}

.pds-haendlersuche .pds-card__title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--pds-text);
}

.pds-haendlersuche .pds-card__distance {
	flex-shrink: 0;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--pds-accent);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pds-haendlersuche .pds-card__brand {
	display: block;
	font-size: 0.75rem;
	color: var(--pds-text-soft);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.4rem;
}

.pds-haendlersuche .pds-card__address {
	display: block;
	margin: 0 0 0.65rem;
	font-size: 0.875rem;
	font-style: normal;
	color: var(--pds-text-muted);
	line-height: 1.5;
}

.pds-haendlersuche .pds-card__contact {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.2rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.pds-haendlersuche .pds-card__link {
	display: inline-block;
	color: var(--pds-text);
	text-decoration: none;
	transition: color var(--pds-trans);
}

.pds-haendlersuche .pds-card__link:hover {
	color: var(--pds-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.pds-haendlersuche .pds-card__route {
	display: inline-block;
	margin-top: 0.65rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--pds-accent);
	text-decoration: none;
	transition: color var(--pds-trans);
}

.pds-haendlersuche .pds-card__route:hover {
	color: var(--pds-accent-hover);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* === Map === */

.pds-haendlersuche .pds-mapwrap {
	position: relative;
	min-height: 400px;
	background: var(--pds-bg-soft);
}

.pds-haendlersuche .pds-map {
	position: relative;
	width: 100%;
	height: 100%;
}

/* Consent overlay */

.pds-haendlersuche .pds-consent {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--pds-bg-soft);
	z-index: 1000;
	padding: 1.5rem;
}

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

.pds-haendlersuche .pds-consent__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	max-width: 320px;
	text-align: center;
	color: var(--pds-text-muted);
}

.pds-haendlersuche .pds-consent__inner svg { color: var(--pds-text-soft); }

.pds-haendlersuche .pds-consent__inner p {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.5;
}

.pds-haendlersuche .pds-consent__inner .pds-submit {
	margin-top: 0;
	width: auto;
	padding-left: 1.5rem;
	padding-right: 1.5rem;
}

/* === Marker + Cluster (PRIMO-Akzent) === */

.pds-haendlersuche .pds-marker {
	background: none !important;
	border: none !important;
}

.pds-haendlersuche .pds-marker--active { z-index: 1000 !important; }

.pds-haendlersuche .pds-marker-search {
	background: none !important;
	border: none !important;
}

.pds-haendlersuche .pds-cluster-wrap {
	background: none !important;
	border: none !important;
}

.pds-haendlersuche .pds-cluster {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	color: #fff;
	font-weight: 700;
	font-size: 0.78rem;
	background: var(--pds-text);
	border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.pds-haendlersuche .pds-cluster--medium { width: 42px; height: 42px; font-size: 0.85rem; }
.pds-haendlersuche .pds-cluster--large  { width: 48px; height: 48px; font-size: 0.9rem; background: var(--pds-accent); }

/* === Leaflet Popup === */

/* Popup nutzt die Card-Klassen (.pds-card__title/__address/__contact/__link/__route)
   aus dem Listen-Eintrag — gleicher visueller Sprachstil wie die Suchergebnisse. */
.leaflet-popup-content .pds-popup {
	font-family: inherit;
	min-width: 220px;
	max-width: 280px;
}

/* Popup ist ja KEIN Card-Container (kein Border, keine Trennlinien noetig) */
.leaflet-popup-content .pds-popup .pds-card__title {
	margin: 0 0 0.4rem;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--pds-text);
}

.leaflet-popup-content .pds-popup .pds-card__address {
	display: block;
	margin: 0 0 0.65rem;
	font-size: 0.875rem;
	font-style: normal;
	color: var(--pds-text-muted);
	line-height: 1.5;
}

.leaflet-popup-content .pds-popup .pds-card__contact {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.2rem;
	font-size: 0.875rem;
	line-height: 1.5;
}

.leaflet-popup-content .pds-popup .pds-card__link {
	display: inline-block;
	color: var(--pds-text);
	text-decoration: none;
	transition: color var(--pds-trans);
}

.leaflet-popup-content .pds-popup .pds-card__link:hover {
	color: var(--pds-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.leaflet-popup-content .pds-popup .pds-card__route {
	display: inline-block;
	margin-top: 0.65rem;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--pds-accent);
	text-decoration: none;
	transition: color var(--pds-trans);
}

.leaflet-popup-content .pds-popup .pds-card__route:hover {
	color: var(--pds-accent-hover);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Leaflet popup chrome */
.pds-haendlersuche .leaflet-popup-content-wrapper {
	border-radius: var(--pds-radius-lg);
	box-shadow: var(--pds-shadow-hover);
}
.pds-haendlersuche .leaflet-popup-content { margin: 0.85rem 1rem; }

/* Hover-Tooltip auf Markern */
.pds-tooltip {
	background: var(--pds-text);
	color: #fff;
	border: none;
	border-radius: 3px;
	padding: 0.3rem 0.55rem;
	font-size: 0.78rem;
	font-weight: 500;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.pds-tooltip::before { border-top-color: var(--pds-text); }

/* === Mobile Toggle === */

.pds-haendlersuche .pds-mobile-toggle {
	display: none;
	margin-top: 0.85rem;
	border: 1px solid var(--pds-border);
	border-radius: var(--pds-radius);
	overflow: hidden;
}

.pds-haendlersuche .pds-mobile-toggle__btn {
	flex: 1;
	padding: 0.65rem 1rem;
	font-size: 0.85rem;
	font-family: inherit;
	font-weight: 500;
	color: var(--pds-text-muted);
	background: var(--pds-bg);
	border: none;
	cursor: pointer;
	transition: all var(--pds-trans);
}

.pds-haendlersuche .pds-mobile-toggle__btn--active {
	background: var(--pds-text);
	color: #fff;
}

/* === Error === */

.pds-haendlersuche .pds-error {
	margin-top: 0.75rem;
	padding: 0.75rem 1rem;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: var(--pds-radius);
	color: #991b1b;
	font-size: 0.875rem;
}

/* === Responsive === */

@media (max-width: 900px) {
	:root { --pds-sidebar-w: 320px; --pds-height: 600px; }
}

@media (max-width: 768px) {
	.pds-haendlersuche .pds-shell {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		height: auto;
	}
	.pds-haendlersuche .pds-sidebar {
		height: auto;
		max-height: none;
		overflow: visible;
		border-right: none;
		border-bottom: 1px solid var(--pds-border);
	}
	.pds-haendlersuche .pds-list {
		flex: none;
		max-height: 60vh;
	}
	.pds-haendlersuche .pds-mapwrap {
		height: 400px;
	}
	.pds-haendlersuche .pds-mobile-toggle {
		display: flex;
	}
	.pds-haendlersuche .pds-shell[data-view="map"] .pds-list,
	.pds-haendlersuche .pds-shell[data-view="map"] .pds-list__placeholder { display: none; }
	.pds-haendlersuche .pds-shell[data-view="map"] .pds-sidebar { border-bottom: none; }
	.pds-haendlersuche .pds-shell[data-view="list"] .pds-mapwrap { display: none; }
}

/* === Print === */

@media print {
	.pds-haendlersuche .pds-mapwrap,
	.pds-haendlersuche .pds-sidebar__head,
	.pds-haendlersuche .pds-mobile-toggle,
	.pds-haendlersuche .pds-consent {
		display: none !important;
	}
	.pds-haendlersuche .pds-shell {
		grid-template-columns: 1fr;
		height: auto;
		border: none;
		box-shadow: none;
	}
	.pds-haendlersuche .pds-list { max-height: none; overflow: visible; }
	.pds-haendlersuche .pds-card { break-inside: avoid; }
}
