/*
 * WOODPLAN – Cookie-Consent
 *
 * Rechtlicher Rahmen: § 25 TDDDG (Speichern/Auslesen auf dem Endgerät),
 * Art. 6 Abs. 1 lit. a, Art. 7 DSGVO (Einwilligung, Widerruf).
 *
 * Gestaltungsvorgaben der DSK, die dieses Stylesheet umsetzt:
 *  - „Alle ablehnen" und „Alle akzeptieren" sind auf der ersten Ebene
 *    gleich groß, gleich prominent und gleich kontrastreich. Kein Nudging.
 *  - Kein „X" zum Wegklicken: Wegklicken ohne Auswahl darf nicht wie eine
 *    Einwilligung wirken.
 *  - Impressum und Datenschutzerklärung bleiben aus dem Banner heraus
 *    erreichbar, das Banner verdeckt die Seite nicht.
 *
 * KANONISCHE QUELLE. Eine identische Kopie liegt unter
 * app/assets/consent/consent.css – Änderungen immer in beiden Dateien.
 */

.wpc {
	/* WOODFILM: strict black & white, no color accent (client request) -
	   the upstream WOODPLAN version uses an azure accent; overridden here. */
	--wpc-fg: #0c0c0b;
	--wpc-muted: #6b7280;
	--wpc-bg: #ffffff;
	--wpc-line: #e5e7eb;
	--wpc-accent: #0c0c0b;
	--wpc-accent-dark: #000000;
	--wpc-radius: 0px;

	position: fixed;
	z-index: 2147483000;
	font-family: "Jura", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--wpc-fg);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

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

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

/* ── Erste Ebene: Banner ───────────────────────────────────────────────── */

.wpc-banner {
	inset: auto 0 0 0;
	padding: 0 16px 16px;
	display: flex;
	justify-content: center;
	pointer-events: none; /* nur die Karte selbst ist klickbar */
}

.wpc-banner__card {
	pointer-events: auto;
	width: 100%;
	max-width: 720px;
	background: var(--wpc-bg);
	border: 1px solid var(--wpc-line);
	border-radius: var(--wpc-radius);
	box-shadow: 0 12px 40px rgba(16, 24, 40, .16);
	padding: 20px 22px;
}

.wpc-title {
	margin: 0 0 6px;
	font-size: 1.0625rem;
	font-weight: 700;
	letter-spacing: -.01em;
}

.wpc-text {
	margin: 0 0 14px;
	font-size: .875rem;
	color: var(--wpc-muted);
}

.wpc-text a { color: var(--wpc-accent); }

.wpc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

/* Ablehnen und Akzeptieren teilen sich den Platz zu gleichen Teilen. */
.wpc-actions__primary {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	flex: 1 1 320px;
}

.wpc-legal {
	margin: 14px 0 0;
	font-size: .75rem;
	color: var(--wpc-muted);
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
}

