/*
 * Block leberschlank/apotheken-suche.
 *
 * Maße aus dem Sketch-Dokument, Frames „Desktop – Das Programm“ und „Mobil – Das
 * Programm“, Abschnitt „Apotheke finden“. Auf breiten Bildschirmen bilden Formular
 * und Treffer links eine Karte (460 px), rechts steht die Landkarte. Mobil ist die
 * Reihenfolge Formular, Landkarte, Treffer, deshalb sind es drei Rasterzellen.
 */

.ls-apotheken-suche {
	display: grid;
	grid-template-columns: minmax(25rem, 460fr) minmax(0, 716fr);
	grid-template-rows: auto minmax(0, 1fr);
	column-gap: 1.5rem;
	height: 40.4375rem;
	color: var(--wp--preset--color--contrast);
}

/* Weiße Karte hinter Formular und Treffern. */
.ls-apotheken-suche::before {
	content: "";
	grid-area: 1 / 1 / 3 / 2;
	border-radius: 1.5rem;
	background-color: var(--wp--preset--color--white);
	box-shadow: 0 16px 40px rgba(59, 15, 31, 0.08);
}

.ls-apotheken-suche__form {
	grid-area: 1 / 1;
	position: relative;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem 0.75rem;
	align-items: end;
	padding: 2rem 2rem 0;
}

.ls-apotheken-suche .ls-apotheken-suche__form > :is(h2, h3, h4, p),
.ls-apotheken-suche__field--place,
.ls-apotheken-suche__submit {
	grid-column: 1 / -1;
}

.ls-apotheken-suche .ls-apotheken-suche__form > :is(h2, h3, h4) {
	margin: 0 0 0.25rem;
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.318;
}

.ls-apotheken-suche__field label {
	display: block;
	margin-bottom: 0.5rem;
	color: var(--wp--preset--color--contrast-soft);
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.385;
}

.ls-apotheken-suche__input,
.ls-apotheken-suche__select {
	position: relative;
	display: block;
}

.ls-apotheken-suche :is(input, select) {
	box-sizing: border-box;
	width: 100%;
	height: 3.5rem;
	margin: 0;
	padding: 0 1rem 0 2.875rem;
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: 0.875rem;
	background-color: var(--wp--preset--color--white);
	color: inherit;
	font-family: inherit;
	font-size: 1rem;
	opacity: 1;
}

.ls-apotheken-suche input::placeholder {
	color: var(--wp--preset--color--contrast-3);
	opacity: 1;
}

.ls-apotheken-suche select {
	height: 3.25rem;
	padding: 0 2.5rem 0 0.9375rem;
	border: 1.5px solid var(--wp--preset--color--primary-border);
	background-color: #f6f8f4;
	font-weight: 500;
	appearance: none;
}

/* Ring vor der Eingabe. */
.ls-apotheken-suche__input::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 1.125rem;
	box-sizing: border-box;
	width: 1rem;
	height: 1rem;
	border: 5px solid var(--wp--preset--color--accent);
	border-radius: 50%;
	pointer-events: none;
	translate: 0 -50%;
}

.ls-apotheken-suche__select::after,
.ls-apotheken-suche__locate::before {
	content: "";
	width: 1.25rem;
	height: 1.25rem;
	background-color: var(--wp--preset--color--primary);
	mask: url("../../assets/icons/lucide/chevron-down.svg") center / contain no-repeat;
}

.ls-apotheken-suche__select::after {
	position: absolute;
	top: 50%;
	right: 0.875rem;
	pointer-events: none;
	translate: 0 -50%;
}

.ls-apotheken-suche__locate {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(0.375rem, 0.6vw, 0.625rem);
	height: 3.25rem;
	padding: 0 0.25rem;
	border: 1.5px solid var(--wp--preset--color--primary);
	border-radius: 0.875rem;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
}

.ls-apotheken-suche__locate::before {
	flex: none;
	mask-image: url("../../assets/icons/lucide/locate-fixed.svg");
}

.ls-apotheken-suche__locate:hover {
	background-color: var(--wp--preset--color--base);
}

.ls-apotheken-suche__locate:disabled {
	opacity: 0.6;
	cursor: progress;
}

.ls-apotheken-suche__locate[hidden] {
	display: none;
}

.ls-apotheken-suche__submit {
	border: 0;
	text-align: center;
	cursor: pointer;
}

.ls-apotheken-suche :is(input, select, button, a):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

/* Treffer: Trennlinie, darunter rollt die Liste. */
.ls-apotheken-suche__results {
	grid-area: 2 / 1;
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 0;
	margin: 1.5rem 2rem 0;
	padding: 1.1875rem 0 1rem;
	border-top: 1px solid #e6ece1;
}

.ls-apotheken-suche__results[aria-busy] {
	opacity: 0.5;
}

.ls-apotheken-suche__output {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
}

