/* Einheitliche Kopfzeile (components/site-header) für alle Frontend-Layouts.
   Eigenständig: nutzt die Portal-Farben (portal.css), wenn geladen, sonst die Akzentfarbe aus app.css.
   Dadurch sieht die Kopfzeile auf Kurs-, Konto-, Community- und Programmseiten gleich aus. */

.sh, .sh-sheet, .sh-skip, .sx {
  --sh-bg: var(--surface, #ffffff);
  --sh-fg: var(--fg, #2a2024);
  --sh-muted: var(--sh-muted-c, #6a5b60);
  --sh-line: var(--line, #e7dfe1);
  --sh-hover: var(--surface-2, #faf6f7);
  --sh-accent: var(--wine, var(--accent, #9b1131));
  --sh-ink: var(--wine-ink, color-mix(in srgb, var(--sh-accent) 66%, #1b1216));
  --sh-soft: var(--wine-soft, color-mix(in srgb, var(--sh-accent) 10%, #fff));
  --sh-on: var(--on-accent, #ffffff);
  --sh-font: "Mulish", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sh-display: "Mulish", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  /* Nur auf Portalseiten (Community/Programme) gibt es einen Dunkelmodus; dort liefern die Portal-Farben den Rest. */
  .sh, .sh-sheet, .sx { --sh-muted-c: var(--muted); }
}

/* „Zum Inhalt springen“ – erst bei Tastaturfokus sichtbar */
.sh-skip {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  background: var(--sh-accent); color: var(--sh-on); font: 700 15px/1 var(--sh-font);
  padding: 12px 18px; border-radius: 10px; text-decoration: none;
}
.sh-skip:focus { top: 10px; outline: 3px solid var(--sh-fg); outline-offset: 2px; }

.sh {
  position: sticky; top: 0; z-index: 40;
  background: var(--sh-bg); border-bottom: 1px solid var(--sh-line);
  font-family: var(--sh-font); color: var(--sh-fg);
}
.sh-in {
  max-width: 1240px; margin: 0 auto; height: var(--sh-h, 64px); padding: 0 16px;
  display: flex; align-items: center; gap: 12px;
}
.sh--wide .sh-in { max-width: none; padding: 0 20px; }
.sh a { color: inherit; }
.sh :focus-visible, .sh-sheet :focus-visible { outline: 3px solid var(--sh-accent); outline-offset: 2px; border-radius: 10px; }

.sh-logo { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; min-height: 44px; margin-right: 8px; }
.sh-logo-chip { display: grid; place-items: center; background: #fff; border-radius: 8px; padding: 4px 6px; }
.sh-logo img { height: 34px; width: auto; display: block; }
.sh-logo-text { font: 600 20px/1.1 var(--sh-display); color: var(--sh-fg); letter-spacing: -.01em; }

.sh-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sh-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 999px;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; color: var(--sh-fg);
}
.sh-link:hover { background: var(--sh-hover); }
.sh-link[aria-current] { background: var(--sh-soft); color: var(--sh-ink); }

/* Untermenü eines Menüpunkts: gleiche Bauart wie das Konto-Menü, öffnet unter dem Punkt nach rechts */
.sh-drop { position: relative; }
.sh-drop summary { list-style: none; cursor: pointer; gap: 6px; }
.sh-drop summary::-webkit-details-marker { display: none; }
.sh-drop[open] summary { background: var(--sh-hover); }
.sh-drop[open] .sh-caret { transform: rotate(180deg); }
.sh-drop .sh-menu { left: 0; right: auto; min-width: 280px; }
.sh-menu a[aria-current] { background: var(--sh-soft); color: var(--sh-ink); }
/* Website-Menü: sechs Punkte mit Untermenüs – etwas enger gesetzt, das Konto-Menü bricht nicht um */
.sh--site .sh-nav { gap: 0; }
.sh--site .sh-link { padding: 0 11px; }
.sh-user summary { white-space: nowrap; }

.sh-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.sh-bell {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--sh-line); border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px;
}
.sh-bell:hover { background: var(--sh-hover); }
.sh-bell[aria-current] { background: var(--sh-soft); color: var(--sh-ink); border-color: transparent; }
.sh-dot {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--sh-accent); color: var(--sh-on); font-size: 12px; font-weight: 800; line-height: 1;
}

.sh-user { position: relative; }
.sh-user summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 4px 12px 4px 4px; border: 1px solid var(--sh-line); border-radius: 999px; font-weight: 700; font-size: 14px;
}
.sh-user summary::-webkit-details-marker { display: none; }
.sh-user summary:hover, .sh-user[open] summary { background: var(--sh-hover); }
.sh-user summary[aria-current] { border-color: color-mix(in srgb, var(--sh-accent) 45%, transparent); }
.sh-av {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: grid; place-items: center; background: var(--sh-soft); color: var(--sh-ink); font-weight: 800; font-size: 13px;
}
.sh-caret { transition: transform .15s ease; }
.sh-user[open] .sh-caret { transform: rotate(180deg); }
.sh-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 250px; z-index: 50;
  background: var(--sh-bg); border: 1px solid var(--sh-line); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 32px rgba(40, 15, 22, .14); display: grid;
}
.sh-menu-name { margin: 0; padding: 10px 12px 8px; font-size: 13px; color: var(--sh-muted); border-bottom: 1px solid var(--sh-line); margin-bottom: 4px; }
.sh-menu a, .sh-menu button {
  display: block; width: 100%; text-align: left; padding: 11px 12px; border-radius: 10px; border: 0; background: none;
  font: 600 15px/1.3 var(--sh-font); color: var(--sh-fg); text-decoration: none; cursor: pointer;
}
.sh-menu a:hover, .sh-menu button:hover { background: var(--sh-hover); }
.sh-menu form { margin: 0; border-top: 1px solid var(--sh-line); margin-top: 4px; padding-top: 4px; }

.sh-cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--sh-accent); color: var(--sh-on) !important; font-weight: 800; font-size: 15px; text-decoration: none;
}
.sh-cta:hover { filter: brightness(1.08); }

.sh-menubtn {
  display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--sh-line); border-radius: 999px; background: var(--sh-bg); color: var(--sh-fg);
  font: 800 15px/1 var(--sh-font);
}
.sh-menubtn:hover { background: var(--sh-hover); }
.sh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Menü-Overlay (Mobil) */
.sh-sheet {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; padding: 0 0 24px; border: 0;
  background: var(--sh-bg); color: var(--sh-fg); font-family: var(--sh-font); overflow-y: auto;
}
.sh-sheet::backdrop { background: rgba(30, 12, 18, .45); }
.sh-sheet-head {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
  height: var(--sh-h, 64px); padding: 0 16px; background: var(--sh-bg); border-bottom: 1px solid var(--sh-line);
}
.sh-sheet-title { font: 600 20px/1 var(--sh-display); }
.sh-close {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; cursor: pointer;
  border: 1px solid var(--sh-line); border-radius: 999px; background: var(--sh-bg); color: var(--sh-fg); font: 800 15px/1 var(--sh-font);
}
.sh-sheet-nav, .sh-sheet-sub { display: grid; gap: 4px; padding: 12px 12px 0; }
.sh-sheet-nav a {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px; border-radius: 14px;
  font-size: 19px; font-weight: 800; text-decoration: none; color: var(--sh-fg);
}
.sh-sheet-nav a:hover { background: var(--sh-hover); }
.sh-sheet-nav a[aria-current] { background: var(--sh-soft); color: var(--sh-ink); }
/* Menüpunkt mit Unterpunkten im Overlay: Überschrift, darunter eingerückt die Unterpunkte */
.sh-sheet-group { display: grid; gap: 2px; padding-bottom: 6px; }
.sh-sheet-heading { display: flex; align-items: center; min-height: 56px; margin: 0; padding: 0 16px; font-size: 19px; font-weight: 800; }
.sh-sheet-nav a.sh-sheet-child { min-height: 48px; margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--sh-line); border-radius: 0 12px 12px 0; font-size: 17px; font-weight: 600; }
.sh-sheet-sub { margin-top: 12px; border-top: 1px solid var(--sh-line); padding-top: 16px; }
.sh-sheet-label { margin: 0 16px 6px; font-size: 13px; color: var(--sh-muted); }
.sh-sheet-sub a, .sh-sheet-sub button {
  display: flex; align-items: center; width: 100%; min-height: 50px; padding: 0 16px; border-radius: 12px; border: 0; background: none;
  font: 700 17px/1.2 var(--sh-font); color: var(--sh-fg); text-decoration: none; text-align: left; cursor: pointer;
}
.sh-sheet-sub a:hover, .sh-sheet-sub button:hover { background: var(--sh-hover); }
.sh-sheet-sub form { margin: 0; }

/* „Zur Website“: gleiche Bauart wie „Mitteilungen“, schmal nur das Symbol mit Tooltip */
.sh-website, .sh-help { color: inherit; }
/* „Hilfe“: immer nur Symbol mit Tooltip – mit Beschriftung reicht bei vollem Menü (Programme, Community, Blog) selbst 1440 px nicht */
.sh-help { padding: 0; width: 44px; justify-content: center; }
.sh-help .sh-bell-text { display: none; }
.sh-bell { white-space: nowrap; flex-shrink: 0; }
/* Breite Bildschirme: etwas mehr Platz, damit Menü und Knöpfe mit Beschriftung nebeneinander passen */
@media (min-width: 1400px) {
  .sh-in { max-width: 1320px; }
}
/* Darunter reicht der Platz nicht für alle Beschriftungen (Website-Menü + Konto, Plattform-Menü + drei Knöpfe):
   „Zur Website“, „Mitteilungen“ und „Suche“ nur als Symbol mit Tooltip */
@media (max-width: 1399px) {
  .sh-bell-text { display: none; }
  .sh-bell { padding: 0; width: 44px; justify-content: center; }
  .sh-bell .sh-dot { position: absolute; top: -4px; right: -6px; border: 2px solid var(--sh-bg); }
  .sh--site .sh-link { padding: 0 9px; }
}
@media (max-width: 1099px) {
  .sh-link { padding: 0 11px; }
}
@media (max-width: 1023px) {
  .sh-nav, .sh-bell, .sh-user, .sh-guest { display: none; }
  .sh-menubtn { display: inline-flex; }
  .sh-logo img { height: 30px; }
}
@media (min-width: 1024px) {
  .sh-sheet { display: none; }
}
/* Website-Menü mit Untermenüs ist breiter: schon unter 1280 px auf den „Menü“-Knopf wechseln */
@media (min-width: 1024px) and (max-width: 1279px) {
  .sh--site .sh-nav, .sh--site .sh-user, .sh--site .sh-guest { display: none; }
  .sh--site .sh-menubtn { display: inline-flex; }
  .sh--site ~ .sh-sheet[open] { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .sh-caret { transition: none; }
}

/* Admin-Ansicht („Als Nutzer anmelden“): feste Farben, damit der Balken in jedem Layout und Modus gleich auffällt. */
.sh-imp {
  background: #7d0d27; color: #fff; border-bottom: 4px solid #f99759;
  font: 600 15px/1.4 var(--sh-font);
}
.sh-imp-in {
  max-width: 1240px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
@media (min-width: 1400px) { .sh-imp-in { max-width: 1320px; } }
.sh--wide .sh-imp-in { max-width: none; padding: 10px 20px; }
.sh-imp-icon { flex-shrink: 0; color: #f99759; }
.sh-imp-text { margin: 0; flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.sh-imp-text strong { font-weight: 800; }
.sh-imp-mail { font-weight: 500; opacity: .9; }
.sh-imp-hint { display: block; font-weight: 500; font-size: 13px; opacity: .85; }
.sh-imp-form { margin: 0; }
.sh-imp-btn {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: #f99759; color: #3a1008; font: 800 15px/1 var(--sh-font); white-space: nowrap;
}
.sh-imp-btn:hover { background: #fbb183; }
.sh-imp .sh-imp-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.sh-imp-notice {
  margin: 0; padding: 10px 16px; background: #fdeee3; color: #5a1a0c;
  font-weight: 700; font-size: 14px; text-align: center;
}
@media (max-width: 599px) {
  .sh-imp-in { padding: 10px 16px; }
  .sh-imp-form, .sh-imp-btn { width: 100%; }
}

/* ---------- Desktop: schwebender Reiter zur Lernplattform am rechten Rand (components/platform-tab) ---------- */
.platform-tab {
    position: fixed; right: 0; top: 50%; z-index: 55; transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
    padding: 1.1rem 0.7rem; border-radius: 12px 0 0 12px;
    font-size: 1rem; font-weight: 700; line-height: 1; color: #fff; text-decoration: none;
    background: var(--accent); box-shadow: -4px 6px 20px -8px rgba(27, 18, 22, 0.45);
    /* heller Rand: hebt den Reiter auch auf Flächen in der Akzentfarbe (Hero) ab */
    border: 2px solid rgba(255, 253, 250, 0.9); border-right: 0;
    transition: padding-right .2s ease-out, filter .15s;
}
.platform-tab span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.platform-tab:hover { padding-right: 0.9rem; filter: brightness(1.08); }
.platform-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 820px) { .platform-tab { display: none; } }
@media (prefers-reduced-motion: reduce) { .platform-tab { transition: none; } }
@media print { .platform-tab { display: none !important; } }

/* Globale Suche: Lupe in der Kopfzeile (auch mobil sichtbar) und Such-Fenster */
.sh-search {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; cursor: pointer;
  border: 1px solid var(--sh-line); border-radius: 999px; background: var(--sh-bg); color: var(--sh-fg);
  font: 700 14px/1 var(--sh-font); text-decoration: none;
}
.sh-search:hover { background: var(--sh-hover); }
@media (max-width: 1399px) {
  .sh-search { padding: 0; width: 44px; justify-content: center; }
  .sh-search-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.sx {
  width: min(680px, calc(100% - 24px)); max-height: min(80vh, 760px); margin: 8vh auto auto; padding: 0;
  border: 1px solid var(--sh-line); border-radius: 18px; background: var(--sh-bg); color: var(--sh-fg); font-family: var(--sh-font);
  box-shadow: 0 24px 64px rgba(40, 15, 22, .25); overflow: hidden;
}
.sx[open] { display: flex; flex-direction: column; }
.sx::backdrop { background: rgba(30, 12, 18, .45); }
.sx-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--sh-line); margin: 0; }
.sx-icon { flex-shrink: 0; color: var(--sh-muted); }
.sx-input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: none; color: inherit; font: 600 18px/1.3 var(--sh-font); }
.sx-input::-webkit-search-cancel-button { display: none; }
.sx-close {
  min-height: 36px; padding: 0 12px; border: 1px solid var(--sh-line); border-radius: 999px; background: none; color: var(--sh-muted);
  font: 700 13px/1 var(--sh-font); cursor: pointer;
}
.sx-close:hover { background: var(--sh-hover); color: var(--sh-fg); }
.sx-body { overflow-y: auto; padding: 8px 8px 12px; transition: opacity .15s ease; }
.sx-body.sx-loading { opacity: .55; }
.sx-hint, .sx-empty { margin: 12px; color: var(--sh-muted); font-size: 15px; line-height: 1.5; }
.sx-empty { color: var(--sh-fg); font-weight: 700; }
.sx-hint a { color: var(--sh-accent); font-weight: 700; }
.sx-group + .sx-group { margin-top: 6px; border-top: 1px solid var(--sh-line); padding-top: 6px; }
.sx-group-title { margin: 8px 12px 4px; font: 800 12px/1.2 var(--sh-font); letter-spacing: .06em; text-transform: uppercase; color: var(--sh-accent); }
.sx-group-title span { color: var(--sh-muted); font-weight: 700; }
.sx-group ul { list-style: none; margin: 0; padding: 0; }
.sx-item { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; color: var(--sh-fg); text-decoration: none; }
.sx-item:hover, .sx-item.is-active { background: var(--sh-hover); }
.sx-item-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; line-height: 1.35; }
.sx-item-context { font-size: 12.5px; color: var(--sh-muted); }
.sx-item-text { font-size: 13.5px; line-height: 1.45; color: var(--sh-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sx-item--locked .sx-item-text { color: var(--sh-accent); font-weight: 700; }
.sx-lock { flex-shrink: 0; color: var(--sh-muted); }
.sx mark { background: color-mix(in srgb, var(--sh-accent) 18%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sx-all { margin: 10px 12px 0; }
.sx-all a { font-weight: 800; color: var(--sh-accent); }
@media (max-width: 640px) {
  .sx { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border-radius: 0; border: 0; }
}
.sx .sx-input, .sx .sx-input:focus, .sx .sx-input:focus-visible { border: 0; outline: 0; box-shadow: none; padding: 0; }
.sx-head:focus-within { box-shadow: inset 0 -2px 0 var(--sh-accent); }
