/**
 * NA Consent – Banner und Platzhalter für blockierte Inhalte.
 * Farben kommen als CSS-Variablen aus den Einstellungen (--sc-primary, --sc-primary-text,
 * --sc-text, --sc-bg, --sc-muted, --sc-border, --sc-focus); die Schriftfarbe der Buttons wird
 * serverseitig nach Kontrast gewählt. Form: --sc-radius, --sc-btn-radius, --sc-card-width (nur Rückfallwerte
 * hier, eigene Werte über „Zusätzliches CSS“). Variablen und Klassen sind in der readme beschrieben.
 */

.sc-banner,
.sc-banner *,
.sc-embed,
.sc-embed *,
.sc-toggle {
	box-sizing: border-box;
}

/* [hidden] darf durch Layout-Regeln (display: flex/grid) nie überschrieben werden. */
.sc-banner[hidden],
.sc-banner [hidden],
.sc-toggle[hidden],
.sc-embed [hidden] {
	display: none !important;
}

/* === Banner === */
.sc-banner {
	position: fixed;
	z-index: 999999;
	max-height: 100vh;
	max-height: 100dvh;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--sc-bg, #fff);
	color: var(--sc-text, #1d2327);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	text-align: left;
	box-shadow: 0 -2px 18px rgba(0, 0, 0, .14);
	border-top: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	animation: sc-slide-up .35s ease-out both;
}

@keyframes sc-slide-up {
	from { transform: translateY(100%); opacity: 0; }
	to   { transform: none; opacity: 1; }
}
@keyframes sc-slide-down {
	from { transform: translateY(-100%); opacity: 0; }
	to   { transform: none; opacity: 1; }
}
@keyframes sc-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.sc-position-bottom-bar {
	left: 0;
	right: 0;
	bottom: 0;
}
.sc-position-bottom-left,
.sc-position-bottom-right {
	bottom: 16px;
	max-width: var(--sc-card-width, 440px);
	max-height: calc(100vh - 32px); /* Sonst ragt die Karte um den Abstand zum Rand oben heraus. */
	max-height: calc(100dvh - 32px);
	border-radius: var(--sc-radius, 8px);
	border: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
}
.sc-position-bottom-left  { left: 16px; }
.sc-position-bottom-right { right: 16px; }

.sc-position-top-bar {
	top: 0;
	left: 0;
	right: 0;
	border-top: 0;
	border-bottom: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	box-shadow: 0 2px 18px rgba(0, 0, 0, .14);
	animation-name: sc-slide-down;
}
/* Nicht über die Adminleiste von WordPress legen. */
.admin-bar .sc-position-top-bar {
	top: 32px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
}

/* Mittig über inset und margin: Die Einblend-Animation endet mit transform: none, ein translate ginge verloren.
   Bewusst ohne Abdunklung und ohne Fokus-Sperre: Die Seite bleibt bedienbar, das ist keine Cookie Wall. */
.sc-position-center {
	inset: 0;
	width: min(var(--sc-card-width, 560px), calc(100% - 32px));
	height: fit-content;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	margin: auto;
	border-radius: var(--sc-radius, 8px);
	border: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
	animation-name: sc-fade-in;
}

.sc-banner__inner {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px 24px;
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px 20px;
}
.sc-position-bottom-left .sc-banner__inner,
.sc-position-bottom-right .sc-banner__inner,
.sc-position-center .sc-banner__inner {
	flex-direction: column;
	align-items: stretch;
	max-width: none;
	padding: 18px 20px;
}

.sc-banner__intro {
	flex: 1 1 380px;
	min-width: 0;
	padding-right: 28px;
}
.sc-banner__title {
	margin: 0 0 4px;
	padding: 0;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
}
/* Im Spaltenlayout wäre die Basis von 380px die Höhe: große Lücke über den Buttons. */
.sc-position-bottom-left .sc-banner__intro,
.sc-position-bottom-right .sc-banner__intro,
.sc-position-center .sc-banner__intro {
	flex: 0 0 auto;
}
.sc-banner__text p {
	margin: 0 0 6px;
	font-size: 13px;
	color: inherit;
}
.sc-banner__text p.sc-banner__withdraw {
	color: var(--sc-muted, inherit);
	font-size: 12px;
}
.sc-banner__links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 4px 0 0;
	font-size: 12px;
}
.sc-banner a,
.sc-embed a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.sc-banner a:hover,
.sc-embed a:hover {
	text-decoration-thickness: 2px;
}

