/*
 * CTM Consent - Banner, Platzhalter fuer externe Inhalte, Cookie-Erklaerung.
 *
 * Die Akzentfarbe kommt als Inline-Custom-Property --ctm-cc-accent vom PHP.
 * Alle Klassen sind mit ctm-cc- praefixiert, damit es keine Kollisionen mit
 * dem Theme gibt.
 */

.ctm-cc,
.ctm-cc-badge {
	--ctm-cc-accent: #0b57d0;
	--ctm-cc-ink: #1b1b1b;
	--ctm-cc-muted: #4a4a4a;
	--ctm-cc-line: #d6d8dc;
	--ctm-cc-surface: #ffffff;
	--ctm-cc-surface-2: #f5f6f8;
	--ctm-cc-focus: #101317;
	--ctm-cc-radius: 6px;
	--ctm-cc-badge-left: 20px;
	--ctm-cc-badge-bottom: 84px;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.55;
	color: var(--ctm-cc-ink);
	box-sizing: border-box;
}

.ctm-cc *,
.ctm-cc *::before,
.ctm-cc *::after,
.ctm-cc-badge * {
	box-sizing: inherit;
}

.ctm-cc[hidden],
.ctm-cc-badge[hidden],
.ctm-cc__details[hidden],
.ctm-cc__panel[hidden] {
	display: none !important;
}

/* --- Buehne ---------------------------------------------------------- */

.ctm-cc {
	position: fixed;
	inset: 0;
	z-index: 2147483100;
	display: flex;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ctm-cc--bottom {
	align-items: flex-end;
}

.ctm-cc--center {
	align-items: center;
}

.ctm-cc__overlay {
	position: fixed;
	inset: 0;
	background: rgba(16, 19, 23, 0.55);
}

/* --- Karte ----------------------------------------------------------- */

.ctm-cc__dialog {
	position: relative;
	width: 100%;
	max-width: 920px;
	background: var(--ctm-cc-surface);
	border-radius: var(--ctm-cc-radius);
	box-shadow: 0 18px 50px -12px rgba(16, 19, 23, 0.45), 0 2px 6px rgba(16, 19, 23, 0.12);
	overflow: hidden;
}

.ctm-cc__dialog:focus {
	outline: none;
}

.ctm-cc__accentbar {
	display: block;
	height: 4px;
	background: var(--ctm-cc-accent);
}

.ctm-cc__main {
	padding: 22px 24px 18px;
}

.ctm-cc__title {
	margin: 0 0 8px;
	font-size: 19px;
	line-height: 1.3;
	font-weight: 700;
	color: var(--ctm-cc-ink);
}

.ctm-cc__message {
	margin: 0 0 16px;
	color: var(--ctm-cc-muted);
}

.ctm-cc__message p {
	margin: 0 0 8px;
}

.ctm-cc__message p:last-child {
	margin-bottom: 0;
}

.ctm-cc__message a {
	color: var(--ctm-cc-accent);
}

/* --- Kategorien ------------------------------------------------------ */

.ctm-cc__cats {
	margin: 0 0 18px;
	padding: 0;
	border: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
}

.ctm-cc__legend {
	padding: 0;
	margin: 0 0 10px;
	font-weight: 600;
	font-size: 14px;
	color: var(--ctm-cc-ink);
	width: 100%;
}

.ctm-cc__cat {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.ctm-cc__checkbox {
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--ctm-cc-accent);
	flex: none;
	cursor: pointer;
}

.ctm-cc__checkbox:disabled {
	cursor: default;
}

.ctm-cc__catlabel {
	cursor: pointer;
	color: var(--ctm-cc-ink);
}

.ctm-cc__checkbox:disabled + .ctm-cc__catlabel {
	cursor: default;
	color: var(--ctm-cc-muted);
}

.ctm-cc__hint {
	color: var(--ctm-cc-muted);
	font-size: 13px;
}

/* --- Buttons --------------------------------------------------------- */

.ctm-cc__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	margin: 0 0 12px;
}

.ctm-cc__btn {
	appearance: none;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	padding: 11px 18px;
	border-radius: var(--ctm-cc-radius);
	border: 1px solid var(--ctm-cc-line);
	background: var(--ctm-cc-surface);
	color: var(--ctm-cc-ink);
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ctm-cc__btn:hover {
	background: var(--ctm-cc-surface-2);
	border-color: #b4b7bd;
}

.ctm-cc__btn--primary {
	background: var(--ctm-cc-accent);
	border-color: var(--ctm-cc-accent);
	color: #fff;
}

.ctm-cc__btn--primary:hover {
	background: var(--ctm-cc-accent);
	border-color: var(--ctm-cc-accent);
	filter: brightness(0.92);
}

/* Sichtbarer Fokusring auf jedem Untergrund (WCAG 2.4.7 / 2.4.11). */
.ctm-cc :focus-visible,
.ctm-cc-badge:focus-visible {
	outline: 3px solid var(--ctm-cc-focus);
	outline-offset: 2px;
}

.ctm-cc__btn--primary:focus-visible {
	outline-color: var(--ctm-cc-focus);
	box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.9);
}