.wpc-legal a { color: inherit; text-decoration: underline; }
.wpc-legal a:hover { color: var(--wpc-accent); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.wpc-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border-radius: 0;
	border: 1px solid transparent;
	font: inherit;
	font-size: .875rem;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.wpc-btn:focus-visible {
	outline: 2px solid var(--wpc-accent);
	outline-offset: 2px;
}

/* „Ablehnen" und „Akzeptieren": identische Geometrie, gleichwertiger Kontrast. */
.wpc-btn--accept {
	background: var(--wpc-accent);
	border-color: var(--wpc-accent);
	color: #fff;
}
.wpc-btn--accept:hover {
	background: var(--wpc-accent-dark);
	border-color: var(--wpc-accent-dark);
}

.wpc-btn--reject {
	background: var(--wp-stone-900, #1B2026);
	border-color: var(--wp-stone-900, #1B2026);
	color: #fff;
}
.wpc-btn--reject:hover {
	background: #000;
	border-color: #000;
}

.wpc-btn--ghost {
	background: transparent;
	border-color: var(--wpc-line);
	color: var(--wpc-fg);
	flex: 0 0 auto;
}
.wpc-btn--ghost:hover {
	border-color: var(--wpc-accent);
	color: var(--wpc-accent);
}

/* ── Zweite Ebene: Einstellungen ───────────────────────────────────────── */

.wpc-modal {
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.wpc-modal__scrim {
	position: absolute;
	inset: 0;
	background: rgba(16, 24, 40, .55);
}

.wpc-modal__panel {
	position: relative;
	width: 100%;
	max-width: 620px;
	max-height: min(86vh, 760px);
	display: flex;
	flex-direction: column;
	background: var(--wpc-bg);
	border-radius: var(--wpc-radius);
	box-shadow: 0 24px 64px rgba(16, 24, 40, .28);
	overflow: hidden;
}

.wpc-modal__head {
	padding: 22px 24px 14px;
	border-bottom: 1px solid var(--wpc-line);
}

.wpc-modal__body {
	padding: 8px 24px 20px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.wpc-modal__foot {
	padding: 16px 24px;
	border-top: 1px solid var(--wpc-line);
	background: var(--wp-stone-50, #F8F7F5);
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.wpc-modal__foot .wpc-actions__primary { flex: 1 1 300px; }

/* ── Kategorien ────────────────────────────────────────────────────────── */

.wpc-cat {
	border: 1px solid var(--wpc-line);
	border-radius: 0;
	padding: 14px 16px;
	margin-top: 12px;
}

.wpc-cat__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.wpc-cat__name {
	margin: 0;
	font-size: .9375rem;
	font-weight: 700;
}

.wpc-cat__desc {
	margin: 6px 0 0;
	font-size: .8125rem;
	color: var(--wpc-muted);
}

.wpc-cat__always {
	flex: 0 0 auto;
	font-size: .75rem;
	font-weight: 600;
	color: var(--wp-success, #2E7D52);
	white-space: nowrap;
	padding-top: 2px;
}

/* Schalter */
.wpc-switch { flex: 0 0 auto; position: relative; }

.wpc-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.wpc-switch__track {
	display: block;
	width: 46px;
	height: 26px;
	border-radius: 999px;
	background: var(--wp-stone-300, #d1d5db);
	transition: background-color .15s ease;
	pointer-events: none;
}

.wpc-switch__track::after {
	content: "";
	display: block;
	width: 20px;
	height: 20px;
	margin: 3px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(16, 24, 40, .3);
	transition: transform .15s ease;
}

.wpc-switch input:checked + .wpc-switch__track { background: var(--wpc-accent); }
.wpc-switch input:checked + .wpc-switch__track::after { transform: translateX(20px); }
.wpc-switch input:focus-visible + .wpc-switch__track {
	outline: 2px solid var(--wpc-accent);
	outline-offset: 2px;
}

/* Dienste-Details je Kategorie */
.wpc-services {
	margin: 12px 0 0;
	border-top: 1px dashed var(--wpc-line);
	padding-top: 10px;
}

.wpc-services summary {
	cursor: pointer;
	font-size: .8125rem;
	font-weight: 600;
	color: var(--wpc-accent);
	list-style: none;
}
.wpc-services summary::-webkit-details-marker { display: none; }
.wpc-services summary::before { content: "▸ "; }
.wpc-services[open] summary::before { content: "▾ "; }

.wpc-service {
	margin-top: 10px;
	font-size: .8125rem;
}

.wpc-service__name { font-weight: 600; }

.wpc-service dl {
	margin: 4px 0 0;
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 2px 10px;
	color: var(--wpc-muted);
}
.wpc-service dt { font-weight: 600; }
.wpc-service dd { margin: 0; overflow-wrap: anywhere; }

/* ── Platzhalter für gesperrte Einbettungen ────────────────────────────── */

.wpc-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 200px;
	padding: 24px;
	text-align: center;
	background: var(--wp-stone-50, #F8F7F5);
	border: 1px dashed var(--wpc-line);
	border-radius: 0;
	font-size: .875rem;
	color: var(--wpc-muted);
}

.wpc-placeholder .wpc-btn { min-height: 40px; }

/* ── Dauerhafte Rechtsleiste (App-Seiten) ──────────────────────────────────
 * Trägt Impressum und Datenschutzerklärung (§ 5 DDG: leicht erkennbar,
 * unmittelbar erreichbar, ständig verfügbar) sowie den Widerruf der
 * Einwilligung (Art. 7 Abs. 3 DSGVO). Auf der Website übernimmt das der
 * Footer, dort wird diese Leiste nicht verwendet.
 */

.wpc-legalbar {
	position: fixed;
	left: 50%;
	bottom: 10px;
	transform: translateX(-50%);
	z-index: 2147482000; /* unter dem Consent-Banner */
	margin: 0;
	padding: 6px 14px;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 14px;
	max-width: calc(100vw - 20px);
	background: rgba(255, 255, 255, .88);
	backdrop-filter: blur(6px);
	border: 1px solid var(--wp-stone-200, #e5e7eb);
	border-radius: 0;
	font-family: "Jura", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: .75rem;
	line-height: 1.4;
	color: var(--wp-stone-600, #6b7280);
	box-shadow: 0 2px 10px rgba(16, 24, 40, .08);
}

.wpc-legalbar a {
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.wpc-legalbar a:hover,
.wpc-legalbar a:focus-visible {
	color: var(--wp-azure-400, #2D6A9F);
	text-decoration: underline;
}

@media (max-width: 560px) {
	.wpc-legalbar { font-size: .6875rem; padding: 5px 10px; gap: 3px 10px; }
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 560px) {
	/*
	 * Auf dem Handy zählt jede Zeile: Das Banner war zuvor rund 45 % des
	 * Bildschirms hoch und stellte damit sogar das größte sichtbare Element
	 * der Seite (LCP). Drei gestapelte Knöpfe allein waren gut 170 Pixel.
	 *
	 * Ablehnen und Akzeptieren stehen deshalb nebeneinander — gleich breit,
	 * gleich hoch, gleicher Kontrast. Die Vorgabe der DSK ist damit unverändert
	 * erfüllt, es wird nur kein Platz mehr verschenkt.
	 */
	.wpc-banner { padding: 0 8px 8px; }
	.wpc-banner__card { padding: 14px 14px 12px; border-radius: 0; }

	.wpc-title { font-size: 1rem; margin-bottom: 4px; }
	.wpc-text  { font-size: .8125rem; line-height: 1.45; margin-bottom: 10px; }

	.wpc-actions { gap: 8px; }
	.wpc-actions__primary { grid-template-columns: 1fr 1fr; gap: 8px; flex-basis: 100%; }
	/* 44 px bleibt stehen: WCAG 2.5.5 (Zielgröße). Gespart wird an der
	   Schrift und am Innenabstand, nicht an der Trefffläche. */
	.wpc-btn { min-height: 44px; padding: 9px 10px; font-size: .8125rem; }

	/* Einstellungen bleibt ein echter Knopf, braucht aber nicht die volle Breite. */
	.wpc-btn--ghost { flex: 0 0 auto; padding: 9px 16px; }

	.wpc-legal { margin-top: 10px; font-size: .6875rem; gap: 2px 12px; }

	.wpc-modal__foot .wpc-btn--ghost { order: 3; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.wpc * { transition: none !important; }
}
