/* Bestellablauf: Zuerst stehen die Auswahl-Bausteine (Uhrzeit-Kacheln, Gericht, Portion), darunter folgen Dialog und Schritt-Assistent.
   Smartphone zuerst, ab 960 px das Desktop-Layout. Nur var(--kantine-…) und var(--mud-palette-…), keine Farbwerte. */

/* Auswahl-Option: ein Button mit role="radio". Ausgewählt = Rahmen interaction auf Info-Hintergrund; der innere Schatten macht den Rahmen 2 px breit, ohne dass
   die Option wächst. Gesperrt = Neutral-Farben; die Regel steht nach „ausgewählt“, damit eine gesperrte Option nie wie eine gewählte aussieht. Klickfläche mindestens 44 px. */
.kantine-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    min-height: 44px;
    padding: 12px 14px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.kantine-option[aria-checked="true"] {
    border-color: var(--mud-palette-info);
    box-shadow: inset 0 0 0 1px var(--mud-palette-info);
    background-color: var(--kantine-info-bg);
    color: var(--kantine-info-text);
}

.kantine-option:disabled {
    border-color: var(--mud-palette-lines-default);
    box-shadow: none;
    background-color: var(--kantine-neutral-bg);
    color: var(--kantine-neutral-text);
    cursor: not-allowed;
}

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

/* Untertitel einer Option: die Restmenge, bei einer gesperrten Option der kurze Grund */
.kantine-option-sub {
    font-size: 13px;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.kantine-option:disabled .kantine-option-sub {
    color: inherit;
}

/* Uhrzeit-Kacheln (TimeSlotTiles): zwei Spalten – minmax(0, 1fr), damit sie nie breiter werden als der Bildschirm –, ab 960 px so viele, wie mit mindestens 150 px passen (siehe unten) */
.kantine-slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kantine-slot {
    min-height: 80px;
}

.kantine-slot-time {
    font-size: 20px;
    font-weight: 700;
}

/* „Keine Uhrzeit mehr wählbar.“ bzw. „Keine Gerichte für diesen Filter.“ */
.kantine-slots-empty,
.kantine-dish-list-empty {
    margin: 0;
    font-size: 14px;
    color: var(--mud-palette-text-secondary);
}

/* Gericht (DishOptions): die Tagesgericht-Karten stehen untereinander, darunter folgen Kopfzeile und Liste der À-la-carte-Gerichte; jede Karte ist hervorgehoben mit Radius 12 px */
.kantine-dish-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kantine-dish-option {
    padding: 14px;
    border-radius: 12px;
}

/* Label „Tagesgericht“: orange Pille mit Navy-Text (Paar „accent“) */
.kantine-dish-option-label {
    padding: 2px 8px;
    border-radius: 999px;
    background-color: var(--mud-palette-secondary);
    color: var(--mud-palette-secondary-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Name und Kennzeichen nebeneinander, solange sie passen; lange Namen brechen um */
.kantine-dish-option-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.kantine-dish-option-name {
    font-size: 17px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* À-la-carte-Liste: Kopfzeile mit dem Label (.kantine-label) und dem Filter, darunter die Zeilen. Sie stehen einspaltig untereinander – minmax(0, 1fr), damit sie nie
   breiter werden als der Bildschirm –, im Desktop-Dialog (--two-columns, siehe unten) zweispaltig. */
.kantine-dish-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
}

.kantine-dish-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

/* 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-dish-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kantine-dish-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-dish-filter button[aria-pressed="true"] {
    border-color: var(--mud-palette-info);
    background-color: var(--kantine-info-bg);
    color: var(--kantine-info-text);
}

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

/* Zeile der Liste: Name mit Kennzeichen links, das Restkontingent rechts. Rahmen, Auswahl und Sperre kommen von .kantine-option; die Zeile ist mindestens 44 px hoch, lange Namen brechen um. */
.kantine-dish-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 8px 12px;
}

.kantine-dish-item-title {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.kantine-dish-item-name {
    font-size: 15px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.kantine-dish-item .kantine-option-sub {
    flex: none;
}

/* Portion (PortionChoice) als Kacheln: untereinander; der Name der Portion steht oben, der Grund einer Sperre darunter */
.kantine-portions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kantine-portion {
    min-height: 64px;
    font-size: 16px;
    font-weight: 600;
}

/* Portion als Segmentschalter: baut auf .kantine-segments und .kantine-segment (app.css) auf – zwei gleich breite Segmente, höchstens 340 px breit.
   Die Wahl steht in aria-checked statt aria-pressed; ein gesperrtes Segment nennt den Grund unter dem Namen. */
.kantine-portions--segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 340px;
    max-width: 100%;
}

.kantine-portions--segmented .kantine-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding-block: 6px;
}

.kantine-portions--segmented .kantine-segment[aria-checked="true"] {
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.kantine-portions--segmented .kantine-segment:disabled {
    background-color: transparent;
    color: var(--mud-palette-text-secondary);
    cursor: not-allowed;
}

.kantine-portions--segmented .kantine-option-sub {
    font-size: 12px;
}

@media (min-width: 960px) {
    /* Uhrzeit-Kacheln: so viele nebeneinander, wie mit mindestens 150 px passen; etwas niedriger und kleiner als auf dem Smartphone */
    .kantine-slots {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .kantine-slot {
        gap: 2px;
        min-height: 60px;
        padding-block: 10px;
    }

    .kantine-slot-time {
        font-size: 18px;
    }

    .kantine-slot .kantine-option-sub {
        font-size: 12px;
    }

    /* À-la-carte-Liste im Dialog: zwei gleich breite Spalten */
    .kantine-dish-list--two-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Bestellformular (OrderForm): Dialog (Desktop) und Schritt-Assistent (Smartphone). Der Assistent ist für Bildschirme unter 960 px gedacht und auf 560 px begrenzt,
   falls jemand die Seite am Desktop öffnet; der Dialog erscheint nur ab 960 px. */

/* Hinweis „gerade vergeben“ (Hinweis-Farben): Icon links, der Text bricht um */
.kantine-order-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background-color: var(--kantine-notice-bg);
    color: var(--kantine-notice-text);
    font-size: 14px;
    line-height: 1.45;
}

.kantine-order-notice .mud-icon-root {
    flex: none;
    margin-top: 1px;
}

/* Meldung der API: der Tag lässt sich nicht bestellen, oder die Bestellung wurde abgelehnt */
.kantine-order-error {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--mud-palette-error);
}

/* „Bestellung gespeichert“: Erfolgssymbol im Ernährungs-Paar, Zusammenfassung und Frist, darunter „Fertig“ */
.kantine-order-done {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 24px 8px;
    text-align: center;
}

.kantine-order-done-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: var(--kantine-dietary-bg);
    color: var(--kantine-dietary-text);
}

.kantine-order-done-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--mud-palette-primary);
}

