/* Seite „Gerichte“: Layout von Liste und Detail, Kennzahlen und Historie.
   Nur var(--kantine-…) und var(--mud-palette-…), keine Farbwerte. */

/* Seitenlayout: Liste links, Detail rechts. Die Spalten stehen nebeneinander, solange beide Platz haben
   (560 + 380 + 20 px Inhaltsbreite), sonst – also auch unter 960 px – untereinander; ab 375 px scrollt nur die Tabelle waagerecht. */
.kantine-dishes {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kantine-dishes-columns {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}

/* overflow: hidden hält die Zeile der Auswahl in den runden Ecken der Karte */
.kantine-dishes-list {
    flex: 3 1 560px;
    min-width: 0;
    overflow: hidden;
}

.kantine-dishes-detail {
    flex: 2 1 380px;
    min-width: 0;
}

/* Kopfzeile der Liste: Suchfeld und Filter, auf schmalen Bildschirmen untereinander */
.kantine-dishes-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* MudBlazor lässt das Feld mit flex: 1 1 auto wachsen; hier bleibt es bei 240 px und schrumpft nur auf schmalen Bildschirmen */
.kantine-dishes-search {
    flex: 0 1 240px;
}

/* Filter Alle/Vegetarisch/Vegan: runde Auswahl-Chips mit aria-pressed, ausgewählt = Rahmen interaction auf Info-Hintergrund;
   die Klickfläche ist 44 px hoch */
.kantine-dishes-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kantine-dishes-filter button {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.kantine-dishes-filter button[aria-pressed="true"] {
    border-color: var(--mud-palette-info);
    background-color: var(--kantine-info-bg);
    color: var(--kantine-info-text);
}

.kantine-dishes-filter button:focus-visible,
.kantine-dish-name:focus-visible {
    outline: 2px solid var(--mud-palette-info);
    outline-offset: 2px;
}

/* Tabelle der Gerichte: baut auf .kantine-table auf (Spaltenköpfe, Linien, Ränder). Der Zeilenkopf (Name) ist dort als Spaltenkopf gestaltet und
   wird hier zu normalem Text; die Zeilen sind mindestens 44 px hoch, Zahlen und Daten stehen mit tabellarischen Ziffern.
   Die Zahlenspalten Angebotstage und Quote (3. und 4. Zelle der Zeile) stehen rechts, die Quote fett. */
.kantine-dishes-table th:nth-child(n + 3),
.kantine-dishes-table td:nth-child(n + 3) {
    text-align: end;
}

.kantine-dishes-table tbody th {
    padding-block: 0;
    background-color: transparent;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    color: var(--mud-palette-text-primary);
}

.kantine-dishes-table td {
    font-variant-numeric: tabular-nums;
}

.kantine-dishes-table td:last-child {
    font-weight: 600;
}

.kantine-dish-last {
    white-space: nowrap;
    color: var(--mud-palette-text-secondary);
}

/* Name als Button (aria-pressed) mit dem Kennzeichen-Chip dahinter; zu lange Namen brechen um. Volle Zellbreite und flex-start, weil Chrome
   den Inhalt eines Flex-Buttons sonst mittig setzt, sobald er umbricht. */
.kantine-dish-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

/* Das gewählte Gericht: Info-Hintergrund */
.kantine-dishes-table tr.kantine-dish-row--selected {
    background-color: var(--kantine-info-bg);
}

.kantine-dish-row--selected .kantine-dish-name {
    color: var(--kantine-info-text);
}

/* Detail rechts: Kopf mit Name und Angebotszahlen, darunter das Formular, am Ende das Löschen */
.kantine-dish-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.kantine-dish-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.kantine-dish-label-field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.kantine-dish-label-field legend {
    margin-bottom: 6px;
    padding: 0;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-save {
    align-self: flex-start;
}

/* Kennzahlen des gewählten Gerichts (Angebotstage, Bestellt / angeboten, Quote): drei gleich breite Kacheln mit Radius 10 px; lange Werte
   („1.234,5 / 6.250“) brechen in der Kachel um, statt sie zu sprengen */
.kantine-dish-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 16px 20px 4px;
}

/* Bricht ein Label um („Bestellt / angeboten“), stehen die Werte trotzdem auf einer Linie: unten in der Kachel */
.kantine-dish-kpi {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
}

.kantine-dish-kpi dt {
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-kpi dd {
    margin: 2px 0 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--mud-palette-primary);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

/* Historie: Abschnittslabel (.kantine-label aus app.css) über der Tabelle oder dem leeren Zustand. Die Tabelle zeigt alle Angebotstage bis gestern und
   scrollt in ihrem Bereich (höchstens 320 px hoch, bei schmalen Bildschirmen auch waagerecht), nicht die Seite; die Spaltenköpfe bleiben stehen. */
.kantine-dish-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 20px 16px;
}

.kantine-dish-history-title {
    margin: 0;
}

.kantine-dish-history-empty {
    margin: 0;
    font-size: 14px;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-history-scroll {
    max-height: 320px;
    overflow: auto;
}

.kantine-dish-history-scroll:focus-visible {
    outline: 2px solid var(--mud-palette-info);
    outline-offset: 2px;
}

/* Spalten: Tag und Art links, Angeb., Bestellt und Quote rechts (Quote mit 8 px Abstand zum Scrollbalken); Art gedämpft, Bestellt fett. Getrennte Ränder (separate), weil Linien bei
   position: sticky an den Zellen hängen müssen und nicht an der Tabelle. */
.kantine-dish-history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.kantine-dish-history-table th,
.kantine-dish-history-table td {
    padding: 7px 8px;
    text-align: start;
}

.kantine-dish-history-table th:first-child,
.kantine-dish-history-table td:first-child {
    padding-inline-start: 0;
    white-space: nowrap;
}


.kantine-dish-history-table th:nth-child(n + 3),
.kantine-dish-history-table td:nth-child(n + 3) {
    text-align: end;
}

.kantine-dish-history-table thead th {
    position: sticky;
    top: 0;
    padding-block: 6px;
    background-color: var(--mud-palette-surface);
    box-shadow: 0 1px 0 var(--mud-palette-lines-default);
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-history-table tbody th,
.kantine-dish-history-table tbody td {
    border-top: 1px solid var(--mud-palette-lines-default);
}

.kantine-dish-history-table tbody th {
    font-weight: 400;
}

.kantine-dish-history-table tbody td:nth-child(2) {
    color: var(--mud-palette-text-secondary);
}

.kantine-dish-history-table tbody td:nth-child(4) {
    font-weight: 600;
}

.kantine-dish-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.kantine-dish-delete-reason {
    flex: 1 1 200px;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
}
