/**
 * EZZE Website – Cookie-Banner und Einstellungsdialog.
 *
 * Läuft auf der ganzen Website, also auch dort, wo site.css nicht geladen ist: Farben und Maße
 * stehen deshalb hier als eigene Variablen (gleiche Werte wie die --ezze-*-Tokens in site.css).
 * Kein eigenes Fokus-CSS: den sichtbaren Fokus liefert EZZE WCAG Pro auf der Website.
 * „Alle ablehnen“ und „Alle akzeptieren“ sind absichtlich identisch gestaltet.
 */

.ezze-consent,
.ezze-consent-dialog {
	--ezze-c-ink: #160647;
	--ezze-c-muted: rgba(22, 6, 70, 0.72);
	--ezze-c-blue: #0062d2;
	--ezze-c-line: #dde6f3;
	--ezze-c-tint: #f4fafd;
	--ezze-c-badge: #d4edfa;
	--ezze-c-font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Fokussierte Elemente nicht unter dem Banner verstecken (WCAG 2.4.11). */
html.ezze-consent-open {
	scroll-padding-bottom: calc(var(--ezze-consent-offset, 0px) + 16px);
}

/* Platz am Seitenende, damit auch die letzten Footer-Links über den Banner scrollen können. */
html.ezze-consent-open body {
	padding-bottom: calc(var(--ezze-consent-offset, 0px) + 16px);
}

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

/* ---------- Banner ---------- */

.ezze-consent__banner {
	position: fixed;
	z-index: 2147483000;
	right: 16px;
	bottom: 16px;
	left: 16px;
	box-sizing: border-box;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 16px 32px;
	align-items: center;
	max-width: 1200px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	margin: 0 auto;
	padding: 22px 26px;
	overflow-y: auto;
	container-type: inline-size;
	container-name: ezze-consent;
	font-family: var(--ezze-c-font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--ezze-c-muted);
	text-align: left;
	background: #fff;
	border: 1px solid var(--ezze-c-line);
	border-radius: 16px;
	box-shadow: 0 18px 50px -18px rgba(22, 6, 70, 0.35);
	animation: ezze-consent-in 0.4s ease-out both;
}

.ezze-consent__banner[hidden],
.ezze-consent-dialog:not([open]) {
	display: none;
}

@keyframes ezze-consent-in {
	from { opacity: 0; transform: translateY(16px); }
	to { opacity: 1; transform: none; }
}

.ezze-consent__title,
.ezze-consent-dialog__title {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0 0 6px;
	padding: 0;
	font-family: var(--ezze-c-font);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--ezze-c-ink);
	text-transform: none;
}

.ezze-consent__title .ezze-icon,
.ezze-consent-dialog__title .ezze-icon,
.ezze-consent-cat__title .ezze-icon {
	flex: none;
	width: 22px;
	height: 22px;
	color: var(--ezze-c-blue);
}

.ezze-consent__text {
	margin: 0;
	font-size: 15px;
	color: var(--ezze-c-muted);
}

.ezze-consent a {
	color: var(--ezze-c-blue);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ezze-consent__actions,
.ezze-consent-dialog__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: flex-end;
}