/* Schließen (nur wenn der Banner mit bestehender Entscheidung erneut geöffnet wurde). */
.sc-banner__close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

/* === Buttons: „Nur Notwendige“ und „Alle akzeptieren“ sind gleichwertig gestaltet. === */
.sc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	flex: 0 1 auto;
}
.sc-position-bottom-left .sc-banner__actions,
.sc-position-bottom-right .sc-banner__actions,
.sc-position-center .sc-banner__actions {
	align-items: stretch;
}
.sc-position-bottom-left .sc-btn--choice,
.sc-position-bottom-right .sc-btn--choice,
.sc-position-center .sc-btn--choice {
	flex: 1 1 10em;
}

.sc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 10px 18px;
	border: 2px solid transparent;
	border-radius: var(--sc-btn-radius, 4px);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-align: center;
	text-transform: none;
	text-decoration: none;
	white-space: normal;
	cursor: pointer;
	box-shadow: none;
	transition: filter .15s;
}
.sc-btn--choice {
	min-width: 11em; /* Beide Texte passen hinein: gleich breit, auch ohne gemeinsame Zeile. */
	background: var(--sc-primary, #2271b1);
	border-color: var(--sc-primary, #2271b1);
	color: var(--sc-primary-text, #fff);
}
.sc-btn--choice:hover {
	filter: brightness(1.08);
}
.sc-btn--link {
	background: transparent;
	border-color: var(--sc-border, rgba(0, 0, 0, .25));
	color: inherit;
	font-weight: 500;
}

.sc-btn:focus-visible,
.sc-banner__close:focus-visible,
.sc-toggle:focus-visible,
.sc-banner a:focus-visible,
.sc-banner input:focus-visible,
.sc-banner summary:focus-visible,
.sc-embed a:focus-visible,
.sc-embed input:focus-visible {
	outline: 3px solid var(--sc-focus, #1d2327);
	outline-offset: 2px;
}

/* === Einstellungen === */
.sc-banner__details:not([hidden]) {
	display: grid;
	flex-basis: 100%;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 12px;
	max-height: 55vh;
	overflow-y: auto;
	padding-top: 12px;
	border-top: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
}
.sc-cat {
	padding: 10px 12px;
	border: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	border-radius: 6px;
}
.sc-cat__row {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
}
.sc-cat__row input[type="checkbox"] {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--sc-primary, #2271b1);
}
.sc-cat__label {
	cursor: pointer;
}
.sc-cat__required {
	margin-left: auto;
	font-size: 12px;
	font-weight: 500;
	color: var(--sc-muted, inherit);
}
.sc-cat__desc,
.sc-cat__extra {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--sc-muted, inherit);
}
.sc-services {
	margin-top: 6px;
	font-size: 12px;
}
.sc-services summary {
	cursor: pointer;
	font-weight: 600;
}
.sc-services__list {
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
}
.sc-services__empty {
	margin: 6px 0 0;
}
.sc-service {
	margin: 0;
	padding: 6px 0;
	border-top: 1px dashed var(--sc-border, rgba(0, 0, 0, .12));
}
.sc-service__name {
	display: block;
	font-weight: 600;
}
.sc-service__facts {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 8px;
	margin: 4px 0;
}
.sc-service__facts dt {
	font-weight: 600;
}
.sc-service__facts dd {
	margin: 0;
}

/* === Button zum erneuten Öffnen === */
.sc-toggle {
	position: fixed;
	bottom: 16px;
	left: 16px;
	z-index: 999998;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--sc-border, rgba(0, 0, 0, .12));
	border-radius: 50%;
	background: var(--sc-bg, #fff);
	color: var(--sc-text, #1d2327);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
	transition: transform .15s;
}
.sc-toggle:hover {
	transform: scale(1.05);
}

/* === Platzhalter für blockierte Einbettungen (Farben wie der Banner) === */
.sc-embed {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 200px;
	margin: 0 auto;
	overflow: auto;
	background: var(--sc-bg, #fff);
	color: var(--sc-text, #1d2327);
	border: 1px solid var(--sc-border, rgba(0, 0, 0, .2));
	border-radius: 6px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	vertical-align: top;
}
.sc-embed > iframe {
	display: none !important;
}
.sc-hint {
	display: block;
	margin: 8px 0;
	border: 1px solid currentColor;
	border-radius: 6px;
	background: var(--sc-bg, #fff);
	color: var(--sc-text, #1d2327);
}
.sc-hint .sc-embed__ph {
	max-width: none;
}
.sc-embed__ph {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	max-width: 540px;
	padding: 16px;
}
.sc-embed__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
}
.sc-embed__text {
	display: block;
	font-size: 13px;
}
.sc-embed__always {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	cursor: pointer;
}
.sc-embed__always input {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--sc-primary, #2271b1);
}
/* WordPress-Einbettungen mit festem Seitenverhältnis: Platzhalter füllt den Rahmen. */
.wp-embed-responsive .wp-has-aspect-ratio .wp-block-embed__wrapper > .sc-embed {
	position: absolute;
	inset: 0;
	max-width: none !important;
	min-height: 0;
	aspect-ratio: auto !important;
}

/* === Mobil: gleiche Reihenfolge der Buttons wie auf dem Desktop === */
@media (max-width: 600px) {
	.sc-banner__inner {
		flex-direction: column;
		align-items: stretch;
		padding: 14px 16px;
	}
	.sc-banner__intro {
		flex: 0 0 auto;
	}
	.sc-banner__actions {
		flex-direction: column;
		align-items: stretch;
	}
	.sc-banner__actions .sc-btn {
		flex: 0 0 auto; /* Untereinander wäre die Breite aus flex: 1 1 10em sonst die Höhe. */
		width: 100%;
	}
	.sc-position-bottom-left,
	.sc-position-bottom-right {
		left: 8px;
		right: 8px;
		bottom: 8px;
		max-width: none;
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
	}
	.sc-position-center {
		width: calc(100% - 16px);
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
	}
	.sc-service__facts {
		grid-template-columns: 1fr;
	}
}

/* Adminleiste: ab 782 px höher (WordPress-Grenze). */
@media (max-width: 782px) {
	.admin-bar .sc-position-top-bar {
		top: 46px;
		max-height: calc(100vh - 46px);
		max-height: calc(100dvh - 46px);
	}
}

/* === Formular für Datenanfragen [sc_data_request], Farben und Schrift vom Theme === */
.sc-request {
	max-width: 34rem;
}
.sc-request__fields {
	display: grid;
	gap: 14px;
}
.sc-request__fields[hidden] {
	display: none;
}
.sc-request__type {
	margin: 0;
	padding: 0;
	border: 0;
}
.sc-request__type legend {
	padding: 0;
	font-weight: 600;
}
.sc-request__type label {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin-top: 8px;
}
.sc-request__type input {
	flex: 0 0 auto;
	margin-top: .3em;
}
.sc-request__field {
	display: grid;
	gap: 4px;
	font-weight: 600;
}
.sc-request__field input {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	padding: 8px 10px;
	font: inherit;
	font-weight: 400;
}
.sc-request__hint,
.sc-request__none,
.sc-request__note,
.sc-request__actions {
	margin: 0;
}
.sc-request__hint,
.sc-request__none,
.sc-request__note {
	font-size: .875em;
}
.sc-request__none {
	font-weight: 600;
}
.sc-request__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.sc-request__msg {
	margin: 12px 0 0;
	font-weight: 600;
}
.sc-request__msg:empty {
	display: none;
}

/* === Weniger Bewegung === */
@media (prefers-reduced-motion: reduce) {
	.sc-banner {
		animation: none;
	}
	.sc-btn,
	.sc-toggle {
		transition: none;
	}
	.sc-toggle:hover {
		transform: none;
	}
}
