/* ==========================================================================
   stil.css – überarbeitete Fassung
   Aufbau:
   1. Variablen
   2. Grundlayout (Grid, Header, Main, Footer)
   3. Formularelemente
   4. Auswahlzeilen (div.cb), Fieldsets, Tabellen
   5. Registrierungsseite (body.registration-page)
   6. Breakpoints und Barrierefreiheit
   ========================================================================== */


/* 1. Variablen ------------------------------------------------------------ */

:root {
	--accent: #2f6f55;
	--accent-dark: #245543;
	--accent-soft: #e6f1ec;
	--text: #1f2a25;
	--text-muted: #5d6b64;
	--border: #cfd9d3;
	--border-soft: #e1e8e3;
	--bg: #f4f6f5;
	--surface: #ffffff;
	--danger: #b3261e;

	--radius: 0.5rem;
	--radius-lg: 0.75rem;
	--shadow-sm: 0 1px 2px rgba(20, 40, 30, 0.08);
	--shadow-md: 0 1px 3px rgba(20, 40, 30, 0.06), 0 8px 24px rgba(20, 40, 30, 0.06);
	--focus-ring: 0 0 0 3px rgba(47, 111, 85, 0.25);

	--header-h: 8rem;
	--content-w: 100%;
}


/* 2. Grundlayout ---------------------------------------------------------- */

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

body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: var(--header-h) auto 1fr auto auto;
	grid-template-areas:
		"head"
		"lside"
		"main"
		"rside"
		"foot";
	gap: 0;
	min-height: 100vh;
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.55;
}

header {
	grid-area: head;
	background-color: var(--surface);
	background-image: url("title_kl.png");
	background-position: center;
	background-repeat: no-repeat;
	border-bottom: 1px solid var(--border-soft);
}

nav {
	grid-area: lside;
}

aside {
	grid-area: rside;
}

main {
	grid-area: main;
	padding: clamp(1rem, 4vw, 2rem);
}

/* Ältere Seiten ohne eigene Karte: Inhalt als Karte darstellen */
body:not(.registration-page) main {
	margin: 1rem;
	background: var(--surface);
	border: 1px solid var(--border-soft);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}

footer {
	grid-area: foot;
	padding: 1.25rem clamp(1rem, 4vw, 2rem);
	background: #e9efeb;
	border-top: 1px solid var(--border-soft);
	color: var(--text-muted);
	font-size: 0.9rem;
}

a {
	color: var(--accent);
}

a:hover {
	color: var(--accent-dark);
}

div.termine {
	margin-bottom: 0.5rem;
	font-size: 1.2em;
	font-weight: 700;
}

#hinweis {
	padding: 0 1em 1em;
}


/* 3. Formularelemente ----------------------------------------------------- */

label {
	display: inline-block;
	width: 100%;
	margin: 0.4rem 0 0.2rem;
	color: var(--text);
	font-weight: 600;
	text-align: left;
}

/* Textähnliche Felder; :where() hält die Spezifität niedrig,
   so dass spezielle Klassen weiter unten leicht überschreiben können */
input:where(:not([type=checkbox], [type=radio], [type=submit], [type=button], [type=reset], [type=number], [type=file], [type=color], [type=range])),
select,
textarea {
	display: inline-block;
	width: 100%;
	max-width: 28rem;
	margin: 0.2rem 0;
	padding: 0.6rem 0.8rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	font: inherit;
	box-shadow: none;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
	min-height: 6rem;
	resize: vertical;
}

input:where(:not([type=checkbox], [type=radio], [type=submit], [type=button], [type=reset])):hover,
select:hover,
textarea:hover {
	border-color: #aebcb4;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: var(--focus-ring);
}

/* Fehlermarkierung erst nach der Eingabe, nicht schon beim Laden */
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
	border-color: var(--danger);
}

input::placeholder,
textarea::placeholder {
	color: #8a968f;
}

input:disabled,
select:disabled,
textarea:disabled {
	background: #eef1ef;
	color: var(--text-muted);
	cursor: not-allowed;
}

