/* ==========================================================================
   Buchungsablauf, Bestaetigung und Stornierung
   Baut auf tsds-theme.css auf. Nur seitenspezifische Regeln.
   ========================================================================== */

.booking-container {
    width: 100%;
    max-width: min(92vw, 60rem);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

/* Kopfblock — als einziger Block zentriert. Alles, was gelesen oder
   gescannt wird, bleibt linksbuendig. */
.booking-header {
    text-align: center;
    margin-bottom: var(--space-7);
}

.booking-subtitle {
    margin-top: var(--space-2);
}

/* ==========================================================================
   Fortschrittsanzeige — abgeleitet
   Die Referenz hat dafuer keine Vorlage; ihre Deck-Metapher ist
   ausdruecklich ausgenommen. Zustandstraeger ist aria-current="step",
   die Optik wird daraus abgeleitet — keine parallele Zustandsklasse.
   ========================================================================== */

.booking-steps {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-bottom: var(--space-7);
    padding: var(--space-5);
    list-style: none;
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    text-align: center;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-sunken);
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    transition:
        background var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        color var(--duration-normal) var(--ease-out);
}

.step-label {
    font-size: var(--fs-xs);
    color: var(--fg-3);
    white-space: nowrap;
}

/* Bereits erledigt */
.step[data-state="done"] .step-number {
    background: var(--brand-muted);
    border-color: var(--brand-border);
    color: var(--brand-text);
}

/* Aktueller Schritt */
.step[aria-current="step"] .step-number {
    background: var(--brand);
    border-color: var(--brand-hot);
    color: var(--tsds-ink-0);
}

.step[aria-current="step"] .step-label {
    color: var(--fg-1);
}

/* Der Zusatz "— abgeschlossen" steht in jedem Schritt im Markup und wird nur
   im erledigten Schritt in den Accessibility-Baum gehoben. Optisch aendert
   sich nichts: .visually-hidden nimmt ihn ohnehin vom Bildschirm. */
.step-done-note {
    display: none;
}

.step[data-state="done"] .step-done-note {
    display: inline;
}

/* ==========================================================================
   Schritt-Panels
   ========================================================================== */

/* Die Sichtbarkeit der Schritt-Panels laeuft ueber die globale
   [hidden]-Regel in tsds-theme.css. Eine eigene Regel daneben waere
   dieselbe Sache an zwei Stellen — und wirkungslos, weil die globale
   Regel mit !important ohnehin gewinnt. */

.step-title {
    margin-bottom: var(--space-5);
}

/* Die Ueberschrift bekommt beim Schrittwechsel programmatisch den Fokus,
   damit Screenreader den neuen Abschnitt ansagen. Sie ist nicht bedienbar,
   deshalb bleibt der Ring aus — Tastaturnutzer verlieren nichts. */
.step-title:focus {
    outline: none;
}

.step-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-6);
}

/* ==========================================================================
   Kalender — abgeleitet
   Die Referenz hat keine Datumsauswahl. Uebernommen sind das
   Formularflaechen-Rezept (versenkte Flaeche), der Hover-Guard und das
   Fokusring-Rezept.
   ========================================================================== */

.calendar-wrapper {
    margin-bottom: var(--space-6);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.calendar-month {
    font-family: var(--font-display);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
}

.calendar-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--fg-2);
    cursor: pointer;
    transition:
        color var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
    .calendar-nav-btn:hover:not(:disabled) {
        color: var(--brand-text);
        border-color: var(--brand-hot);
    }
}

.calendar-nav-btn:focus-visible {
    outline: 2px solid var(--brand-hot);
    outline-offset: 2px;
}

.calendar-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.calendar-grid {
    background: var(--bg-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-2);
}

.calendar-weekdays {
    margin-bottom: var(--space-3);
}

.weekday {
    text-align: center;
    padding: var(--space-1) 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0;
    background: var(--bg-raised);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--fg-1);
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    line-height: 1;
    cursor: pointer;
    transition:
        background var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        color var(--duration-normal) var(--ease-out);
}

@media (hover: hover) {
    .calendar-day:not(.disabled):not(.other-month):hover {
        border-color: var(--brand-hot);
    }
}

.calendar-day:focus-visible {
    outline: 2px solid var(--brand-hot);
    outline-offset: 2px;
}

/* Heute — Randmarkierung statt Fuellung, damit die Auswahl eindeutig bleibt */
.calendar-day.today {
    border-color: var(--border-strong);
}

.calendar-day[aria-pressed="true"] {
    background: var(--brand);
    border-color: var(--brand-hot);
    color: var(--tsds-ink-0);
    font-weight: var(--fw-semibold);
}

.calendar-day.disabled,
.calendar-day.other-month {
    background: transparent;
    color: var(--fg-4);
    cursor: not-allowed;
}

.calendar-day.other-month {
    cursor: default;
}

/* ==========================================================================
   Zeitslots
   ========================================================================== */

.selected-date-display {
    display: block;
    text-align: center;
    margin-bottom: var(--space-5);
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.slot-button {
    min-height: 48px;
    padding: 0 var(--space-3);
    background: var(--bg-sunken);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--fg-1);
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition:
        background var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out),
        color var(--duration-normal) var(--ease-out);
}

