/*
 * Cargento Cookie Consent – Frontend-Styles
 * Farben, Schriftgröße und Radius kommen als CSS-Variablen aus den Plugin-Einstellungen.
 */

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

.cgc-root {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: var(--cgc-font-size, 15px);
	line-height: 1.5;
	color: var(--cgc-text, #1f2937);
	-webkit-text-size-adjust: 100%;
}

.cgc-root [hidden] {
	display: none !important;
}

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

html.cgc-lock {
	overflow: hidden;
}

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

.cgc-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2147483000;
	padding: 16px;
	pointer-events: none;
}

.cgc-card {
	pointer-events: auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 16px 28px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 20px 24px;
	background: var(--cgc-bg, #fff);
	color: var(--cgc-text, #1f2937);
	border: 1px solid rgba(128, 128, 128, 0.35);
	border-radius: var(--cgc-radius, 12px);
	box-shadow: 0 14px 44px rgba(15, 23, 42, 0.24), 0 2px 8px rgba(15, 23, 42, 0.12);
}

.cgc-card__body {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	min-width: 0;
}

.cgc-card__text {
	min-width: 0;
}

.cgc-logo {
	display: block;
	flex: none;
	width: auto;
	height: auto;
	max-width: 120px;
	max-height: 40px;
}

.cgc-title {
	margin: 0 0 4px;
	padding: 0;
	font-size: 1.15em;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	letter-spacing: 0;
	text-transform: none;
}

.cgc-desc,
.cgc-panel__intro,
.cgc-cat__desc {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: 1em;
}

.cgc-root .cgc-link {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- Buttons (alle gleichwertig gestaltet) ---------- */

.cgc-actions {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(150px, 1fr);
	gap: 10px;
}

.cgc-root .cgc-btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	min-height: 44px;
	padding: 10px 20px;
	border: 2px solid var(--cgc-btn, #0f3d66);
	border-radius: calc(var(--cgc-radius, 12px) * 0.66);
	background: var(--cgc-btn, #0f3d66);
	color: var(--cgc-btn-text, #fff);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	white-space: normal;
	cursor: pointer;
	box-shadow: none;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cgc-root .cgc-btn:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
	transform: translateY(-1px);
}

.cgc-root a:focus-visible,
.cgc-root button:focus-visible,
.cgc-root .cgc-panel:focus-visible {
	outline: 3px solid var(--cgc-text, #111);
	outline-offset: 3px;
	box-shadow: 0 0 0 3px var(--cgc-bg, #fff);
}

.cgc-root .cgc-panel:focus {
	outline: none;
}

/* ---------- Positionen ---------- */

.cgc-pos-bottom-left .cgc-card,
.cgc-pos-bottom-right .cgc-card {
	grid-template-columns: minmax(0, 1fr);
	max-width: 440px;
}

.cgc-pos-bottom-left .cgc-card {
	margin-left: 0;
	margin-right: auto;
}

.cgc-pos-bottom-right .cgc-card {
	margin-left: auto;
	margin-right: 0;
}

.cgc-pos-bottom-left .cgc-actions,
.cgc-pos-bottom-right .cgc-actions {
	grid-auto-flow: row;
	grid-auto-columns: 1fr;
}

/* ---------- Einstellungsfenster ---------- */

.cgc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(15, 23, 42, 0.6);
}

.cgc-panel {
	display: flex;
	flex-direction: column;
	width: min(640px, 100%);
	max-height: min(90vh, 780px);
	max-height: min(90dvh, 780px);
	overflow: hidden;
	background: var(--cgc-bg, #fff);
	color: var(--cgc-text, #1f2937);
	border-radius: var(--cgc-radius, 12px);
	box-shadow: 0 24px 70px rgba(15, 23, 42, 0.45);
}

.cgc-panel__head {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 18px 20px 14px 24px;
	border-bottom: 1px solid rgba(128, 128, 128, 0.35);
}

.cgc-panel__title {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	font-size: 1.25em;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	letter-spacing: 0;
	text-transform: none;
}

.cgc-root .cgc-close {
	-webkit-appearance: none;
	appearance: none;
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(128, 128, 128, 0.55);
	border-radius: calc(var(--cgc-radius, 12px) * 0.66);
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 1.6em;
	line-height: 1;
	cursor: pointer;
}

.cgc-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px 24px;
	-webkit-overflow-scrolling: touch;
}

.cgc-panel__intro {
	margin-bottom: 8px;
}

.cgc-panel__legal {
	margin: 14px 0 0;
}

.cgc-cat {
	padding: 14px 0;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.cgc-cat:last-of-type {
	border-bottom: 0;
}

.cgc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 6px;
}

.cgc-cat__label {
	font-weight: 700;
	font-size: 1.05em;
	color: inherit;
}

.cgc-panel__foot {
	padding: 16px 24px 20px;
	border-top: 1px solid rgba(128, 128, 128, 0.35);
}

/* ---------- Schalter ---------- */

.cgc-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex: none;
	gap: 10px;
}

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

.cgc-switch.is-required input {
	cursor: not-allowed;
}

.cgc-switch__track {
	position: relative;
	flex: none;
	width: 48px;
	height: 28px;
	border-radius: 999px;
	background: #6b7280;
	transition: background-color 0.15s ease;
}

.cgc-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.15s ease, background-color 0.15s ease;
}

.cgc-switch input:checked + .cgc-switch__track {
	background: var(--cgc-btn, #0f3d66);
}

.cgc-switch input:checked + .cgc-switch__track::after {
	transform: translateX(20px);
	background: var(--cgc-btn-text, #fff);
}

.cgc-switch input:disabled + .cgc-switch__track {
	opacity: 0.7;
}

.cgc-switch input:focus-visible + .cgc-switch__track {
	outline: 3px solid var(--cgc-text, #111);
	outline-offset: 3px;
}

.cgc-switch__state {
	min-width: 5.5em;
	font-size: 0.9em;
	font-weight: 600;
	text-align: right;
}

/* ---------- Platzhalter für externe Medien ---------- */

.cargento-embed {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	min-height: 180px;
	margin: 0 0 1em;
	overflow: hidden;
	background: var(--cgc-bg, #f3f4f6);
	color: var(--cgc-text, #1f2937);
	border: 1px solid rgba(128, 128, 128, 0.4);
	border-radius: var(--cgc-radius, 12px);
	box-sizing: border-box;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: var(--cgc-font-size, 15px);
	line-height: 1.5;
}

.cargento-embed__placeholder {
	box-sizing: border-box;
	max-width: 520px;
	padding: 20px;
	text-align: center;
}

.cargento-embed__text {
	margin: 0 0 14px;
	color: inherit;
}

.cargento-embed .cargento-embed__button {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	min-height: 44px;
	padding: 10px 20px;
	border: 2px solid var(--cgc-btn, #0f3d66);
	border-radius: calc(var(--cgc-radius, 12px) * 0.66);
	background: var(--cgc-btn, #0f3d66);
	color: var(--cgc-btn-text, #fff);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	box-shadow: none;
}

.cargento-embed .cargento-embed__button:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.cargento-embed .cargento-embed__button:focus-visible {
	outline: 3px solid var(--cgc-text, #111);
	outline-offset: 3px;
}

/* ---------- Mobil ---------- */

@media (max-width: 760px) {
	.cgc-banner {
		padding: 8px;
	}

	.cgc-card {
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
		padding: 14px;
		overflow-y: auto;
	}

	.cgc-title {
		font-size: 1.05em;
	}

	.cgc-desc {
		font-size: 0.93em;
		line-height: 1.45;
	}

	.cgc-actions {
		gap: 8px;
	}

	.cgc-root .cgc-btn {
		padding: 8px 14px;
	}

	.cgc-pos-bottom-left .cgc-card,
	.cgc-pos-bottom-right .cgc-card {
		max-width: none;
	}

	.cgc-actions {
		grid-auto-flow: row;
		grid-auto-columns: 1fr;
	}

	.cgc-modal {
		align-items: flex-end;
		padding: 8px;
	}

	.cgc-panel {
		max-height: calc(100vh - 16px);
		max-height: calc(100dvh - 16px);
	}

	.cgc-panel__head {
		padding: 14px 14px 12px 16px;
	}

	.cgc-panel__body {
		padding: 14px 16px;
	}

	.cgc-panel__foot {
		padding: 12px 16px 16px;
	}

	.cgc-switch__state {
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cgc-root .cgc-btn,
	.cgc-switch__track,
	.cgc-switch__track::after {
		transition: none;
	}

	.cgc-root .cgc-btn:hover {
		transform: none;
	}
}

@media (forced-colors: active) {
	.cgc-card,
	.cgc-panel,
	.cargento-embed {
		border: 2px solid CanvasText;
	}

	.cgc-root .cgc-btn,
	.cargento-embed .cargento-embed__button {
		border: 2px solid ButtonText;
	}

	.cgc-switch__track {
		border: 2px solid ButtonText;
	}
}
