/* =====================================================================
   RZB – AG-Termine
   Eigenes Stylesheet für termine.php (ersetzt style.css)
   ===================================================================== */

/* ---------- Grundwerte ---------- */
:root {
	--bg:        #f4f5f8;
	--karte:     #ffffff;
	--text:      #1d1d1f;
	--text2:     #4a4a50;
	--grau:      #8e8e93;
	--linie:     #e5e5ea;
	--linie2:    #f1f1f4;
	--rot:       #ff3b30;
	--akzent:    #1f3b63;          /* Dunkelblau für Kopf und Links */
	--akzent2:   #2d5a94;
	--radius:    14px;
	--schatten:  0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .06);
	--std:       64px;             /* Höhe einer Stunde, wird aus PHP überschrieben */
	--stunden:   4;                /* Anzahl angezeigter Stunden, wird aus PHP überschrieben */
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.45;
}

a { color: var(--akzent2); }
a:hover { color: var(--akzent); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--akzent2) 55%, transparent); outline-offset: 2px; }

/* Fachfarben: --farbe = Rand/Fläche, --dunkel = Schrift */
.f-ma    { --farbe: #d70015; --dunkel: #8a000d; }
.f-if    { --farbe: #ff9500; --dunkel: #8a4a00; }
.f-phy   { --farbe: #0fa3b1; --dunkel: #065c64; }
.f-che   { --farbe: #2337c6; --dunkel: #0f1280; }
.f-bio   { --farbe: #2b8a63; --dunkel: #1d5a42; }
.f-sonst { --farbe: #8e8e93; --dunkel: #3a3a3c; }

.ico { flex: none; width: auto; height: 22px; aspect-ratio: 20 / 32; overflow: visible; }

/* ---------- Seitenkopf ---------- */
.kopf {
	background: linear-gradient(135deg, var(--akzent) 0%, var(--akzent2) 100%);
	color: #fff;
	padding: 28px 20px 70px;
}
.kopf-innen { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.kopf-symbole { display: flex; gap: 6px; flex: none; }
.kopf-symbole span {
	display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
	background: rgba(255, 255, 255, .95);
}
.kopf-symbole .ico { height: 26px; }
.kopf .unterzeile { margin: 0 0 2px; font-size: .85em; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.kopf h1 { margin: 0; font-size: clamp(1.4em, 3.2vw, 2em); line-height: 1.15; font-weight: 700; }

/* ---------- Inhalt ---------- */
.seite { max-width: 1200px; margin: -48px auto 0; padding: 0 20px 32px; }

.karte {
	background: var(--karte);
	border-radius: var(--radius);
	box-shadow: var(--schatten);
}

/* ---------- AG-Auswahl ---------- */
.filter { padding: 6px 18px; margin-bottom: 16px; }
.filter .reihe {
	display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
	padding: 10px 0; border-top: 1px solid var(--linie2);
}
.filter .reihe:first-of-type { border-top: 0; }
.filter .fach {
	display: inline-flex; align-items: center; gap: 9px; width: 150px; flex: none;
	font-weight: 600; font-size: .92em; color: var(--dunkel, var(--text));
}
.filter .fach .ico { height: 24px; }

.chip {
	display: inline-block; padding: 6px 14px; border-radius: 999px;
	background: #fff; color: var(--text); text-decoration: none;
	border: 1.5px solid color-mix(in srgb, var(--farbe) 40%, #fff);
	font-size: .9em; line-height: 1.2;
	transition: background .15s, border-color .15s, transform .1s;
}
.chip:hover { background: color-mix(in srgb, var(--farbe) 10%, #fff); border-color: var(--farbe); color: var(--text); }
.chip:active { transform: scale(.97); }
.chip.aktiv { background: var(--farbe); border-color: var(--farbe); color: #fff; font-weight: 600; }
.chip.alle { --farbe: var(--akzent); --dunkel: var(--akzent); }

.filter summary { display: none; }

/* ---------- Leiste: Ansicht + Navigation ---------- */
.leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 14px; }

.segment { display: inline-flex; background: #e6e8ee; border-radius: 10px; padding: 3px; }
.segment a {
	padding: 7px 20px; border-radius: 8px; color: var(--text2); text-decoration: none; font-size: .95em;
	transition: background .15s, color .15s;
}
.segment a:hover { color: var(--text); }
.segment a.aktiv { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.nav { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.nav a {
	display: inline-flex; align-items: center; justify-content: center; height: 36px;
	border-radius: 10px; background: #fff; color: var(--text); text-decoration: none;
	box-shadow: var(--schatten); font-size: .95em; transition: background .15s;
}
.nav a:hover { background: #f0f2f6; color: var(--text); }
.nav a.pfeil { width: 40px; font-size: 1.35em; line-height: 1; }
.nav a.heute-btn { padding: 0 16px; font-weight: 500; }
.nav a.heute-btn.inaktiv { color: var(--grau); pointer-events: none; box-shadow: none; background: transparent; }

/* ---------- Wochenansicht ---------- */
.woche { overflow: hidden; margin-bottom: 20px; }
.woche-titel {
	display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
	padding: 16px 20px; border-bottom: 1px solid var(--linie);
}
.woche-titel h2 { margin: 0; font-size: 1.35em; font-weight: 700; }
.woche-titel .kw { color: var(--grau); font-size: .95em; }
.woche-titel .badge {
	margin-left: auto; align-self: center; font-size: .78em; font-weight: 600;
	background: color-mix(in srgb, var(--rot) 12%, #fff); color: #c4251c;
	padding: 3px 11px; border-radius: 999px;
}

.leerhinweis {
	padding: 12px 20px; background: #f8f9fb; border-bottom: 1px solid var(--linie);
	color: var(--text2); font-size: .93em;
}
.leerhinweis a { font-weight: 600; text-decoration: none; margin-left: 8px; white-space: nowrap; }

.scroll { overflow-x: auto; position: relative; }
.raster { display: grid; }

.ecke, .zeiten { position: sticky; left: 0; z-index: 3; background: var(--karte); }
.ecke { border-bottom: 1px solid var(--linie); }

.tagkopf {
	padding: 10px 6px 12px; text-align: center;
	border-bottom: 1px solid var(--linie); border-left: 1px solid var(--linie);
}
.tagkopf .wt { display: block; font-size: .76em; color: var(--grau); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tagkopf .nr {
	display: inline-block; margin-top: 3px; min-width: 36px; height: 36px; line-height: 36px;
	border-radius: 18px; font-size: 1.4em; font-weight: 500;
}
.tagkopf.heute .wt { color: var(--rot); }
.tagkopf.heute .nr { background: var(--rot); color: #fff; font-weight: 700; }
.tagkopf.vergangen .nr { color: var(--grau); }

.zeiten { height: calc(var(--std) * var(--stunden)); }
.zeiten span {
	position: absolute; right: 8px; font-size: .72em; color: var(--grau);
	transform: translateY(-50%); font-variant-numeric: tabular-nums;
}
.zeiten span:first-child { transform: none; }

.spalte {
	position: relative; height: calc(var(--std) * var(--stunden));
	border-left: 1px solid var(--linie);
	background-image:
		repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--std) - 1px), var(--linie) calc(var(--std) - 1px), var(--linie) var(--std)),
		repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--std) / 2 - 1px), var(--linie2) calc(var(--std) / 2 - 1px), var(--linie2) calc(var(--std) / 2));
}
.spalte.we { background-color: #fafbfc; }
.spalte.heute { background-color: #fff7f6; }

/* Terminblock */
.block {
	position: absolute; padding: 5px 7px; border-radius: 8px; overflow: hidden;
	background: color-mix(in srgb, var(--farbe) 15%, #fff);
	border-left: 4px solid var(--farbe); color: var(--dunkel);
	line-height: 1.2; box-shadow: 0 0 0 1px #fff, 0 1px 3px rgba(0, 0, 0, .06);
	container-type: inline-size;
	transition: box-shadow .15s, transform .15s;
}
.block:hover { box-shadow: 0 0 0 1px #fff, 0 4px 12px rgba(0, 0, 0, .14); transform: translateY(-1px); z-index: 2; }
.block b {
	display: block; font-weight: 650; padding-right: 26px;
	font-size: clamp(10px, 9cqw, 13.5px); hyphens: auto; overflow-wrap: anywhere;
}
.block .zeit, .block .raum { display: block; opacity: .85; font-size: clamp(9px, 8cqw, 12px); font-variant-numeric: tabular-nums; }
.block .ico { position: absolute; top: 6px; right: 6px; height: 28px; }
.block .kurz { display: none; }
.block.vergangen { opacity: .45; }

/* Schmale Blöcke: Symbol über dem Titel, Kurztitel, max. 2 Zeilen */
@container (max-width: 110px) {
	.block b {
		padding-right: 0;
		display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	}
	.block .ico { position: static; height: 16px; display: block; margin-bottom: 2px; }
	.block .lang { display: none; }
	.block .kurz { display: inline; }
	.block .raum { font-weight: 600; }
}
@container (max-width: 80px) {
	.block .lbl { display: none; }
	.block .raum::before { content: "R "; font-weight: 400; }
}

/* Linie für die aktuelle Uhrzeit */
.jetzt { position: absolute; left: -1px; right: 0; height: 2px; background: var(--rot); z-index: 2; pointer-events: none; }
.jetzt::before {
	content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px;
	border-radius: 50%; background: var(--rot);
}

/* ---------- Listenansicht ---------- */
.liste { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.liste li {
	display: flex; align-items: center; gap: 16px; padding: 12px 18px 12px 12px;
	background: var(--karte); border-radius: 12px; box-shadow: var(--schatten);
	border-left: 5px solid var(--farbe);
}
.liste .datum {
	flex: none; width: 58px; text-align: center; border-radius: 10px; padding: 5px 0 6px;
	background: color-mix(in srgb, var(--farbe) 12%, #fff); color: var(--dunkel);
}
.liste .datum .wt  { display: block; font-size: .72em; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.liste .datum .tag { display: block; font-size: 1.5em; font-weight: 700; line-height: 1.1; }
.liste .datum .mon { display: block; font-size: .75em; }
.liste .ico { height: 32px; }
.liste .text { min-width: 0; flex: 1; }
.liste .titel { display: block; font-weight: 650; font-size: 1.05em; }
.liste .info { display: flex; flex-wrap: wrap; gap: 2px 16px; color: var(--text2); font-size: .92em; margin-top: 2px; }
.liste .info b { color: var(--text); font-weight: 600; }

.leer-liste { padding: 20px; color: var(--grau); font-style: italic; }

/* ---------- Fußzeile ---------- */
.fuss { text-align: center; color: var(--text2); font-size: .92em; padding: 8px 0 0; }
.fuss a { font-weight: 600; text-decoration: none; }

/* ---------- Kleine Bildschirme ---------- */
@media (max-width: 700px) {
	.kopf { padding: 20px 16px 62px; }
	.kopf-innen { flex-direction: column; align-items: flex-start; gap: 12px; }
	.kopf-symbole span { width: 34px; height: 34px; border-radius: 9px; }
	.kopf-symbole .ico { height: 22px; }

	.seite { padding: 0 12px 24px; }

	.filter { padding: 0 14px; }
	.filter .fach { width: 100%; }
	.filter summary {
		display: flex; align-items: center; gap: 8px; padding: 13px 0; cursor: pointer;
		list-style: none; color: var(--dunkel, var(--text));
	}
	.filter summary::-webkit-details-marker { display: none; }
	.filter summary .ico { height: 22px; }
	.filter summary .pfeil-auf { margin-left: auto; color: var(--grau); transition: transform .2s; }
	.filter[open] summary { border-bottom: 1px solid var(--linie2); }
	.filter[open] summary .pfeil-auf { transform: rotate(180deg); }

	.nav { margin-left: 0; }
	.woche-titel { padding: 12px 14px; }
	.woche-titel h2 { font-size: 1.12em; }
	.block { padding: 3px 4px; }

	.liste li { gap: 12px; padding: 10px 12px 10px 10px; }
	.liste .ico { display: none; }
	.liste .datum { width: 52px; }
}

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