.ls-apotheken-suche .ls-apotheken-suche__results p {
	margin: 0;
	color: var(--wp--preset--color--contrast-2);
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.357;
}

.ls-apotheken-suche .ls-apotheken-suche__results .ls-apotheken-suche__places {
	margin-top: 0.5rem;
	font-weight: 400;
}

.ls-apotheken-suche__places button {
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--accent);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.ls-apotheken-suche__places button + button {
	margin-left: 0.5rem;
}

.ls-apotheken-suche .ls-apotheken-suche__list {
	flex: 1;
	min-height: 0;
	margin: 0.75rem -0.5rem 0;
	padding: 0 0.5rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}

.ls-apotheken-suche__item {
	border: 1.5px solid transparent;
	border-radius: 0.875rem;
	background-color: #f6f8f4;
}

.ls-apotheken-suche__item + .ls-apotheken-suche__item {
	margin-top: 0.5rem;
}

.ls-apotheken-suche__item.is-active {
	border-color: var(--wp--preset--color--accent);
	background-color: var(--wp--preset--color--accent-pale);
}

.ls-apotheken-suche__pick {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	column-gap: 0.75rem;
	align-items: center;
	width: 100%;
	min-height: 3.9375rem;
	padding: 0.6875rem 0.75rem;
	border: 0;
	border-radius: inherit;
	background: none;
	color: inherit;
	font-family: inherit;
	text-align: left;
	cursor: pointer;
}

.ls-apotheken-suche__number,
.ls-apotheken-suche__distance {
	grid-row: 1 / span 2;
}

.ls-apotheken-suche__number {
	display: grid;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--white);
	font-size: 0.8125rem;
	font-weight: 700;
}

.ls-apotheken-suche__name {
	grid-column: 2;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3125;
}

.ls-apotheken-suche__address {
	grid-column: 2;
	color: var(--wp--preset--color--contrast-soft);
	font-size: 0.875rem;
	line-height: 1.357;
}

.ls-apotheken-suche__distance {
	grid-column: 3;
	color: var(--wp--preset--color--primary-dark);
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
}

.ls-apotheken-suche__details {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	padding: 0 0.75rem 0.75rem 3.25rem;
	font-size: 0.8125rem;
	font-weight: 600;
}

/* Ohne JavaScript bleiben die Angaben sichtbar. */
.ls-apotheken-suche.is-ready .ls-apotheken-suche__item:not(.is-active) .ls-apotheken-suche__details {
	display: none;
}

.ls-apotheken-suche__details a,
.ls-apotheken-suche__popup .leaflet-popup-content a {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

.ls-apotheken-suche__details a:hover,
.ls-apotheken-suche__popup .leaflet-popup-content a:hover {
	text-decoration: underline;
}

.ls-apotheken-suche__more {
	display: none;
}

.ls-apotheken-suche .ls-apotheken-suche__results .ls-apotheken-suche__credit {
	margin-top: 0.5rem;
	font-size: 0.6875rem;
	font-weight: 400;
}

.ls-apotheken-suche__credit a {
	color: inherit;
}

/* Landkarte. isolation hält die hohen z-index-Werte von Leaflet unter Menüs und Cookie-Banner. */
.ls-apotheken-suche__map {
	grid-area: 1 / 2 / 3 / 3;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	border-radius: 1.5rem;
	background-color: #f1f3f5;
	box-shadow: 0 16px 40px rgba(59, 15, 31, 0.08);
}

.ls-apotheken-suche__canvas {
	position: absolute;
	inset: 0;
	background-color: #f1f3f5;
	font-family: inherit;
}

.ls-apotheken-suche__consent {
	position: absolute;
	inset: 0;
	display: grid;
	align-content: center;
	justify-items: center;
	gap: 1rem;
	padding: 1.5rem;
	text-align: center;
}

.ls-apotheken-suche__consent[hidden] {
	display: none;
}

.ls-apotheken-suche .ls-apotheken-suche__consent p {
	max-width: 24rem;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.5;
}

.ls-apotheken-suche__load {
	border: 0;
	cursor: pointer;
}

.ls-apotheken-suche__pin {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	border: 3px solid var(--wp--preset--color--white);
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent);
	box-shadow: 0 4px 10px rgba(59, 15, 31, 0.3);
	color: var(--wp--preset--color--white);
	font-size: 0.9375rem;
	font-weight: 700;
}

/* Spitze des Pins. */
.ls-apotheken-suche__pin::after {
	content: "";
	position: absolute;
	z-index: -1;
	bottom: -0.6875rem;
	left: 50%;
	width: 1.25rem;
	height: 0.875rem;
	background-color: var(--wp--preset--color--accent);
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	translate: -50% 0;
}

.ls-apotheken-suche__pin.is-active {
	background-color: var(--wp--preset--color--contrast);
}