@media (hover: hover) {
    .slot-button:hover:not(:disabled) {
        border-color: var(--brand-hot);
    }
}

.slot-button:focus-visible {
    outline: 2px solid var(--brand-hot);
    outline-offset: 2px;
}

.slot-button[aria-pressed="true"] {
    background: var(--brand);
    border-color: var(--brand-hot);
    color: var(--tsds-ink-0);
}

.slot-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ==========================================================================
   Formular
   ========================================================================== */

.booking-summary {
    margin-bottom: var(--space-6);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-left: var(--accent-line);
    border-radius: var(--radius-md);
    color: var(--fg-2);
    font-size: 15px;
    text-align: left;
}

.booking-form {
    max-width: var(--content-measure);
    margin: 0 auto;
}

.form-note {
    margin-bottom: var(--space-5);
}

/* Terminart — abgeleitete Radiogruppe.
   Die Referenz hat keine Radiogruppe. Aufbau: Kartenrezept als
   Auswahlflaeche, Fokusring am Label, weil das Feld selbst versteckt ist. */
.meeting-type-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 var(--space-5);
}

.meeting-type-fieldset > .form-label {
    padding: 0;
}

.meeting-type-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.meeting-type-option {
    flex: 1;
    cursor: pointer;
}

/* Vom Bildschirm genommen, aber fuer Tastatur und Screenreader erreichbar.
   Die Basisregel input[type="radio"] { width: 16px; height: 16px } in
   tsds-theme.css greift auch auf dieses versteckte Feld; sie hat mit (0,1,1)
   die hoehere Spezifitaet als die Utility .visually-hidden (0,1,0). Dieser
   Selektor (0,1,2) ueberstimmt sie — deshalb steht das Rezept hier und nicht
   als Klasse im Markup. */
.meeting-type-option input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.meeting-type-label {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    height: 100%;
    padding: var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition:
        border-color var(--duration-normal) var(--ease-out),
        background var(--duration-normal) var(--ease-out);
}

@media (hover: hover) {
    .meeting-type-option:hover .meeting-type-label {
        border-color: var(--border-default);
    }
}

/* :has() an der Karte statt des Geschwisterselektors input:checked + label:
   der bricht wortlos, sobald zwischen Feld und Label ein Element steht. */
.meeting-type-option:has(input[type="radio"]:checked) .meeting-type-label {
    border-color: var(--brand-hot);
    background: var(--brand-muted);
}

.meeting-type-option:has(input[type="radio"]:focus-visible) .meeting-type-label {
    outline: 2px solid var(--brand-hot);
    outline-offset: 2px;
}

/* Inline-SVG statt Emoji: die Referenz schliesst Emojis aus, und ohne
   aria-hidden liest ein Bildschirmleser sie mit vor. */
.meeting-type-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--fg-3);
}

.meeting-type-option:has(input[type="radio"]:checked) .meeting-type-icon {
    color: var(--brand-text);
}

.meeting-type-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.meeting-type-text strong {
    color: var(--fg-1);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
}

.meeting-type-text small {
    color: var(--fg-3);
    font-size: var(--fs-xs);
}

@media (min-width: 640px) {
    .meeting-type-options {
        flex-direction: row;
    }
}

/* Ladeschicht beim Absenden */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--scrim);
}

.loading-overlay[data-visible="true"] {
    display: flex;
}

.loading-content {
    text-align: center;
    color: var(--fg-1);
}

/* ==========================================================================
   Bestaetigungsseite
   ========================================================================== */

.confirm-success,
.confirm-error,
.cancel-success,
.cancel-error {
    text-align: center;
}

.success-icon,
.error-icon,
.warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
}

.success-icon {
    color: var(--success);
}

.error-icon {
    color: var(--error-text);
}

.warning-icon {
    color: var(--warning);
}

.confirm-subtitle,
.cancel-subtitle {
    margin-bottom: var(--space-6);
}

.booking-details-card {
    max-width: var(--content-measure);
    margin: var(--space-6) auto;
    /* Karteninhalte bleiben linksbuendig, auch wenn der Block zentriert steht */
    text-align: left;
}

.details-title {
    margin-bottom: var(--space-5);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.detail-item {
    padding: var(--space-3);
    background: var(--bg-sunken);
    border-radius: var(--radius-md);
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    margin-bottom: var(--space-1);
}

.detail-value {
    font-size: var(--fs-sm);
    color: var(--fg-1);
}

.meet-link-section {
    margin-top: var(--space-5);
    padding: var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--border-subtle);
    border-left: var(--accent-line);
    border-radius: var(--radius-md);
}

.meet-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.meet-description {
    color: var(--fg-2);
    font-size: var(--fs-sm);
    margin-bottom: var(--space-3);
}

.next-steps {
    max-width: var(--content-measure);
    margin: var(--space-6) auto;
    text-align: left;
}

.next-steps-title {
    margin-bottom: var(--space-3);
}

