/* =============================================================
   QTA – global.css
   Allgemeine Gestaltung, Layout, Light-/Darkmode
   ============================================================= */

/* -------------------------------------------------------------
   Farb-/Abstandsvariablen (Lightmode = Standard)
   ------------------------------------------------------------- */
:root {
	--qta-bg: #f6f7fb;
	--qta-bg-erhoben: #ffffff;
	--qta-text: #1c1e26;
	--qta-text-schwach: #5c6070;
	--qta-rand: #e2e4ec;
	--qta-primary: #3859d6;
	--qta-primary-text: #ffffff;
	--qta-akzent-bg: #eef1fc;
	--qta-schatten: 0 2px 10px rgba(20, 22, 40, 0.06);

	--qta-radius: 16px;
	--qta-radius-klein: 10px;
	--qta-abstand-s: 8px;
	--qta-abstand-m: 16px;
	--qta-abstand-l: 24px;

	--qta-header-hoehe: 56px;
	--qta-bottomnav-hoehe: 64px;

	/* Maximale Breite des Seiteninhalts (Header, Main, Footer gemeinsam).
	   Seitenrand = normaler Innenabstand, bei breiterem Viewport um den
	   Überstand über --qta-seitenbreite (je Seite die Hälfte) vergrößert:
	   Header/Footer behalten so Hintergrund und Trennlinie über die volle
	   Browserbreite, ihr Inhalt fluchtet aber mit dem zentrierten Main.
	   Das % bezieht sich beim Verwenden auf die Breite des Elternelements
	   (body). */
	--qta-seitenbreite: 1200px;
	--qta-seitenrand: max(var(--qta-abstand-m), calc((100% - var(--qta-seitenbreite)) / 2 + var(--qta-abstand-m)));
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--qta-bg: #14151c;
		--qta-bg-erhoben: #1d1f29;
		--qta-text: #eceef5;
		--qta-text-schwach: #a3a7b8;
		--qta-rand: #2c2f3d;
		--qta-primary: #6d84ea;
		--qta-primary-text: #10121a;
		--qta-akzent-bg: #202440;
		--qta-schatten: 0 2px 10px rgba(0, 0, 0, 0.35);
	}
}

:root[data-theme="dark"] {
	--qta-bg: #14151c;
	--qta-bg-erhoben: #1d1f29;
	--qta-text: #eceef5;
	--qta-text-schwach: #a3a7b8;
	--qta-rand: #2c2f3d;
	--qta-primary: #6d84ea;
	--qta-primary-text: #10121a;
	--qta-akzent-bg: #202440;
	--qta-schatten: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* -------------------------------------------------------------
   Reset / Grundlagen
   ------------------------------------------------------------- */
* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--qta-bg);
	color: var(--qta-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	line-height: 1.5;
	overflow-x: hidden;
	padding-bottom: calc(var(--qta-bottomnav-hoehe) + var(--qta-abstand-m));
}

h1, h2, h3 {
	line-height: 1.25;
	margin: 0 0 var(--qta-abstand-s);
}

p {
	margin: 0 0 var(--qta-abstand-m);
	color: var(--qta-text-schwach);
}

a {
	color: inherit;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* -------------------------------------------------------------
   Hauptinhalt: zentriert, höchstens --qta-seitenbreite breit
   ------------------------------------------------------------- */
#inhalt {
	max-width: var(--qta-seitenbreite);
	margin: 0 auto;
}

/* -------------------------------------------------------------
   Header
   ------------------------------------------------------------- */
#kopf {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--qta-abstand-m);
	height: var(--qta-header-hoehe);
	padding: 0 var(--qta-seitenrand);
	background: var(--qta-bg-erhoben);
	border-bottom: 1px solid var(--qta-rand);
}

#kopf-marke {
	font-weight: 700;
	font-size: 1.05rem;
	text-decoration: none;
	color: var(--qta-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#nav-desktop {
	display: none;
}

#theme-toggle {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--qta-rand);
	background: var(--qta-bg);
	color: var(--qta-text);
	font-size: 1.1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* -------------------------------------------------------------
   Buttons / Kacheln (allgemein)
   ------------------------------------------------------------- */
.btn-sec {
	display: inline-block;
	padding: 10px 18px;
	border-radius: var(--qta-radius-klein);
	border: 1px solid var(--qta-rand);
	background: var(--qta-bg-erhoben);
	color: var(--qta-text);
	text-decoration: none;
	font-size: 0.95rem;
	cursor: pointer;
}

