/*
 * Anadolu Core: Cookie-Hinweis "Privatsphäre-Einstellungen".
 * Aufbau nach docs/design/cookieBanner.png, Farben und Schriften aus tokens.css.
 * Alle drei Buttons sind gleich gewichtet (Ablehnen so leicht wie Akzeptieren).
 */

.an-consent {
	position: fixed;
	left: var(--an-space-4);
	right: var(--an-space-4);
	bottom: var(--an-space-4);
	z-index: 200;
	display: grid;
	gap: var(--an-space-4);
	max-width: 1344px;
	max-height: calc(100dvh - 2 * var(--an-space-4));
	margin-inline: auto;
	padding: var(--an-space-6) 36px 28px;
	overflow-y: auto;
	overscroll-behavior: contain;
	font-family: var(--an-font-sans);
	background-color: var(--an-bg-surface);
	border: 1px solid var(--an-border);
	border-radius: var(--an-radius-lg);
	box-shadow: 0 24px 64px -24px rgb(9 39 42 / 0.45);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity var(--an-dur) var(--an-ease), transform var(--an-dur) var(--an-ease);
}

.an-consent[hidden] {
	display: none;
}

.an-consent.is-visible {
	opacity: 1;
	transform: none;
}

.an-consent-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--an-space-4);
}

.an-consent .an-consent-title {
	margin: 0;
	font-family: var(--an-font-serif);
	font-size: 24px;
	font-weight: 400;
	line-height: 1.3;
	color: var(--an-green-800);
}

.an-consent-title:focus {
	outline: none;
}

.an-consent .an-consent-text {
	max-width: 100ch;
	margin: 0;
	font-size: 16px;
	line-height: 1.6;
	color: var(--an-text-muted);
}

/* ---------- Schalter ---------- */
.an-consent-switches {
	display: flex;
	flex-wrap: wrap;
	gap: var(--an-space-2) var(--an-space-6);
}

.an-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0;
	font-size: 15px;
	font-weight: 500;
	color: var(--an-green-800);
	cursor: pointer;
}

/* Beschriftung vor dem Schalter wie im Entwurf */
.an-switch-label {
	order: -1;
}

.an-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.an-switch-track {
	position: relative;
	flex: 0 0 auto;
	width: 48px;
	height: 28px;
	background-color: var(--an-grey-600);
	border-radius: var(--an-radius-pill);
	transition: background-color var(--an-dur-fast) var(--an-ease);
}

.an-switch-track::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	background-color: var(--an-white);
	border-radius: 50%;
	transition: transform var(--an-dur-fast) var(--an-ease);
}

.an-switch-track svg {
	position: absolute;
	top: 8px;
	width: 12px;
	height: 12px;
	fill: none;
	stroke: var(--an-white);
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: opacity var(--an-dur-fast) var(--an-ease);
}

.an-switch-on {
	left: 8px;
	opacity: 0;
}

.an-switch-off {
	right: 8px;
}

.an-switch input:checked + .an-switch-track {
	background-color: var(--an-teal-600);
}

.an-switch input:checked + .an-switch-track::before {
	transform: translateX(20px);
}

.an-switch input:checked + .an-switch-track .an-switch-on {
	opacity: 1;
}

.an-switch input:checked + .an-switch-track .an-switch-off {
	opacity: 0;
}

.an-switch input:focus-visible + .an-switch-track {
	outline: 2px solid var(--an-focus);
	outline-offset: 3px;
}

.an-switch:has(input:disabled) {
	cursor: default;
}

/* ---------- Mehr Informationen ---------- */
.an-consent-details {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: var(--an-space-2) var(--an-space-5);
	margin: 0;
	padding: var(--an-space-4) var(--an-space-5);
	font-size: 15px;
	line-height: 1.55;
	background-color: var(--an-cream-50);
	border-radius: var(--an-radius-sm);
}

.an-consent-details[hidden] {
	display: none;
}

.an-consent-details dt {
	font-weight: 600;
	color: var(--an-green-800);
}

.an-consent-details dd {
	margin: 0;
	color: var(--an-text-muted);
}

/* ---------- Links und Buttons ---------- */
.an-consent-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--an-space-3) var(--an-space-6);
	margin-top: var(--an-space-2);
}

.an-consent-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--an-space-5);
	margin: 0;
	padding: 0;
	list-style: none;
}

.an-consent-links a,
.an-consent button.an-consent-more {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: 0;
	padding: 0;
	font-family: var(--an-font-sans);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	color: var(--an-link);
	background: none;
	border: 0;
	border-radius: 0;
	text-decoration: none;
	cursor: pointer;
}

.an-consent-links a:hover,
.an-consent button.an-consent-more:hover,
.an-consent button.an-consent-more:focus {
	color: var(--an-green-800);
	background: none;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.an-consent-actions {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	flex: 1 1 600px;
	gap: var(--an-space-3);
	max-width: 780px;
}

.an-consent .an-consent-actions button {
	min-height: 52px;
	margin: 0;
	padding: 0 var(--an-space-5);
	font-family: var(--an-font-sans);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	color: var(--an-white);
	background-color: var(--an-green-800);
	border: 1px solid var(--an-green-800);
	border-radius: var(--an-radius-pill);
	cursor: pointer;
	transition: background-color var(--an-dur-fast) var(--an-ease), transform var(--an-dur-fast) var(--an-ease);
}

.an-consent .an-consent-actions button:hover,
.an-consent .an-consent-actions button:focus-visible {
	color: var(--an-white);
	background-color: var(--an-green-850);
	border-color: var(--an-green-850);
}

.an-consent .an-consent-actions button:active {
	transform: scale(0.98);
}

@media (max-width: 1024px) {
	.an-consent-actions {
		max-width: none;
	}
}

@media (max-width: 767px) {
	.an-consent {
		left: var(--an-space-2);
		right: var(--an-space-2);
		bottom: var(--an-space-2);
		gap: var(--an-space-3);
		max-height: calc(100dvh - 2 * var(--an-space-2));
		padding: var(--an-space-5) var(--an-space-5) var(--an-space-4);
		border-radius: var(--an-radius-md);
	}

	.an-consent .an-consent-title {
		font-size: 20px;
	}

	.an-consent .an-consent-text {
		font-size: 15px;
		line-height: 1.55;
	}

	.an-consent-details {
		grid-template-columns: minmax(0, 1fr);
		padding: var(--an-space-3) var(--an-space-4);
	}

	.an-consent-details dd + dt {
		margin-top: var(--an-space-2);
	}

	.an-consent-foot {
		margin-top: 0;
	}

	.an-consent-actions {
		grid-template-columns: minmax(0, 1fr);
		flex-basis: 100%;
		gap: var(--an-space-2);
	}

	.an-consent .an-consent-actions button {
		min-height: 48px;
	}
}

@media print {
	.an-consent {
		display: none !important;
	}
}