/* --- Details --------------------------------------------------------- */

.ctm-cc__detailsrow {
	margin: 0;
}

.ctm-cc__detailstoggle {
	appearance: none;
	background: none;
	border: 0;
	padding: 4px 0;
	font: inherit;
	color: var(--ctm-cc-accent);
	text-decoration: underline;
	cursor: pointer;
}

.ctm-cc__detailstoggle::after {
	content: "";
	display: inline-block;
	width: 0;
	height: 0;
	margin-left: 6px;
	vertical-align: middle;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
}

.ctm-cc__detailstoggle[aria-expanded="true"]::after {
	border-top: 0;
	border-bottom: 5px solid currentColor;
}

.ctm-cc__details {
	margin-top: 14px;
	border-top: 1px solid var(--ctm-cc-line);
	padding-top: 14px;
}

.ctm-cc__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	border-bottom: 1px solid var(--ctm-cc-line);
	margin-bottom: 14px;
}

.ctm-cc__tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 3px solid transparent;
	padding: 9px 14px;
	font: inherit;
	font-weight: 600;
	color: var(--ctm-cc-muted);
	cursor: pointer;
	margin-bottom: -1px;
}

.ctm-cc__tab:hover {
	color: var(--ctm-cc-ink);
}

.ctm-cc__tab[aria-selected="true"] {
	color: var(--ctm-cc-accent);
	border-bottom-color: var(--ctm-cc-accent);
}

.ctm-cc__panel {
	max-height: 40vh;
	overflow-y: auto;
}

.ctm-cc__panel:focus-visible {
	outline: 3px solid var(--ctm-cc-focus);
	outline-offset: -3px;
}

.ctm-cc__catlist {
	margin: 0;
}

.ctm-cc__catlist dt {
	font-weight: 700;
	margin-top: 12px;
}

.ctm-cc__catlist dt:first-child {
	margin-top: 0;
}

.ctm-cc__catlist dd {
	margin: 2px 0 0;
	color: var(--ctm-cc-muted);
}

/* --- Fusszeile ------------------------------------------------------- */

.ctm-cc__footer {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 20px;
	justify-content: space-between;
	align-items: center;
	padding: 12px 24px;
	background: var(--ctm-cc-surface-2);
	border-top: 1px solid var(--ctm-cc-line);
	font-size: 13px;
	color: var(--ctm-cc-muted);
}

.ctm-cc__footer p {
	margin: 0;
}

.ctm-cc__links a {
	color: var(--ctm-cc-accent);
	margin-right: 16px;
}

.ctm-cc__links a:last-child {
	margin-right: 0;
}

/* --- Tabellen (Banner und Cookie-Erklaerung) ------------------------- */

.ctm-cc-group {
	margin: 0 0 10px;
	border: 1px solid var(--ctm-cc-line);
	border-radius: var(--ctm-cc-radius);
}

.ctm-cc-group__summary {
	cursor: pointer;
	padding: 10px 12px;
	font-weight: 600;
	list-style: revert;
}

.ctm-cc-group__summary:focus-visible {
	outline: 3px solid var(--ctm-cc-focus);
	outline-offset: -3px;
}

.ctm-cc-group__title {
	margin: 0;
	padding: 10px 12px;
	font-size: 15px;
}

.ctm-cc-table-wrap {
	overflow-x: auto;
	padding: 0 12px 12px;
}

.ctm-cc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	text-align: left;
}

.ctm-cc-table__caption {
	caption-side: top;
	text-align: left;
	padding: 0 0 8px;
	color: var(--ctm-cc-muted);
	font-size: 13px;
}

.ctm-cc-table th,
.ctm-cc-table td {
	border-bottom: 1px solid var(--ctm-cc-line);
	padding: 7px 10px 7px 0;
	vertical-align: top;
}

.ctm-cc-table th {
	font-weight: 700;
	white-space: nowrap;
}

.ctm-cc-table code {
	font-size: 12px;
	word-break: break-all;
}

/* --- Badge ----------------------------------------------------------- */

/*
 * Das Badge zeigt im Ruhezustand nur das Symbol und waechst bei Hover oder
 * Tastaturfokus zur Pille mit Beschriftung. Der Text bleibt dabei immer im
 * Markup - er wird nur zusammengeschoben, nicht ausgeblendet -, damit
 * Screenreader ihn vorlesen. Auf Touch-Geraeten gibt es kein Hover, dort
 * bleibt das Symbol allein stehen; angetippt oeffnet es die Einstellungen.
 */
.ctm-cc-badge {
	position: fixed;
	left: var(--ctm-cc-badge-left);
	bottom: var(--ctm-cc-badge-bottom);
	z-index: 2147483000;
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 11px;
	border-radius: 999px;
	border: 1px solid var(--ctm-cc-line);
	background: var(--ctm-cc-surface);
	color: var(--ctm-cc-ink);
	font-weight: 600;
	box-shadow: 0 8px 24px -8px rgba(16, 19, 23, 0.45);
	cursor: pointer;
	transition: background-color 0.15s ease, padding 0.25s ease;
}