.btn-cta {
	background: var(--qta-primary);
	color: var(--qta-primary-text);
	padding: 8px 16px;
	border-radius: var(--qta-radius-klein);
	text-decoration: none;
	font-weight: 600;
}

.kachel {
	display: block;
	width: 100%;
	text-align: left;
	padding: var(--qta-abstand-l);
	border-radius: var(--qta-radius);
	background: var(--qta-bg-erhoben);
	border: 1px solid var(--qta-rand);
	box-shadow: var(--qta-schatten);
	text-decoration: none;
	color: var(--qta-text);
	font: inherit;
	cursor: pointer;
}

.kachel-titel {
	display: block;
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 4px;
}

.kachel-text {
	display: block;
	color: var(--qta-text-schwach);
	font-size: 0.92rem;
}

.kachel-primaer {
	background: var(--qta-primary);
	border-color: var(--qta-primary);
	color: var(--qta-primary-text);
}

.kachel-primaer .kachel-text {
	color: var(--qta-primary-text);
	opacity: 0.85;
}

/* -------------------------------------------------------------
   Platzhalterseiten
   ------------------------------------------------------------- */
.platzhalter-seite {
	max-width: 640px;
	margin: 0 auto;
	padding: var(--qta-abstand-l) var(--qta-abstand-m);
}

/* -------------------------------------------------------------
   Platzhalter-Hinweis (Toast)
   ------------------------------------------------------------- */
#qta-hinweis {
	position: fixed;
	left: 50%;
	bottom: calc(var(--qta-bottomnav-hoehe) + var(--qta-abstand-m));
	transform: translate(-50%, 12px);
	background: var(--qta-text);
	color: var(--qta-bg);
	padding: 10px 18px;
	border-radius: var(--qta-radius-klein);
	font-size: 0.9rem;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	z-index: 60;
	max-width: calc(100% - 2 * var(--qta-abstand-m));
	text-align: center;
}

#qta-hinweis.sichtbar {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* -------------------------------------------------------------
   Footer
   ------------------------------------------------------------- */
#fuss {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--qta-abstand-m);
	padding: var(--qta-abstand-l) var(--qta-seitenrand);
	border-top: 1px solid var(--qta-rand);
	color: var(--qta-text-schwach);
	font-size: 0.9rem;
}

/* Ohne DevMode-Ausgabe (index.php setzt die Klasse nur bei
   DEV_MODE=false): Footer-Einträge zentriert */
#fuss.fuss-zentriert,
#fuss.fuss-zentriert nav {
	justify-content: center;
}

#fuss nav {
	display: flex;
	gap: var(--qta-abstand-m);
	flex-wrap: wrap;
}

#fuss nav a {
	text-decoration: none;
	color: var(--qta-text-schwach);
}

.qta-version {
	margin-left: auto;
	font-size: 0.78rem;
	opacity: 0.7;
}

/* -------------------------------------------------------------
   Smartphone: untere Navigation
   ------------------------------------------------------------- */
#nav-bottom {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 30;
	display: flex;
	height: var(--qta-bottomnav-hoehe);
	background: var(--qta-bg-erhoben);
	border-top: 1px solid var(--qta-rand);
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-bottom-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	border: none;
	background: none;
	color: var(--qta-text-schwach);
	font: inherit;
	font-size: 0.72rem;
	cursor: pointer;
	text-decoration: none;
}

.nav-bottom-icon {
	font-size: 1.25rem;
}

/* -------------------------------------------------------------
   Smartphone: Bottom-Sheet
   ------------------------------------------------------------- */
#bottom-sheet-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 11, 20, 0.45);
	z-index: 40;
}

#bottom-sheet {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 50;
	background: var(--qta-bg-erhoben);
	border-top-left-radius: var(--qta-radius);
	border-top-right-radius: var(--qta-radius);
	padding: var(--qta-abstand-s) var(--qta-abstand-m) calc(var(--qta-abstand-l) + env(safe-area-inset-bottom, 0));
	max-height: 80vh;
	overflow-y: auto;
	transform: translateY(100%);
	transition: transform 0.2s ease;
}

#bottom-sheet:not([hidden]) {
	transform: translateY(0);
}

