/**
 * Cookie-Hinweis.
 *
 * Der Hinweis wird von der Middleware direkt vor `</body>` eingehaengt und
 * haengt damit ausserhalb von `.br-page-layout-wrapper`. Die Mandanten-Farben
 * stehen aber genau auf diesem Wrapper. `br-app.js` uebertraegt deshalb die
 * fuer die Bedienung relevanten Systemfarben auf den Dialog; die neutralen
 * Werte hier bleiben lediglich als robuste Fallbacks erhalten.
 *
 * Das passt auch rechtlich: Zustimmung und Ablehnung muessen gleich leicht
 * erreichbar sein. Beide Einwilligungs-Knoepfe sind darum identisch gross,
 * gleich gefaerbt und gleich gewichtet; nur "Cookies einstellen" tritt als
 * dritte, ruhige Option zurueck.
 *
 * Diese Datei wird nach `app.css` geladen (siehe layout/app.blade.php) und
 * gewinnt deshalb bei gleicher Spezifitaet.
 */

.lcc-modal,
.lcc-modal * {
	box-sizing: border-box;
}

/* =========================================================
 * Ueberlagerung
 * ========================================================= */
.lcc-backdrop {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 10000;
	background: rgba(15, 15, 20, .55);
	/* Das Skript blendet die Ueberlagerung ueber `transitionend` aus
	 * (util/modals.js). Ohne diese Transition bliebe sie als unsichtbarer
	 * Klickfaenger ueber der Seite stehen. */
	transition: opacity .2s ease-in-out;
}

/* =========================================================
 * Dialog
 * ========================================================= */
.lcc-modal {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 10001;
	display: flex;
	flex-direction: column;
	width: 560px;
	max-width: calc(100% - 2rem);
	max-height: calc(100vh - 3rem);
	padding: 0;
	overflow: hidden;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
	color: #1d1d1b;
	font-size: 14px;
	line-height: 1.55;
	text-align: left;
}

.lcc-modal.lcc-modal--settings {
	width: 620px;
	z-index: 10002;
}

/* Der Dialog selbst erhaelt beim Oeffnen kurz den programmatischen Fokus,
 * damit Screenreader Titel und Beschreibung ansagen. Die sichtbare
 * Fokusmarkierung beginnt am ersten interaktiven Element. */
.lcc-modal:focus {
	outline: none;
}

