/* BWPM – Layout und Gestaltung (ersetzt site.css aus dem alten Projekt).
   Aufbau: Kopfzeile oben, Navigation links, Inhalt rechts über die ganze Fensterbreite.
   Farben und Abstände zentral als Variablen, damit sie an einer Stelle angepasst werden können. */

:root {
    --bwpm-primaer: #2f5d8c;
    --bwpm-primaer-dunkel: #1f3a56;
    --bwpm-primaer-hell: #e8f0f8;
    --bwpm-hintergrund: #f3f5f8;
    --bwpm-rand: #dfe4ea;
    --bwpm-text: #2b2f33;
    --bwpm-text-leise: #6b7480;
    --bwpm-fehler: #c62828;
    --bwpm-radius: 8px;
    --bwpm-schatten: 0 1px 3px rgba(16, 24, 40, .08);
    --topbar-hoehe: 56px;
    --sidebar-breite: 240px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    color: var(--bwpm-text);
    background: var(--bwpm-hintergrund);
}
a { color: var(--bwpm-primaer); }
a:hover { color: var(--bwpm-primaer-dunkel); }

/* ---------- Grundgerüst ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { display: flex; flex: 1; min-height: 0; }

.topbar {
    position: sticky; top: 0; z-index: 900;
    height: var(--topbar-hoehe);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 20px;
    background: var(--bwpm-primaer);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand img { height: 38px; width: auto; background: #fff; border-radius: 4px; padding: 2px; }
.brand span { font-size: 1.25em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-rechts { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.topbar-link { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 6px; opacity: .9; }
.topbar-link:hover { color: #fff; opacity: 1; }
.topbar-link img { height: 16px; }
.benutzer { opacity: .9; }
.benutzer::before { content: "● "; color: #8fd18f; }
.inline-form { display: inline; margin: 0; }
.topbar-button {
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6);
    border-radius: 6px; padding: 5px 12px; cursor: pointer; font: inherit;
}
.topbar-button:hover { background: rgba(255,255,255,.15); }

/* ---------- Navigation links ---------- */
.sidebar {
    width: var(--sidebar-breite); flex-shrink: 0;
    background: var(--bwpm-primaer-dunkel);
    color: #cfd8e3;
    display: flex; flex-direction: column;
    position: sticky; top: var(--topbar-hoehe);
    height: calc(100vh - var(--topbar-hoehe));
    overflow-y: auto;
}
.nav, .nav ul { list-style: none; margin: 0; padding: 0; }
.nav { padding: 10px 8px; flex: 1; }
.nav a, .nav .nav-text, .nav summary {
    display: block; padding: 7px 12px; border-radius: 6px;
    color: #cfd8e3; text-decoration: none; cursor: pointer;
}
.nav a:hover, .nav summary:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: var(--bwpm-primaer); color: #fff; font-weight: 600; }
.nav ul { padding-left: 10px; }
.nav-gruppe > summary { font-weight: 600; color: #fff; list-style: none; }
.nav-gruppe > summary::-webkit-details-marker { display: none; }
.nav-gruppe > summary::before { content: "▸"; display: inline-block; width: 14px; transition: transform .15s; }
.nav-gruppe[open] > summary::before { transform: rotate(90deg); }
.sidebar-fuss { padding: 12px 20px; font-size: .85em; color: #8fa1b5; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-fuss a { color: #b7c4d3; }

/* ---------- Inhalt ---------- */
.content { flex: 1; min-width: 0; padding: 20px 24px 32px 24px; }
.content h2, .seitentitel { margin: 0 0 16px 0; font-size: 1.5em; font-weight: 600; color: var(--bwpm-primaer-dunkel); }
h3 { margin: 0; font-size: 1em; font-weight: 600; color: var(--bwpm-primaer-dunkel); }

/* Karten */
.card { background: #fff; border: 1px solid var(--bwpm-rand); border-radius: var(--bwpm-radius); box-shadow: var(--bwpm-schatten); min-width: 0; }
.card-kopf {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; border-bottom: 1px solid var(--bwpm-rand); min-height: 48px;
}
.card-kopf .untertitel { color: var(--bwpm-text-leise); font-weight: normal; margin-left: 6px; }
.card-inhalt { padding: 14px 16px; }
.card-inhalt.ohne-rand { padding: 0; }
.aktionen { display: flex; gap: 8px; align-items: center; }

/* Formulare */
.formular { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 20px; align-items: end; }
.formular .breit { grid-column: span 2; }
.feld-info { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.feld-info label { font-size: .8em; color: var(--bwpm-text-leise); }
.zeile { display: flex; gap: 10px; align-items: flex-end; }
.zeile > .wachsen { flex: 1; min-width: 0; }

/* Meldungen */
.hinweis-rot, .meldung-fehler, .validation-message { color: var(--bwpm-fehler); }
.hinweis { color: var(--bwpm-text-leise); font-style: italic; margin: 8px 0; }
.fehlerbox { border: 1px solid var(--bwpm-fehler); background: #fdecec; color: var(--bwpm-fehler); padding: 10px 14px; border-radius: var(--bwpm-radius); margin-bottom: 16px; }
.leer { color: var(--bwpm-text-leise); padding: 16px; text-align: center; }
.dialog-icon { height: 20px; vertical-align: middle; margin-right: 6px; }

/* Grids in Karten ohne doppelten Rahmen */
.card .e-grid { border: none; border-radius: 0 0 var(--bwpm-radius) var(--bwpm-radius); }

/* ---------- Startseite ---------- */
.home { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: .85em; color: var(--bwpm-text-leise); margin-top: 6px; }
.login-form .e-btn { margin-top: 10px; }
.home-links { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--bwpm-rand); }
.status-hinweis { background: #fff4e5; border: 1px solid #f0c27b; color: #8a5300; padding: 8px 10px; border-radius: 6px; margin-bottom: 10px; }
/* Startseite: Inhalt als Spalte, damit das Sponsorenbild am unteren Fensterrand steht */
.content:has(> .sponsoren) { display: flex; flex-direction: column; padding-bottom: 0; }
.sponsoren { margin: auto -24px 0 -24px; padding-top: 20px; line-height: 0; }
.sponsoren a { display: block; }
.sponsoren img { display: block; width: 100%; height: auto; }
.center { text-align: center; }

/* ---------- Schüler ---------- */
.schueler-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "auswahl daten      daten"
        "auswahl berufswahl zuteilung"
        "auswahl plaetze    zugeteilt";
    /* Die hohe Schülerliste links soll die Zeilen rechts nicht auseinanderziehen:
       zusätzliche Höhe geht nur in die letzte Zeile */
    grid-template-rows: auto auto 1fr;
    gap: 8px;
    align-items: start;
}
.schueler-auswahl { grid-area: auswahl; position: sticky; top: calc(var(--topbar-hoehe) + 20px); }
.schueler-auswahl .card-inhalt { display: flex; flex-direction: column; gap: 8px; }
.schueler-layout .card-kopf { padding: 6px 12px; min-height: 40px; }
.schueler-layout .card-inhalt { padding: 8px 12px; }
.schueler-layout .card-inhalt.ohne-rand { padding: 0; }
.schueler-layout .leer { padding: 10px; }
.schueler-daten { grid-area: daten; }
.schueler-berufswahl { grid-area: berufswahl; }
.schueler-zuteilung { grid-area: zuteilung; }
.schueler-plaetze { grid-area: plaetze; }
.schueler-zugeteilt { grid-area: zugeteilt; }
.lehrer-info { font-size: .9em; color: var(--bwpm-text-leise); }
.lehrer-info strong { color: var(--bwpm-text); font-weight: 600; }
.anzahl { background: var(--bwpm-primaer-hell); color: var(--bwpm-primaer); border-radius: 10px; padding: 1px 8px; font-size: .8em; font-weight: 600; }

/* ---------- Report ---------- */
.report-rahmen { height: calc(100vh - 220px); min-height: 500px; overflow: auto; }

/* ---------- schmale Fenster ---------- */
@media (max-width: 1400px) {
    .schueler-layout {
        grid-template-columns: 260px minmax(0, 1fr);
        grid-template-areas:
            "auswahl daten"
            "auswahl berufswahl"
            "auswahl zuteilung"
            "auswahl plaetze"
            "auswahl zugeteilt";
        grid-template-rows: auto auto auto auto 1fr;
    }
}
@media (max-width: 900px) {
    .app-body { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .nav { display: flex; flex-wrap: wrap; }
    .home, .schueler-layout { grid-template-columns: 1fr; }
    .schueler-layout { grid-template-areas: "auswahl" "daten" "berufswahl" "zuteilung" "plaetze" "zugeteilt"; grid-template-rows: none; }
    .schueler-auswahl { position: static; }
}

/* ---------- Blazor-Fehleranzeige ---------- */
#blazor-error-ui { background: #fff8d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .reload { margin-left: 8px; }

/* ---------- Seiten mit Auswahl links und Inhalt rechts (Berichte, Mail) ---------- */
.report-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 8px; align-items: start; }
.captcha { display: flex; flex-direction: column; gap: 4px; }
.e-tab .e-content .e-item { padding-top: 8px; }
@media (max-width: 900px) { .report-layout { grid-template-columns: 1fr; } }
.zwei-spalten { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
@media (max-width: 1100px) { .zwei-spalten { grid-template-columns: 1fr; } }
.status-ok { color: #2e7d32; font-weight: 600; }
.status-offen { color: var(--bwpm-fehler); }
.schueler-layout.lehrer {
    grid-template-areas:
        "auswahl daten      daten"
        "auswahl berufswahl berufswahl";
    grid-template-rows: auto 1fr;
}
@media (max-width: 1400px) {
    .schueler-layout.lehrer { grid-template-areas: "auswahl daten" "auswahl berufswahl"; grid-template-rows: auto 1fr; }
}
@media (max-width: 900px) { .schueler-layout.lehrer { grid-template-columns: 1fr; grid-template-areas: "auswahl" "daten" "berufswahl"; } }

/* Firmendaten: zwei Blöcke nebeneinander (Adresse | Erreichbarkeit), Felder jeweils untereinander */
.formular-bloecke { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 24px; max-width: 900px; align-items: start; }
.formular-bloecke .block { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 700px) { .formular-bloecke { grid-template-columns: 1fr; } }

/* Zahlenfelder in Tabellen (Bearbeiten): keine Pfeile nach oben/unten, damit der Wert in schmalen Spalten sichtbar bleibt.
   Gilt für alle SfGrid-Tabellen, auch im Bearbeiten-Dialog; Zahlenfelder in Formularen ausserhalb von Tabellen behalten die Pfeile. */
.e-grid .e-numeric .e-spin-up,
.e-grid .e-numeric .e-spin-down,
.e-grid .e-numeric .e-input-group-icon,
.e-dialog.e-edit-dialog .e-numeric .e-spin-up,
.e-dialog.e-edit-dialog .e-numeric .e-spin-down,
.e-dialog.e-edit-dialog .e-numeric .e-input-group-icon { display: none !important; }
.e-grid .e-numeric input.e-numerictextbox { padding-right: 4px; text-align: right; }

/* Drag & Drop Freie Plätze -> Zuteilung */
.ziehbar { cursor: grab; display: flex; align-items: center; gap: 6px; }
.ziehbar:active { cursor: grabbing; }
.ziehbar .e-icons { color: var(--bwpm-text-leise); }
.drop-ziel { outline: 2px dashed var(--bwpm-primaer); outline-offset: -2px; background: var(--bwpm-primaer-hell); }

/* ---------- Navigation: Hauptpunkte hervorheben, Administration abtrennen ---------- */
/* Hauptpunkte der obersten Ebene (Home, Firmen, Schüler, Zuteilung, Auswertungen): grösser, weiss */
.nav > li.haupt > a,
.nav > li.haupt > .nav-text { color: #fff; font-size: 1.1em; font-weight: 600; padding-top: 9px; padding-bottom: 9px; }
.nav > li.haupt > a:hover { background: rgba(255,255,255,.12); }

/* Gruppen der obersten Ebene (z. B. Administration): Trennbalken davor, kein Pfeil */
.nav > li.haupt-gruppe { margin-top: 12px; padding-top: 12px; border-top: 2px solid rgba(255,255,255,.25); }
.nav > li.haupt-gruppe > .nav-gruppe > summary { color: #fff; font-size: 1.1em; font-weight: 600; }
.nav > li.haupt-gruppe > .nav-gruppe > summary::before { content: none; }
.sidebar-fuss a { display: block; margin-bottom: 4px; }

/* Administration / Firma: alles auf einer Seite (Firmendaten | Ansprechpartner, darunter Berufsangebot) */
.firma-gesamt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "daten ansprechpartner" "angebot angebot"; gap: 12px; align-items: start; }
.firma-daten { grid-area: daten; min-width: 0; }
.firma-ansprechpartner { grid-area: ansprechpartner; min-width: 0; }
.firma-angebot { grid-area: angebot; min-width: 0; }
.firma-gesamt .formular-bloecke { max-width: none; }
@media (max-width: 1100px) { .firma-gesamt { grid-template-columns: 1fr; grid-template-areas: "daten" "ansprechpartner" "angebot"; } }