#bottom-sheet-griff {
	width: 40px;
	height: 4px;
	border-radius: 2px;
	background: var(--qta-rand);
	margin: var(--qta-abstand-s) auto var(--qta-abstand-m);
}

#bottom-sheet nav {
	display: flex;
	flex-direction: column;
}

#bottom-sheet nav a {
	padding: 14px 4px;
	text-decoration: none;
	color: var(--qta-text);
	border-bottom: 1px solid var(--qta-rand);
}

#bottom-sheet nav a:last-child {
	border-bottom: none;
}

#bottom-sheet #btn-sheet-schliessen {
	width: 100%;
	margin-top: var(--qta-abstand-m);
	text-align: center;
}

/* -------------------------------------------------------------
   Desktop
   ------------------------------------------------------------- */
@media (min-width: 900px) {
	body {
		padding-bottom: 0;
	}

	#nav-desktop {
		display: flex;
		align-items: center;
		gap: var(--qta-abstand-l);
	}

	#nav-desktop a:not(.btn-cta) {
		text-decoration: none;
		color: var(--qta-text);
		font-size: 0.95rem;
	}

	#nav-bottom,
	#bottom-sheet-overlay,
	#bottom-sheet {
		display: none;
	}
}

/* -------------------------------------------------------------
   Gastschutz: Warte-/Captcha-Overlay
   Global, siehe index.php - wird von mehreren Seiten ausgelöst
   (js/global.js: qtaGastZugangStarten()). Bewusst als zentrierter
   Dialog (nicht als mobiles Bottom-Sheet) - funktioniert dadurch
   unverändert auf Smartphone, Tablet und Desktop, ohne zwei
   getrennte Layouts pflegen zu müssen.
   ------------------------------------------------------------- */
#gast-schutz-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 11, 20, 0.45);
	z-index: 70;
}

#gast-schutz-sheet {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	z-index: 80;
	width: min(92vw, 380px);
	max-height: 85vh;
	overflow-y: auto;
	background: var(--qta-bg-erhoben);
	border-radius: var(--qta-radius);
	box-shadow: var(--qta-schatten);
	padding: var(--qta-abstand-l) var(--qta-abstand-m);
	text-align: center;
}

#gast-schutz-titel {
	font-size: 1.1rem;
}

#gast-schutz-countdown {
	font-size: 1.6rem;
	font-weight: 700;
	color: var(--qta-primary);
	margin-bottom: var(--qta-abstand-m);
}

#gast-captcha {
	margin: var(--qta-abstand-m) 0;
	padding-top: var(--qta-abstand-m);
	border-top: 1px solid var(--qta-rand);
}

#btn-gast-schutz-schliessen {
	margin-top: var(--qta-abstand-m);
	width: 100%;
}

/* -------------------------------------------------------------
   Captcha-Widget (generisch, siehe js/global.js:
   qtaCaptchaWidgetEinrichten()) - kommt sowohl im Gastschutz-
   Overlay (#gast-captcha) als auch im Kontaktformular
   (#kontakt-captcha) unverändert zum Einsatz.
   ------------------------------------------------------------- */
.captcha-beschreibung {
	font-weight: 600;
	color: var(--qta-text);
}

.captcha-felder {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--qta-abstand-s);
	max-width: 260px;
	margin: 0 auto;
}

.gast-captcha-feld {
	aspect-ratio: 1;
	min-height: 72px;
	border: none;
	border-radius: var(--qta-radius-klein);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.1s ease;
}

.gast-captcha-feld:active {
	transform: scale(0.94);
}

.gast-captcha-symbol {
	font-size: 2rem;
	line-height: 1;
}

.gast-captcha-feld[data-farbe="blau"]  { background: #3b63d4; color: #ffffff; }
.gast-captcha-feld[data-farbe="rot"]   { background: #d94a42; color: #ffffff; }
.gast-captcha-feld[data-farbe="gelb"]  { background: #e8b83d; color: #332400; }
.gast-captcha-feld[data-farbe="gruen"] { background: #3f9d5c; color: #ffffff; }

.gast-captcha-feld.zuletzt-getippt {
	outline: 3px solid var(--qta-text);
	outline-offset: 2px;
}

.captcha-meldung {
	min-height: 1.2em;
	margin-top: var(--qta-abstand-s);
	margin-bottom: 0;
}