.kantine-order-done-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

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

.kantine-order-done-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px 24px;
}

/* Dialog: Kopf, Abschnitte und Fußleiste liegen auf der vollen Breite des Dialogs; dafür hat der Inhaltsbereich von MudBlazor keinen Innenabstand (ContentClass in OrderDialog) */
.mud-dialog .mud-dialog-content.kantine-order-dialog-content {
    padding: 0;
}

.kantine-order-head {
    padding: 22px 24px 6px;
}

.kantine-order-head .kantine-label {
    display: block;
}

.kantine-order-head-title {
    margin: 2px 0 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--mud-palette-primary);
}

/* Abschnitte „1 · Uhrzeit“, „2 · Gericht“, „3 · Portion“: je ein fieldset ohne Rahmen mit Legende */
.kantine-order-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 12px 24px 0;
}

.kantine-order-section {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.kantine-order-legend {
    margin-bottom: 10px;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.kantine-order-section .kantine-order-notice {
    margin-top: 10px;
}

/* Fehlt der Tag (Ladefehler), steht die Meldung direkt unter dem Kopf */
.kantine-order--dialog > .kantine-order-error {
    padding: 12px 24px 0;
}

/* Fußleiste: links Zusammenfassung und Stornierfrist, rechts „Abbrechen“ und „Verbindlich bestellen“; sie schließt den Dialog unten ab */
.kantine-order-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
    padding: 16px 24px;
    border-top: 1px solid var(--mud-palette-lines-default);
    border-bottom-left-radius: var(--mud-default-borderradius);
    border-bottom-right-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-background);
}