.ls-apotheken-suche__pin.is-active::after {
	background-color: var(--wp--preset--color--contrast);
}

/* Mitte der Suche. */
.ls-apotheken-suche__here {
	border-radius: 50%;
	background: radial-gradient(circle, #1a73e8 0 6px, #fff 6px 9px, rgba(26, 115, 232, 0.16) 9px);
}

.ls-apotheken-suche__point {
	fill: var(--wp--preset--color--primary);
	fill-opacity: 1;
	stroke: var(--wp--preset--color--white);
}

.ls-apotheken-suche__popup .leaflet-popup-content-wrapper {
	border-radius: 0.875rem;
	box-shadow: 0 8px 24px rgba(59, 15, 31, 0.15);
}

.ls-apotheken-suche__popup .leaflet-popup-content {
	display: block;
	margin: 0.75rem 0.875rem;
	color: var(--wp--preset--color--contrast-soft);
	font-family: var(--wp--preset--font-family--roboto-slab);
	font-size: 0.8125rem;
	line-height: 1.54;
}

.ls-apotheken-suche__popup .leaflet-popup-content :is(strong, span, a) {
	display: block;
}

.ls-apotheken-suche__popup .leaflet-popup-content strong {
	color: var(--wp--preset--color--contrast);
	font-size: 0.9375rem;
	font-weight: 600;
}

.ls-apotheken-suche__popup .leaflet-popup-content a {
	font-weight: 600;
}

.ls-apotheken-suche__map .leaflet-bar {
	border: 0;
	border-radius: 0.5rem;
	box-shadow: 0 2px 8px rgba(59, 15, 31, 0.15);
}

.ls-apotheken-suche__map .leaflet-bar a {
	width: 2.5rem;
	height: 2.5rem;
	color: var(--wp--preset--color--contrast-soft);
	line-height: 2.5rem;
}

.ls-apotheken-suche__map .leaflet-control-attribution {
	font-family: var(--wp--preset--font-family--roboto-slab);
}

@media (max-width: 61.9375rem) {

	.ls-apotheken-suche {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		row-gap: 1rem;
		height: auto;
	}

	.ls-apotheken-suche::before {
		content: none;
	}

	.ls-apotheken-suche__form,
	.ls-apotheken-suche__map,
	.ls-apotheken-suche__results {
		grid-area: auto;
	}

	.ls-apotheken-suche__form {
		gap: 0.875rem 0.75rem;
		padding: 1.25rem;
		border-radius: 1.375rem;
		background-color: var(--wp--preset--color--white);
		box-shadow: 0 12px 30px rgba(59, 15, 31, 0.08);
	}

	.ls-apotheken-suche__map {
		order: 1;
		height: 18.75rem;
		border-radius: 1.375rem;
	}

	.ls-apotheken-suche__results {
		order: 2;
		margin: 0.25rem 0 0;
		padding: 0;
		border: 0;
	}

	.ls-apotheken-suche .ls-apotheken-suche__list {
		margin: 0.625rem 0 0;
		padding: 0;
		overflow: visible;
	}

	.ls-apotheken-suche__item:not(.is-active) {
		background-color: var(--wp--preset--color--white);
	}

	/* Fünf Treffer, der Rest auf Knopfdruck. Ohne JavaScript alle. */
	.ls-apotheken-suche.is-ready .ls-apotheken-suche__results:not(.is-expanded) .ls-apotheken-suche__item:nth-child(n + 6) {
		display: none;
	}

	.ls-apotheken-suche__more:not([hidden]) {
		display: block;
		height: 3rem;
		margin-top: 0.75rem;
		border: 1.5px solid var(--wp--preset--color--primary);
		border-radius: 1.5rem;
		background: none;
		color: var(--wp--preset--color--primary);
		font-family: inherit;
		font-size: 0.9375rem;
		font-weight: 600;
		cursor: pointer;
	}
}

@media (max-width: 37.4375rem) {

	.ls-apotheken-suche__form {
		grid-template-columns: minmax(0, 1fr);
		gap: 0.75rem;
	}

	.ls-apotheken-suche .ls-apotheken-suche__form > :is(h2, h3, h4) {
		font-size: 1.1875rem;
	}

	.ls-apotheken-suche input {
		height: 3.25rem;
		padding-left: 2.625rem;
	}

	.ls-apotheken-suche__input::before {
		left: 1rem;
	}

	.ls-apotheken-suche select {
		height: 3.125rem;
	}

	.ls-apotheken-suche__locate {
		height: 3rem;
		border-radius: 1.5rem;
		font-size: 0.9375rem;
	}

	.ls-apotheken-suche__submit {
		padding-block: 0.9375rem;
	}

	.ls-apotheken-suche__map .leaflet-bar a {
		width: 2.125rem;
		height: 2.125rem;
		line-height: 2.125rem;
	}
}