.ctm-cc-badge:hover,
.ctm-cc-badge:focus-visible {
	background: var(--ctm-cc-surface-2);
	padding: 9px 14px;
}

.ctm-cc-badge__icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--ctm-cc-accent);
}

.ctm-cc-badge__label {
	max-width: 0;
	margin-left: 0;
	overflow: hidden;
	white-space: nowrap;
	opacity: 0;
	/* Gleiche Zeilenhoehe wie das Symbol, damit der Ruhezustand exakt rund ist. */
	line-height: 20px;
	transition: max-width 0.25s ease, opacity 0.2s ease, margin-left 0.25s ease;
}

.ctm-cc-badge:hover .ctm-cc-badge__label,
.ctm-cc-badge:focus-visible .ctm-cc-badge__label {
	max-width: 16em;
	margin-left: 8px;
	opacity: 1;
}

/* --- Platzhalter fuer blockierte iframes ----------------------------- */

.ctm-cc-embed {
	position: relative;
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f0f1f3;
	border: 1px solid #d6d8dc;
	border-radius: 6px;
	padding: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1b1b1b;
}

.ctm-cc-embed[data-ctm-blocked="1"] > iframe {
	display: none;
}

.ctm-cc-embed:not([data-ctm-blocked="1"]) {
	display: block;
	min-height: 0;
	background: none;
	border: 0;
	padding: 0;
}

.ctm-cc-embed:not([data-ctm-blocked="1"]) .ctm-cc-embed__notice {
	display: none;
}

.ctm-cc-embed__notice {
	max-width: 46em;
	text-align: center;
}

.ctm-cc-embed__title {
	margin: 0 0 6px;
	font-weight: 700;
	font-size: 15px;
}

.ctm-cc-embed__text {
	margin: 0 0 12px;
	font-size: 14px;
	color: #4a4a4a;
}

.ctm-cc-embed__actions {
	margin: 0;
}

.ctm-cc-embed__btn {
	appearance: none;
	font: inherit;
	font-weight: 600;
	padding: 10px 16px;
	border-radius: 6px;
	border: 1px solid #101317;
	background: #101317;
	color: #fff;
	cursor: pointer;
}

.ctm-cc-embed__btn:hover {
	background: #000;
}

.ctm-cc-embed__btn:focus-visible {
	outline: 3px solid #101317;
	outline-offset: 3px;
}

/* --- Cookie-Erklaerung im Inhalt ------------------------------------- */

.ctm-cc-declaration {
	font-size: 15px;
}

.ctm-cc-declaration__state {
	font-weight: 600;
}

.ctm-cc-declaration__meta {
	color: #4a4a4a;
	font-size: 14px;
}

.ctm-cc-linkbutton {
	appearance: none;
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.ctm-cc-linkbutton:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

/* --- Responsiv -------------------------------------------------------- */

@media (max-width: 600px) {
	.ctm-cc {
		padding: 0;
	}

	.ctm-cc__dialog {
		max-height: 92vh;
		overflow-y: auto;
		border-radius: var(--ctm-cc-radius) var(--ctm-cc-radius) 0 0;
	}

	.ctm-cc--center .ctm-cc__dialog {
		border-radius: var(--ctm-cc-radius);
	}

	.ctm-cc__main {
		padding: 18px 16px 14px;
	}

	.ctm-cc__actions {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.ctm-cc__btn {
		width: 100%;
	}

	.ctm-cc__footer {
		padding: 12px 16px;
	}

	/* Ohne Hover-Faehigkeit bleibt es beim Symbol - der Text ist zusammen-
	   geschoben, aber weiterhin im Markup und fuer Screenreader lesbar. */
	.ctm-cc-badge {
		padding: 12px;
	}
}

/* --- Bewegung reduzieren --------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.ctm-cc,
	.ctm-cc *,
	.ctm-cc-badge,
	.ctm-cc-badge * {
		transition: none !important;
		animation: none !important;
	}
}

/* --- Dunkles Farbschema (optional) ----------------------------------- */

@media (prefers-color-scheme: dark) {
	.ctm-cc,
	.ctm-cc-badge {
		--ctm-cc-ink: #f2f3f5;
		--ctm-cc-muted: #c2c6cc;
		--ctm-cc-line: #3a3f46;
		--ctm-cc-surface: #1c1f24;
		--ctm-cc-surface-2: #24282e;
		--ctm-cc-focus: #ffffff;
	}

	.ctm-cc__message a,
	.ctm-cc__links a,
	.ctm-cc__tab[aria-selected="true"],
	.ctm-cc__detailstoggle {
		/* Der dunkle Akzent aus den Einstellungen waere auf dunklem Grund zu
		   kontrastarm - hier auf eine helle Variante ausweichen. */
		color: #9ec2ff;
	}

	.ctm-cc__tab[aria-selected="true"] {
		border-bottom-color: #9ec2ff;
	}

	.ctm-cc__btn--primary:focus-visible {
		box-shadow: 0 0 0 6px rgba(16, 19, 23, 0.9);
	}
}