.kantine-order-foot-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kantine-order-summary {
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.kantine-order-foot-note {
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
}

.kantine-order-foot-actions {
    display: flex;
    gap: 10px;
    margin-inline-start: auto;
}

/* Assistent: Seite mit Überschrift und Formular; das Formular besteht aus Fortschrittsleiste, Schritt und „Zurück“ */
.kantine-order-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kantine-order--wizard {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 560px;
}

.kantine-order-progress {
    padding: 12px 16px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background-color: var(--mud-palette-surface);
}

/* Fortschrittsleiste: drei gleich breite Schritte, der Balken ist ein Pseudo-Element. Fertige und der aktuelle Schritt (aria-current) in interaction, kommende in der Linienfarbe. */
.kantine-order-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kantine-order-steps-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
}

.kantine-order-steps-item::before {
    content: "";
    height: 4px;
    border-radius: 2px;
    background-color: var(--mud-palette-lines-default);
}

.kantine-order-steps-item--done {
    color: var(--mud-palette-text-primary);
}

.kantine-order-steps-item--done::before,
.kantine-order-steps-item[aria-current="step"]::before {
    background-color: var(--mud-palette-info);
}

.kantine-order-steps-item[aria-current="step"] {
    font-weight: 700;
    color: var(--mud-palette-primary);
}

.kantine-order-context {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--mud-palette-text-secondary);
    overflow-wrap: anywhere;
}

.kantine-order-step {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kantine-order-step-title {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 700;
    color: var(--mud-palette-primary);
}

/* Portion als Kachel: Der Chevron rechts zeigt, dass die Wahl zum nächsten Schritt führt – nur an wählbaren Kacheln */
.kantine-order--wizard .kantine-portion {
    position: relative;
    padding-inline-end: 44px;
}

.kantine-order--wizard .kantine-portion:enabled::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 20px;
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--mud-palette-info);
    border-right: 2px solid var(--mud-palette-info);
    transform: translateY(-50%) rotate(45deg);
}

/* „Bestellung prüfen“: Zeilen Tag, Uhrzeit, Gericht, Portion; darunter die Stornierfrist und „Verbindlich bestellen“ */
.kantine-order-review {
    margin: 0;
    padding: 4px 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    background-color: var(--mud-palette-surface);
}

.kantine-order-review-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
}

.kantine-order-review-row + .kantine-order-review-row {
    border-top: 1px solid var(--mud-palette-lines-default);
}

.kantine-order-review dt {
    flex: none;
    font-size: 14px;
    color: var(--mud-palette-text-secondary);
}

.kantine-order-review dd {
    min-width: 0;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    text-align: end;
    overflow-wrap: anywhere;
}

.kantine-order-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--mud-palette-text-secondary);
}

.kantine-order-hint .mud-icon-root {
    flex: none;
    margin-top: 1px;
    font-size: 16px;
}

/* „Verbindlich bestellen“ und „Fertig“ im Assistenten: ganze Breite, 50 px hoch (mindestens 44 px) */
.kantine-order--wizard .kantine-order-confirm,
.kantine-order--wizard .kantine-order-done-actions .mud-button-root {
    min-height: 50px;
    font-size: 16px;
    font-weight: 700;
}

.kantine-order--wizard .kantine-order-confirm {
    margin-top: 6px;
}

.kantine-order--wizard .kantine-order-done {
    padding: 24px 8px 8px;
}

.kantine-order--wizard .kantine-order-done-icon {
    width: 72px;
    height: 72px;
}

.kantine-order--wizard .kantine-order-done-title {
    font-size: 22px;
}

.kantine-order--wizard .kantine-order-done-actions {
    padding: 0;
}

.kantine-order--wizard .kantine-order-done-actions .mud-button-root {
    flex: 1;
}

.kantine-order-back {
    align-self: flex-start;
    min-height: 44px;
}