.next-steps-list {
    list-style: none;
    counter-reset: step-counter;
}

.next-steps-list li {
    counter-increment: step-counter;
    position: relative;
    padding-left: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--fg-2);
    font-size: var(--fs-sm);
}

.next-steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--brand-muted);
    border: 1px solid var(--brand-border);
    border-radius: var(--radius-full);
    color: var(--brand-text);
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
}

.confirmation-actions,
.form-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-6);
}

.booking-reference {
    margin-top: var(--space-6);
    text-align: center;
}

/* ==========================================================================
   Stornierungsseite
   ========================================================================== */

.warning-box {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.warning-box svg {
    flex-shrink: 0;
    margin-top: 0.15em;
}

.warning-box strong {
    display: block;
    margin-bottom: var(--space-1);
    color: var(--warning-text);
}

.warning-box p {
    margin: 0;
    color: var(--fg-2);
    font-size: 15px;
}

.cancellation-form {
    max-width: var(--content-measure);
    margin: var(--space-6) auto 0;
    text-align: left;
}

/* ==========================================================================
   Druckausgabe der Bestaetigung
   ========================================================================== */

@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    .site-header,
    .site-footer,
    .skip-link,
    .confirmation-actions,
    .booking-steps,
    .cookie-banner {
        display: none !important;
    }

    .booking-container {
        max-width: 100%;
        padding: 0;
    }

    .booking-details-card,
    .step-content {
        box-shadow: none;
        border: 1px solid #cccccc;
        background: #ffffff;
    }

    .confirm-title,
    .cancel-title,
    .details-title,
    .detail-value,
    .meet-title {
        color: #000000;
    }

    .confirm-subtitle,
    .cancel-subtitle,
    .detail-label,
    .meet-description,
    .next-steps-list li,
    .reference-text {
        color: #333333;
    }

    .detail-item {
        background: #f5f5f5;
        border: 1px solid #dddddd;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 767px) {
    .booking-steps {
        gap: var(--space-3);
        padding: var(--space-3);
    }

    .step-label {
        font-size: 12px;
    }

    .step-actions,
    .confirmation-actions,
    .form-actions {
        flex-direction: column;
    }

    .step-actions .btn,
    .confirmation-actions .btn,
    .form-actions .btn {
        width: 100%;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 639px) {
    .slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--space-2);
    }

    .calendar-days {
        gap: var(--space-1);
    }

    .calendar-grid {
        padding: var(--space-2);
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: var(--fs-xs);
    }
}

/* ==========================================================================
   Rueckfaelle fuer erzwungene Farbmodi

   Steht als letzter Block der Datei: eine Media Query erhoeht die
   Spezifitaet nicht, bei gleicher Spezifitaet entscheidet die
   Quellreihenfolge.

   Das Prinzip ist ueberall dasselbe: Zustaende ueber die Form
   kommunizieren, nicht ueber die Farbe. Der Kontrastmodus ersetzt Flaechen-
   und Randfarben, damit auch jeden Unterschied, der nur daraus besteht.
   ========================================================================== */

@media (forced-colors: active) {
    /* Kalender: gewaehlt, heute und normal waren sonst nicht zu
       unterscheiden — es blieb allein die Schriftstaerke. Reihenfolge wie in
       der Grundregel: "heute" zuerst, "gewaehlt" danach, damit ein gewaehlter
       heutiger Tag als gewaehlt erscheint. */
    .calendar-day.today {
        border: 2px dashed CanvasText;
    }

    .calendar-day[aria-pressed="true"] {
        background: Highlight;
        color: HighlightText;
        border: 2px solid Highlight;
    }

    .calendar-day.disabled,
    .calendar-day.other-month {
        color: GrayText;
    }

    /* Zeitslots tragen ihren Zustand ueber dieselbe Schiene wie die
       Kalendertage und verlieren ihn im Kontrastmodus auf dieselbe Weise. */
    .slot-button[aria-pressed="true"] {
        background: Highlight;
        color: HighlightText;
        border: 2px solid Highlight;
    }

    /* Auswahlkarten: das native Radio ist versteckt, gewaehlt und ungewaehlt
       liefen allein ueber Flaeche und Randfarbe. Kante und Haekchen
       uebernehmen. */
    .meeting-type-label {
        border: 1px solid CanvasText;
    }

    .meeting-type-option:has(input[type="radio"]:checked) .meeting-type-label {
        border: 3px solid Highlight;
    }

    .meeting-type-option:has(input[type="radio"]:checked) .meeting-type-text strong::before {
        content: "\2713\00a0";
    }

    /* Schrittfolge: offen, erledigt und aktuell waren identisch. Der
       erledigte Schritt bekommt ein Haekchen anstelle der Ziffer, der
       aktuelle eine dicke Highlight-Kante. */
    .step-number {
        border: 1px solid CanvasText;
    }

    .step[data-state="done"] .step-number {
        font-size: 0;
    }

    .step[data-state="done"] .step-number::after {
        content: "\2713";
        font-size: var(--fs-sm);
    }

    .step[aria-current="step"] .step-number {
        border: 3px solid Highlight;
    }
}