/* Gleiches Gewicht für jede Wahl. */
.ezze-consent__btn {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	margin: 0;
	padding: 12px 20px;
	font-family: var(--ezze-c-font);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
	cursor: pointer;
	border-radius: 10px;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ezze-consent__btn--choice {
	color: #fff;
	background: var(--ezze-c-ink);
	border: 2px solid var(--ezze-c-ink);
}

.ezze-consent__btn--choice:hover {
	background: var(--ezze-c-blue);
	border-color: var(--ezze-c-blue);
}

.ezze-consent__btn--quiet {
	color: var(--ezze-c-ink);
	background: #fff;
	border: 2px solid var(--ezze-c-line);
}

.ezze-consent__btn--quiet:hover {
	color: var(--ezze-c-blue);
	border-color: var(--ezze-c-blue);
}

/* Schmaler Banner (Handy, schmale Fenster, Zoom): Text oben, Wahl darunter in voller Breite. */
@container ezze-consent (max-width: 760px) {
	.ezze-consent__body,
	.ezze-consent__actions {
		grid-column: 1 / -1;
	}

	.ezze-consent__actions {
		display: grid;
		grid-template-columns: 1fr 1fr;
	}

	.ezze-consent__btn--quiet {
		grid-column: 1 / -1;
	}
}

@container ezze-consent (max-width: 280px) {
	.ezze-consent__actions {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 600px) {
	.ezze-consent__banner {
		right: 8px;
		bottom: 8px;
		left: 8px;
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
		padding: 18px 16px;
	}

	.ezze-consent__text {
		font-size: 14px;
	}
}

/* ---------- Dialog ---------- */

.ezze-consent-dialog {
	box-sizing: border-box;
	width: min(640px, calc(100vw - 32px));
	max-width: none;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	margin: auto;
	padding: 0;
	overflow: hidden;
	font-family: var(--ezze-c-font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--ezze-c-muted);
	background: #fff;
	border: 1px solid var(--ezze-c-line);
	border-radius: 20px;
	box-shadow: 0 24px 70px -20px rgba(22, 6, 70, 0.45);
}

.ezze-consent-dialog[open] {
	display: flex;
	animation: ezze-consent-in 0.3s ease-out both;
}

.ezze-consent-dialog::backdrop {
	background: rgba(22, 6, 70, 0.45);
}

.ezze-consent-dialog__form {
	display: flex;
	flex-direction: column;
	width: 100%;
	max-height: inherit;
	margin: 0;
	container-type: inline-size;
	container-name: ezze-consent-dialog;
}

.ezze-consent-dialog__head {
	display: flex;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 14px;
	border-bottom: 1px solid var(--ezze-c-line);
}

.ezze-consent-dialog__title {
	margin: 0;
	font-size: 20px;
}

.ezze-consent-dialog__close {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	color: var(--ezze-c-ink);
	cursor: pointer;
	background: #fff;
	border: 2px solid var(--ezze-c-line);
	border-radius: 10px;
}

.ezze-consent-dialog__close:hover {
	color: var(--ezze-c-blue);
	border-color: var(--ezze-c-blue);
}

.ezze-consent-dialog__close .ezze-icon {
	width: 20px;
	height: 20px;
}

.ezze-consent-dialog__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 18px 24px 8px;
	overflow-y: auto;
}

.ezze-consent-dialog__body p {
	margin: 0 0 14px;
}

.ezze-consent-dialog a {
	color: var(--ezze-c-blue);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ezze-consent-cat {
	margin: 0 0 14px;
	padding: 16px 18px 6px;
	background: var(--ezze-c-tint);
	border: 1px solid var(--ezze-c-line);
	border-radius: 14px;
}

.ezze-consent-cat__head {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 12px 16px;
	align-items: center;
	margin-bottom: 8px;
}

.ezze-consent-cat__title {
	display: flex;
	gap: 10px;
	align-items: center;
	margin: 0;
	padding: 0;
	font-family: var(--ezze-c-font);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--ezze-c-ink);
	text-transform: none;
}

.ezze-consent-cat__title label {
	cursor: pointer;
}

.ezze-consent-cat__fixed {
	display: inline-flex;
	gap: 6px;
	align-items: center;
	padding: 4px 12px;
	font-size: 13px;
	font-weight: 700;
	color: var(--ezze-c-ink);
	background: var(--ezze-c-badge);
	border-radius: 999px;
}

.ezze-consent-cat__fixed .ezze-icon {
	width: 16px;
	height: 16px;
}

.ezze-consent-cat__details {
	margin: 0 0 12px;
}

.ezze-consent-cat__details summary {
	display: inline-flex;
	min-height: 32px;
	align-items: center;
	font-weight: 600;
	color: var(--ezze-c-blue);
	cursor: pointer;
}

.ezze-consent-cat__details dl {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 6px 16px;
	margin: 8px 0 0;
	font-size: 14px;
}

.ezze-consent-cat__details dt {
	font-weight: 700;
	color: var(--ezze-c-ink);
}

.ezze-consent-cat__details dd {
	margin: 0;
}

@container ezze-consent-dialog (max-width: 460px) {
	.ezze-consent-cat__details dl {
		grid-template-columns: minmax(0, 1fr);
		gap: 2px;
	}

	.ezze-consent-cat__details dd {
		margin-bottom: 8px;
	}
}

/* Schalter: echte Checkbox (role="switch") über Spur und Zustandstext, damit Klick, Tastatur und
   Screenreader nativ bleiben. Der Text „An/Aus“ zeigt den Zustand zusätzlich zur Farbe (WCAG 1.4.1). */
.ezze-consent-switch {
	position: relative;
	display: inline-flex;
	flex: none;
	gap: 10px;
	align-items: center;
	justify-self: end;
	min-height: 44px;
}

.ezze-consent-switch input {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
	opacity: 0;
	appearance: none;
	-webkit-appearance: none;
}

.ezze-consent-switch__state {
	min-width: 2.5em;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	color: var(--ezze-c-ink);
	text-align: right;
}

.ezze-consent-switch__on,
.ezze-consent-switch input:checked ~ .ezze-consent-switch__state .ezze-consent-switch__off {
	display: none;
}

.ezze-consent-switch input:checked ~ .ezze-consent-switch__state .ezze-consent-switch__on {
	display: inline;
}

.ezze-consent-switch__track {
	position: relative;
	box-sizing: border-box;
	flex: none;
	width: 52px;
	height: 30px;
	background: #fff;
	border: 2px solid #6b6290;
	border-radius: 999px;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ezze-consent-switch__thumb {
	position: absolute;
	top: 50%;
	left: 3px;
	width: 20px;
	height: 20px;
	margin-top: -10px;
	background: #6b6290;
	border-radius: 50%;
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.ezze-consent-switch input:checked ~ .ezze-consent-switch__track {
	background: var(--ezze-c-blue);
	border-color: var(--ezze-c-blue);
}

.ezze-consent-switch input:checked ~ .ezze-consent-switch__track .ezze-consent-switch__thumb {
	background: #fff;
	transform: translateX(22px);
}

/* Fokus der unsichtbaren Checkbox an der sichtbaren Spur zeigen (sonst wäre er unsichtbar). */
.ezze-consent-switch input:focus-visible ~ .ezze-consent-switch__track {
	outline: 3px solid var(--ezze-c-blue);
	outline-offset: 3px;
}

.ezze-consent-dialog__more {
	margin-top: 4px;
}

.ezze-consent-dialog__actions {
	padding: 14px 24px 20px;
	border-top: 1px solid var(--ezze-c-line);
}

@container ezze-consent-dialog (max-width: 520px) {
	.ezze-consent-dialog__actions {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 600px) {
	.ezze-consent-dialog {
		width: calc(100vw - 16px);
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
		border-radius: 16px;
	}

	.ezze-consent-dialog__head,
	.ezze-consent-dialog__body,
	.ezze-consent-dialog__actions {
		padding-right: 16px;
		padding-left: 16px;
	}
}

/* ---------- Schaltfläche „Cookie-Einstellungen“ (Footer, Shortcode) ---------- */

.ezze-consent-link {
	display: inline;
	margin: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-align: inherit;
	text-decoration: underline;
	text-underline-offset: 4px;
	cursor: pointer;
	background: none;
	border: 0;
	border-radius: 0;
}

.ezze-site .ezze-footer__legal .ezze-consent-link {
	display: inline-block;
	padding-block: 4px;
	font-size: 14px;
	font-weight: 600;
	color: var(--ezze-ink, #160647);
	text-decoration: none;
}

.ezze-site .ezze-footer__legal .ezze-consent-link:hover {
	color: var(--ezze-blue, #0062d2);
	text-decoration: underline;
}

/* ---------- Bewegung und Kontrastmodi ---------- */

@media (prefers-reduced-motion: reduce) {
	.ezze-consent__banner,
	.ezze-consent-dialog[open] {
		animation: none;
	}

	.ezze-consent__btn,
	.ezze-consent-switch__track,
	.ezze-consent-switch__thumb {
		transition: none;
	}
}

html.wcag-reduce-motion .ezze-consent__banner,
html.wcag-reduce-motion .ezze-consent-dialog[open] {
	animation: none;
}

html.wcag-reduce-motion .ezze-consent__btn,
html.wcag-reduce-motion .ezze-consent-switch__track,
html.wcag-reduce-motion .ezze-consent-switch__thumb {
	transition: none;
}

@media (forced-colors: active) {
	.ezze-consent__banner,
	.ezze-consent-dialog,
	.ezze-consent-cat,
	.ezze-consent__btn {
		border: 2px solid CanvasText;
	}

	.ezze-consent-switch input {
		position: static;
		width: 24px;
		height: 24px;
		opacity: 1;
		appearance: auto;
		-webkit-appearance: checkbox;
	}

	.ezze-consent-switch__track {
		display: none;
	}
}

/*
 * Theme-Kits (Elementor: `.elementor-kit-N button { padding: 17px 20px }`) treffen
 * mit Spezifität 0,1,1 auch unsere Buttons. Der doppelte Klassenselektor (0,2,0)
 * stellt unsere Werte wieder her, ohne !important. Ohne ihn blieb im 44-px-Schließen-
 * Button keine Breite für das X übrig.
 */
.ezze-consent__btn.ezze-consent__btn {
	padding: 12px 20px;
}

.ezze-consent-dialog__close.ezze-consent-dialog__close {
	padding: 0;
}

.ezze-consent-dialog__close .ezze-icon {
	flex: none;
}