input[type=number] {
	width: 4.5rem;
	padding: 0.5rem 0.4rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	font: inherit;
	text-align: center;
}

input[type=checkbox],
input[type=radio] {
	width: 1.15rem;
	height: 1.15rem;
	margin: 0;
	accent-color: var(--accent);
	vertical-align: middle;
}

/* Buttons */
button,
input[type=submit],
input[type=button] {
	display: block;
	width: auto;
	min-width: 14rem;
	height: auto;
	margin: 1rem auto;
	padding: 0.75rem 1.5rem;
	border: 1px solid var(--accent);
	border-radius: var(--radius);
	background: var(--accent);
	box-shadow: var(--shadow-sm);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

button:hover,
input[type=submit]:hover,
input[type=button]:hover {
	border-color: var(--accent-dark);
	background: var(--accent-dark);
}

button:focus-visible,
input[type=submit]:focus-visible,
input[type=button]:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

button:disabled,
input[type=submit]:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Sekundäre Aktion: <button class="secondary"> */
button.secondary {
	background: var(--surface);
	color: var(--accent);
}

button.secondary:hover {
	background: var(--accent-soft);
}

form br {
	clear: left;
}

/* Anmeldegruppen als eigenständige, schwebende Flächen */
#frmRegistrierung > fieldset {
	margin: 0 0 1.25rem;
	padding: 1.25rem;
	border: 0;
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

#frmRegistrierung > fieldset > legend {
	padding: 0 0.4rem;
	color: var(--text);
	font-size: 1.1rem;
	font-weight: 700;
}


/* 4. Auswahlzeilen, Fieldsets, Tabellen ----------------------------------- */

/* Zeile mit Checkbox/Radio und Beschriftung */
div.cb {
	display: flex;
	flex-flow: row wrap;
	align-items: center;
	gap: 0.4rem 0.75rem;
	margin: 0.4rem 0;
	padding: 0.55rem 0.8rem;
	background: #f7f9f8;
	border: 1px solid var(--border-soft);
	border-radius: var(--radius);
	transition: background-color 150ms ease, border-color 150ms ease;
}

div.cb:hover {
	background: #eef3f0;
}

/* Gewählte Zeile hervorheben */
div.cb:has(:checked) {
	background: var(--accent-soft);
	border-color: #a9cbb9;
}

div.cb label {
	flex: 1 1 14rem;
	width: auto;
	margin: 0;
	font-weight: 400;
}

div.cb label.anzahl {
	margin-bottom: 0;
	flex-basis: 16rem;
}

div.cb:has(input.veranstaltungs-auswahl) {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: start;
	gap: 0.35rem 0.75rem;
}

div.cb input.veranstaltungs-auswahl {
	grid-column: 1;
	grid-row: 1;
	margin-top: 0.2rem;
}

div.cb input.veranstaltungs-auswahl + label {
	grid-column: 2;
	grid-row: 1;
	min-width: 0;
	overflow-wrap: anywhere;
}

div.cb:has(input.veranstaltungs-auswahl) label.anzahl {
	display: flex;
	grid-column: 2;
	grid-row: 2;
	align-items: center;
	gap: 0.5rem;
	width: fit-content;
	max-width: 100%;
	flex-basis: auto;
}

div.cb:has(input.veranstaltungs-auswahl) label.anzahl input[type=number] {
	flex: 0 0 4.5rem;
	margin: 0;
}

label.cb {
	width: auto;
	margin: 0;
	text-align: left;
}

input.cb {
	display: inline-block;
	width: 1.15rem;
	vertical-align: middle;
}

.rb {
	width: 1.15rem;
	margin-top: 0;
	vertical-align: middle;
}

label.rb {
	width: auto;
	padding-top: 0.2em;
	font-weight: 400;
	text-align: left;
}

div.anrede {
	display: inline;
	width: auto;
}