.lcc-modal__content {
	padding: 1.75rem 1.75rem 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.lcc-modal__content h2 {
	margin: 0 0 .625rem;
	font-size: 1.1875rem;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: #1d1d1b;
}

.lcc-modal__content p {
	margin: 0 0 .625rem;
	font-size: .875rem;
	line-height: 1.6;
	color: #4b4b49;
}

.lcc-modal__content p:last-child {
	margin-bottom: 0;
}

.lcc-modal__content a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Schliessen-Kreuz mit ausreichend grosser Trefferflaeche. */
.lcc-modal .lcc-modal__close {
	position: absolute;
	right: .75rem;
	top: .75rem;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #1d1d1b;
	font-size: 1.375rem;
	line-height: 1;
	cursor: pointer;
	opacity: .55;
	transition: background-color .15s ease, opacity .15s ease;
}

.lcc-modal .lcc-modal__close:hover,
.lcc-modal .lcc-modal__close:focus-visible {
	background: rgba(0, 0, 0, .06);
	opacity: 1;
}

/* =========================================================
 * Auswahl der Cookie-Arten
 * ========================================================= */
.lcc-modal .lcc-modal__section {
	margin: 0 0 .625rem;
	padding: .875rem 1rem;
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 12px;
}

.lcc-modal .lcc-modal__section:last-child {
	margin-bottom: 0;
}

.lcc-modal .lcc-modal__section label {
	display: flex;
	align-items: center;
	gap: .625rem;
	margin: 0;
	font-size: .9375rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
}

.lcc-modal .lcc-modal__section input[type="checkbox"] {
	flex: none;
	width: 1.0625rem;
	height: 1.0625rem;
	margin: 0;
	accent-color: var(--primary, #1d1d1b);
	cursor: pointer;
}

.lcc-modal .lcc-modal__section input[type="checkbox"]:disabled {
	cursor: default;
	opacity: .55;
}

.lcc-modal .lcc-modal__section input[type="checkbox"]:disabled + span {
	cursor: default;
}

/* "Immer aktiv" — Hinweis am gesperrten Schalter. */
.lcc-modal .lcc-lock {
	margin-left: auto;
	padding: .125rem .5rem;
	border-radius: 999px;
	background: rgba(0, 0, 0, .06);
	font-size: .6875rem;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: none;
	white-space: nowrap;
	color: #4b4b49;
}

.lcc-modal .lcc-modal__section .lcc-text {
	margin: .375rem 0 0 1.6875rem;
	font-size: .8125rem;
	line-height: 1.55;
	color: #6b6b69;
}

/* =========================================================
 * Knoepfe
 * ========================================================= */
.lcc-modal__actions {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	align-items: center;
	padding: 1.25rem 1.75rem 0;
}

.lcc-modal .lcc-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.5rem;
	padding: .5rem 1.125rem;
	border: 1px solid transparent;
	border-radius: 10px;
	background: transparent;
	font-family: inherit;
	font-size: .875rem;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-transform: none;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.lcc-modal .lcc-button:focus-visible {
	outline: 2px solid var(--primary, #1d1d1b);
	outline-offset: 2px;
}

/* Beide Einwilligungs-Knoepfe teilen sich diese Rolle und sehen deshalb
 * gleich aus — annehmen und ablehnen kosten denselben Klick. */
.lcc-modal .lcc-button--consent {
	flex: 1 1 0;
	background-color: var(--interface-main-button, #1d1d1b);
	border-color: var(--interface-main-button, #1d1d1b);
	color: var(--interface-main-button-inverse, #fff);
}

.lcc-modal .lcc-button--consent:hover,
.lcc-modal .lcc-button--consent:focus-visible {
	background-color: var(--interface-main-button-dark, #3a3a37);
	border-color: var(--interface-main-button-dark, #3a3a37);
}

.lcc-modal__actions--secondary {
	padding-top: .5rem;
}

/* Im Einstellungs-Dialog scrollt die Liste der Cookie-Arten unter die
 * Knopfleiste. Die Haarlinie zeigt, wo der feste Teil anfaengt. */
.lcc-modal--settings .lcc-modal__actions {
	margin-top: 1.25rem;
	padding-top: 1rem;
	border-top: 1px solid rgba(0, 0, 0, .08);
}

/* Dritte, ruhige Option: Auswahl verfeinern oder abbrechen. */
.lcc-modal .lcc-button--quiet {
	flex: none;
	border-color: var(--interface-main-button, #1d1d1b);
	color: var(--interface-main-button, #1d1d1b);
}

.lcc-modal .lcc-button--quiet:hover,
.lcc-modal .lcc-button--quiet:focus-visible {
	background-color: color-mix(
		in srgb,
		var(--interface-main-button, #1d1d1b) 8%,
		transparent
	);
	border-color: var(--interface-main-button-dark, #1d1d1b);
	color: var(--interface-main-button-dark, #1d1d1b);
}

.lcc-modal .lcc-button--wide {
	flex: 1 1 100%;
}

/* =========================================================
 * Fusszeile
 * ========================================================= */
.lcc-modal__links {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin-top: 1.25rem;
	padding: .875rem 1.75rem 1.25rem;
	border-top: 1px solid rgba(0, 0, 0, .08);
	font-size: .8125rem;
}

.lcc-modal__links a {
	padding: 0;
	color: #4b4b49;
	text-decoration: none;
}

.lcc-modal__links a:hover,
.lcc-modal__links a:focus-visible {
	color: #1d1d1b;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Erneutes Oeffnen aus der Fusszeile: echte Button-Semantik, optisch aber
 * in jedem Zustand identisch zu den Copyright-Links. Der Copyright-Scope
 * erhoeht die Spezifitaet gegen die allgemeinen Theme-Button-Regeln. */
.bg-copyright button.br-cookie-settings-trigger {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--copyright-link, inherit);
	font: inherit;
	line-height: inherit;
	vertical-align: baseline;
	appearance: none;
	cursor: pointer;
}

.bg-copyright button.br-cookie-settings-trigger:hover {
	background-color: var(--copyright-link, transparent);
	color: var(--copyright, inherit);
}

.bg-copyright button.br-cookie-settings-trigger:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* =========================================================
 * Nur fuer Screenreader
 * ========================================================= */
.lcc-u-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

/* =========================================================
 * Mobil: Der Dialog sitzt als Blatt am unteren Rand, die Knoepfe
 * stehen untereinander und sind mit dem Daumen erreichbar.
 * ========================================================= */
@media (max-width: 40rem) {
	.lcc-modal,
	.lcc-modal.lcc-modal--settings {
		left: 0;
		right: 0;
		top: auto;
		bottom: 0;
		transform: none;
		width: 100%;
		max-width: 100%;
		max-height: 90vh;
		border-radius: 18px 18px 0 0;
	}

	.lcc-modal__content {
		padding: 1.5rem 1.25rem 0;
	}

	.lcc-modal__actions {
		flex-direction: column;
		align-items: stretch;
		padding: 1.125rem 1.25rem 0;
	}

	.lcc-modal .lcc-button {
		width: 100%;
	}

	.lcc-modal__links {
		gap: 1rem;
		padding: .875rem 1.25rem 1.125rem;
		padding-bottom: calc(1.125rem + env(safe-area-inset-bottom, 0px));
	}
}

@media (prefers-reduced-motion: reduce) {
	/* Die Ueberlagerung bleibt bewusst aussen vor, ihr `transitionend`
	 * blendet sie ueberhaupt erst wieder aus. */
	.lcc-modal * {
		transition: none !important;
	}
}