#datenschutz {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	width: 100%;
	max-width: 100%;
	margin: 1.25rem 0 0.75rem;
	padding: 1rem 1.1rem;
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
	line-height: 1.5;
}

#datenschutz input[type=checkbox] {
	flex: 0 0 auto;
	margin-top: 0.2rem;
}

fieldset.firmen-rueckmeldung label[for=workshop] {
	display: block;
	width: auto;
	margin: 0.8rem 0 0.15rem;
}

fieldset.firmen-rueckmeldung textarea#workshop {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
}

fieldset.firmen-rueckmeldung {
	margin: 0.75rem 0;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: var(--radius);
	background: #f7f9f8;
	box-shadow: var(--shadow-sm);
}

fieldset.firmen-rueckmeldung legend {
	padding: 0 0.4rem;
	font-weight: 600;
}

fieldset.radio-group {
	margin: 0.75rem 0;
	padding: 0;
	border: 0;
}

fieldset.radio-group legend {
	padding: 0;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 600;
}

.radio-options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

label.radio-button,
div.cb label.radio-button {
	position: relative;
	display: inline-flex;
	flex: 0 1 auto;
	align-items: center;
	justify-content: center;
	width: auto;
	min-height: 2.75rem;
	margin: 0;
	padding: 0.55rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

label.radio-button:hover {
	border-color: #a9cbb9;
	background: #eef3f0;
}

label.radio-button:has(input[type=radio]:checked) {
	border-color: var(--accent);
	background: var(--accent-soft);
	color: var(--accent-dark);
}

label.radio-button:focus-within {
	outline: none;
	box-shadow: var(--focus-ring);
}

label.radio-button input[type=radio] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

/* Tabellen */
table {
	border-collapse: collapse;
	max-width: 100%;
}

td,
th {
	padding: 0.45rem 0.7rem;
	border: 1px solid var(--border);
	text-align: left;
}

th {
	background: #eef3f0;
	font-weight: 600;
}

tbody tr:nth-child(even) {
	background: #f9fbfa;
}


/* 5. Registrierungsseite -------------------------------------------------- */

body.registration-page {
	grid-template-rows: var(--header-h) auto 1fr auto auto;
	background: var(--bg);
	color: var(--text);
}

.registration-page main {
	width: 100%;
	max-width: 58rem;
	margin: 0 auto;
	padding: clamp(1.25rem, 4vw, 2.5rem);
}

.registration-content {
	padding: clamp(1.5rem, 5vw, 3rem);
	background: var(--surface);
	border: 1px solid var(--border-soft);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
}

.registration-page .page-heading {
	margin-bottom: 2rem;
}

.registration-page .eyebrow {
	margin: 0 0 0.3rem;
	color: var(--accent);
	font-size: 0.9rem;
	font-weight: 600;
}

.registration-page h1 {
	margin: 0;
	color: #1b3a2d;
	font-size: clamp(1.7rem, 5vw, 2.25rem);
	line-height: 1.2;
}

.registration-page .page-heading > p:last-child {
	margin: 0.8rem 0 0;
	color: var(--text-muted);
}

.registration-page .event-selection {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.registration-page .event-selection legend {
	margin-bottom: 0.8rem;
	padding: 0;
	color: var(--text);
	font-size: 1rem;
	font-weight: 700;
}

.registration-page .event-grid {
	display: grid;
	gap: 0.75rem;
}

.registration-page .event-section {
	margin-top: 1.8rem;
}

.registration-page .event-section h2 {
	margin: 0 0 0.6rem;
	color: #1b3a2d;
	font-size: 1.2rem;
}

.registration-page .section-empty {
	margin: 0.4rem 0 1rem;
	color: var(--text-muted);
}

.registration-page .event-card {
	overflow: hidden;
	background: var(--surface);
	border: 1px solid var(--border-soft);
	border-radius: var(--radius);
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

.registration-page .event-card:hover,
.registration-page .event-card:focus-within {
	border-color: #a9cbb9;
	box-shadow: var(--shadow-sm);
}

.registration-page .event-button {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-width: 0;
	min-height: 3.75rem;
	margin: 0;
	padding: 0.9rem 1.1rem;
	border: 0;
	border-radius: 0;
	background: var(--surface);
	box-shadow: none;
	color: var(--accent-dark);
	font: inherit;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.registration-page .event-button:hover {
	background: var(--accent-soft);
	color: #173c2b;
}

.registration-page .event-button:disabled {
	background: var(--surface);
	color: var(--text-muted);
	cursor: not-allowed;
}

.registration-page .event-button:focus-visible {
	position: relative;
	z-index: 1;
	outline: 3px solid #718f7d;
	outline-offset: -3px;
	box-shadow: none;
}

.registration-page .event-button-copy {
	display: grid;
	gap: 0.15rem;
}

.registration-page .event-button-title {
	color: inherit;
}

.registration-page .event-button-schooltype {
	color: var(--text-muted);
	font-size: 0.85rem;
	font-weight: 400;
}

.registration-page .event-button-arrow {
	margin-left: 1rem;
	color: #66816f;
	font-size: 1.2rem;
	transition: transform 150ms ease;
}

.registration-page .event-button:hover .event-button-arrow {
	transform: translateX(3px);
}

.registration-page .empty-state {
	padding: 1.5rem;
	background: #f7f9f8;
	border: 1px solid var(--border-soft);
	border-left: 4px solid #718f7d;
	border-radius: var(--radius);
}

.registration-page .empty-state h2 {
	margin: 0 0 0.45rem;
	color: #1b3a2d;
	font-size: 1.15rem;
}

.registration-page .empty-state p {
	margin: 0.4rem 0 0;
	color: var(--text-muted);
}

.registration-page footer {
	padding: 1.5rem max(1.25rem, calc((100% - 52rem) / 2));
	background: #e9efeb;
	color: var(--text-muted);
	font-size: 0.9rem;
}

.registration-page footer h2 {
	margin: 0 0 0.5rem;
	color: #1b3a2d;
	font-size: 1rem;
}


/* 6. Breakpoints und Barrierefreiheit ------------------------------------- */

/* Ab mittlerer Breite: Label und Feld nebeneinander */
@media (min-width: 30em) {
	label {
		width: 12rem;
		margin: 0.4rem 0;
	}

	input:where(:not([type=checkbox], [type=radio], [type=submit], [type=button], [type=reset], [type=number], [type=file])),
	select,
	textarea {
		width: 18rem;
	}

	label.cb,
	div.cb label {
		width: auto;
	}
}

@media (min-width: 40em) {
	:root {
		--header-h: 10rem;
		--content-w: 44rem;
	}

	body {
		grid-template-columns: minmax(1rem, 1fr) minmax(0, var(--content-w)) minmax(1rem, 1fr);
		grid-template-rows: var(--header-h) 1fr auto;
		grid-template-areas:
			"lside head rside"
			"lside main rside"
			"lside foot rside";
		gap: 0.75rem 0;
		padding: 0.5rem 0;
	}

	header {
		background-image: url("title_mi.png");
		border: 1px solid var(--border-soft);
		border-radius: var(--radius-lg);
	}

	footer {
		border: 1px solid var(--border-soft);
		border-radius: var(--radius-lg);
	}

	body:not(.registration-page) main {
		margin: 0;
	}

	body.registration-page {
		--content-w: 56rem;
		grid-template-areas:
			"lside head rside"
			"lside main rside"
			"foot foot foot";
		gap: 0 0.75rem;
		padding: 0;
	}

	.registration-page header {
		border: 0;
		border-radius: 0;
	}

	.registration-page main {
		padding: 2rem 1.5rem 3rem;
	}

	.registration-page footer {
		border: 0;
		border-radius: 0;
	}
}

@media (min-width: 65em) {
	:root {
		--header-h: 15rem;
		--content-w: 52rem;
	}

	body.registration-page {
		--header-h: 10rem;
		--content-w: 56rem;
	}

	header {
		background-image: url("title.png");
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
	}
}
