/* ---------------------------------------------------------------------------
   Gastauftritt (Welle 3): Öffnungszeiten als Tabelle, Speisekarte mit Suche
   und Sortiermodus, Galerie mit einer Aktion je Bild, Serientermine, Schritt-
   folge im Veranstaltungsformular, Vollständigkeitszeile im Betrieb.
   Nur Tokens aus app.css und admin_ui.css. Rahmen statt Schatten.
--------------------------------------------------------------------------- */

/* ===== Öffnungszeiten: kompakte Wochentabelle ============================ */
.hours-editor .hours-table {
    container-type: inline-size;
    display: grid;
    border-top: 1px solid var(--line);
}

.hours-editor .hours-table__head {
    display: grid;
    grid-template-columns: 7rem 7.5rem minmax(0, 1fr);
    gap: .75rem;
    padding: .5rem 0 .4rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hours-editor .hours-table__head-times {
    display: grid;
    grid-template-columns: minmax(9.5rem, 13rem) minmax(9.5rem, 13rem);
    column-gap: 3.1rem;
}

.hours-editor .hours-table .hours-day {
    min-width: 0;
    min-height: 56px;
    margin: 0;
    padding: .45rem 0;
    display: grid;
    grid-template-columns: 7rem 7.5rem minmax(0, 1fr);
    align-items: start;
    gap: .35rem .75rem;
    border: 0;
    border-bottom: 1px solid var(--line);
}

.hours-editor .hours-table .hours-day:last-child {
    border-bottom: 1px solid var(--line);
}

.hours-editor .hours-table .hours-day__name {
    padding-top: .7rem;
    font: 700 .95rem "LM Space", sans-serif;
}

.hours-editor .hours-table .hours-windows {
    grid-column: 3;
    min-width: 0;
}

.hours-editor .hours-table .hours-day__closed-note {
    display: none;
    grid-column: 3;
    min-height: 44px;
    align-items: center;
    color: var(--muted);
    font-size: .86rem;
}

.hours-editor .hours-table .hours-day[data-closed="true"] {
    background: var(--surface-soft);
}

.hours-editor .hours-table .hours-day[data-closed="true"] .hours-day__closed-note {
    display: flex;
}

.hours-editor .hours-table .time-window {
    display: grid;
    grid-template-columns: minmax(9.5rem, 13rem) 2rem minmax(9.5rem, 13rem);
    align-items: start;
    gap: .55rem;
}

.hours-editor .hours-table .time-window > span {
    min-height: 44px;
    justify-content: center;
}

.hours-editor .hours-table .time-window input[type="time"] {
    width: 100%;
    min-width: 9.5rem;
    min-height: 44px;
    font-variant-numeric: tabular-nums;
}

.hours-editor .hours-table .time-window > div[data-time-boundary] > label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.hours-editor .hours-table .second-window {
    margin-top: .25rem;
}

.hours-editor .hours-table .second-window > summary {
    min-height: 40px;
    font-size: .8rem;
}

.hours-editor .hours-table .second-window[open] > summary {
    margin-bottom: .25rem;
}

/* Zweites Fenster: die Feldnamen bleiben sichtbar, weil die Kopfzeile hier nicht mehr trägt */
.hours-editor .hours-table .second-window .time-window > div[data-time-boundary] > label {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 0 .25rem !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Ruhetag und Servicezeiten: Checkbox bleibt, sieht aus wie ein Schalter, trägt ein Wort */
.hours-editor .hours-switch {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: .55rem;
}

.hours-editor .hours-switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 1.5rem;
    min-height: 1.5rem;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.hours-editor .hours-switch input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: .15rem;
    left: .15rem;
    width: 1.1rem;
    height: 1.1rem;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    transition: transform .15s ease;
}

.hours-editor .hours-switch input[type="checkbox"]:checked {
    border-color: var(--green);
    background: var(--green);
}

.hours-editor .hours-switch input[type="checkbox"]:checked::before {
    border-color: var(--green);
    transform: translateX(1.25rem);
}

.hours-editor .hours-switch input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.hours-editor .hours-switch label {
    min-height: 44px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    cursor: pointer;
}

.hours-editor .hours-note {
    margin-top: var(--space-5);
}

/* Abweichungen: Liste nach Datum mit Stand */
.hours-editor .exception-list-editor {
    display: grid;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.hours-editor .exception-editor {
    border-left: 4px solid var(--line);
    background: var(--surface);
}

.hours-editor .exception-editor[data-exception-state="kommend"] {
    border-left-color: var(--amber);
}

.hours-editor .exception-editor[data-exception-state="aktiv"] {
    border-left-color: var(--green);
}

.hours-editor .exception-editor.is-past {
    background: var(--surface-soft);
}

.hours-editor .exception-editor__title {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .75rem;
}

.hours-editor .exception-editor__title h3 {
    overflow-wrap: anywhere;
}

.hours-editor .exception-editor__dates {
    color: var(--muted);
    font-size: .86rem;
    font-variant-numeric: tabular-nums;
}

.hours-editor .exception-empty {
    margin-bottom: var(--space-4);
}

.hours-editor .exception-empty h3 {
    margin: 0 0 .35rem;
}

.hours-editor .exception-empty p {
    margin: 0;
    color: var(--muted);
}

@media (max-width: 48rem) {
    .hours-editor .hours-table__head {
        display: none;
    }

    .hours-editor .hours-table .hours-day {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: .6rem 0;
    }

    .hours-editor .hours-table .hours-day__name {
        padding-top: .6rem;
    }

    .hours-editor .hours-table .hours-windows,
    .hours-editor .hours-table .hours-day__closed-note {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .hours-editor .hours-table .day-closed {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .hours-editor .hours-table .hours-day__name {
        grid-column: 1;
        grid-row: 1;
    }

    .hours-editor .hours-table .hours-day__closed-note {
        min-height: 0;
        padding-bottom: .2rem;
    }

    .hours-editor .hours-table .time-window {
        grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr);
    }

    .hours-editor .hours-table .time-window > span {
        align-self: end;
    }

    .hours-editor .hours-table .time-window input[type="time"] {
        min-width: 0;
    }

    .hours-editor .hours-table .time-window > div[data-time-boundary] > label {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 0 .25rem !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
}

@media (max-width: 30rem) {
    .hours-editor .hours-table .time-window,
    .hours-editor .exception-editor .time-window {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
    }

    .hours-editor .hours-table .time-window > span,
    .hours-editor .exception-editor .time-window > span {
        display: none;
    }
}

/* ===== Speisekarte: Suche, Sortiermodus, eingeklappte Rubriken ============ */
.menu-search {
    display: none;
    align-items: end;
}

.js .menu-search {
    display: flex;
}

.menu-search > div {
    flex: 1 1 18rem;
    max-width: 30rem;
}

.menu-search input[type="search"] {
    width: 100%;
    min-height: 44px;
}

.menu-search__count {
    min-height: 44px;
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: .86rem;
}

.menu-search__count:empty {
    display: none;
}

.menu-sort-toggle {
    display: none;
}

.js .menu-sort-toggle {
    display: inline-flex;
}

.js .menu-admin-card:not(.is-sorting) .menu-order-controls {
    display: none;
}

.menu-admin-card.is-sorting {
    border-color: var(--green);
}

.menu-admin-card.is-sorting .menu-sort-toggle {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-deep);
}

.menu-admin-card.is-sorting .menu-order-controls button {
    border-color: var(--line);
    background: var(--surface);
    color: var(--green);
}

.menu-admin-card.is-sorting .menu-order-controls button:disabled {
    border-color: transparent;
    background: transparent;
}

.menu-section-fold > summary {
    min-height: 56px;
    padding: .65rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .75rem;
    list-style: none;
    cursor: pointer;
}

.menu-section-fold > summary::-webkit-details-marker {
    display: none;
}

.menu-section-fold > summary:hover {
    background: var(--surface-soft);
}

.menu-section-fold > summary:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}

.menu-section-fold[open] > summary {
    border-bottom: 1px solid var(--line);
}

.menu-section-fold__chevron {
    width: .6rem;
    height: .6rem;
    flex: none;
    border-right: 2px solid var(--green);
    border-bottom: 2px solid var(--green);
    transform: translateY(-.15rem) rotate(-45deg);
    transition: transform .15s ease;
}

.menu-section-fold[open] > summary .menu-section-fold__chevron {
    transform: translateY(-.3rem) rotate(45deg);
}

.menu-section-fold > summary h3 {
    margin: 0;
    flex: 0 1 auto;
}

.menu-section-fold__meta {
    flex: 1 1 auto;
    color: var(--muted);
    font-size: .78rem;
}

.menu-section-tools {
    min-height: 0;
    padding: .2rem .6rem;
    justify-content: flex-start;
    border-bottom: 1px solid var(--line);
    background: var(--surface-soft);
}

.menu-section-tools .compact-editor {
    border: 0;
}

.menu-section-tools .compact-editor > summary {
    min-height: 44px;
    padding: .35rem .5rem;
}

.menu-section-tools .editor-dialog-trigger {
    text-decoration: none;
}

.menu-section-create {
    padding: .5rem 1rem .75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .9rem;
}

.menu-section-create .menu-entry-create {
    border: 0;
}

.menu-section-create > .editor-dialog-trigger {
    padding-inline: .85rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    text-decoration: none;
}

.menu-section-create > .editor-dialog-trigger:hover {
    border-color: var(--green);
}

/* Suchtreffer: [hidden] gewinnt gegen jede Layoutregel der Fachseite */
.menu-admin-section[hidden],
.menu-admin-card[hidden],
.menu-entry-list li[hidden] {
    display: none !important;
}

@media (max-width: 38rem) {
    /* Kennzahlen bleiben auch am Smartphone nebeneinander (Regel 11) */
    .menu-editor-shell .menu-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .menu-editor-shell .menu-summary div {
        padding: .7rem .6rem;
    }

    .menu-editor-shell .menu-summary div + div {
        border-top: 0;
        border-left: 1px solid var(--line);
    }

    .menu-editor-shell .menu-summary strong {
        font-size: 1.2rem;
    }
}

/* ===== Galerie: Raster, ein Bild eine Aktion ============================== */
.gallery-workbench-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
}

.gallery-summary {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.gallery-summary.muted {
    font-weight: 400;
}

.gallery-upload--primary {
    border: 0;
    background: transparent;
}

.gallery-upload--primary > summary.button {
    min-height: 44px;
    padding: .72rem 1rem;
    color: #fff;
    list-style: none;
}

.gallery-upload--primary > form {
    max-width: 48rem;
    margin-top: .75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    background: var(--surface);
}

.gallery-upload--primary select {
    width: 100%;
    margin-bottom: 1rem;
}

.gallery-section-heading__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
}

.gallery-section-heading__actions .compact-editor {
    border: 0;
}

.gallery-shell .gallery-admin-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-shell .gallery-admin-item {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.gallery-shell .gallery-admin-copy {
    min-height: 0;
}

.gallery-admin-badges {
    margin: .5rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.gallery-admin-actions {
    padding: .6rem .8rem .8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border-top: 1px solid var(--line);
}

.gallery-admin-actions .gallery-item-editor {
    border: 0;
}

.gallery-admin-actions > .gallery-item-editor > summary {
    padding: 0;
    min-height: 44px;
}

.gallery-admin-actions .row-menu .gallery-item-editor > summary {
    min-height: 40px;
    padding: .45rem .7rem;
    color: var(--ink);
    font-size: .88rem;
    font-weight: 600;
}

.gallery-admin-actions .row-menu .gallery-item-editor > form {
    padding: .6rem;
}

.gallery-admin-actions .row-menu > div {
    min-width: 15rem;
}

.gallery-admin-actions .row-menu .gallery-trash-form {
    padding: 0;
    border: 0;
}

.gallery-admin-actions .row-menu .gallery-trash-form button {
    color: var(--red);
    text-decoration: none;
}

@media (max-width: 64rem) {
    .gallery-shell .gallery-admin-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 38rem) {
    .gallery-shell .gallery-admin-grid {
        grid-template-columns: 1fr;
    }

    .gallery-workbench-head .button,
    .gallery-upload--primary > summary.button {
        width: 100%;
    }

    .gallery-shell .gallery-section-heading {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-section-heading__actions {
        justify-content: flex-start;
    }
}

/* ===== Veranstaltungen: Serien als eine Zeile, Formular als Schrittfolge === */
.event-row.event-series {
    grid-template-rows: auto auto;
}

.event-series__details {
    grid-column: 1 / -1;
    margin-top: .25rem;
    border-top: 1px solid var(--line);
}

.event-series__details > summary {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--green);
    font-size: .86rem;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.event-series__details > summary::-webkit-details-marker {
    display: none;
}

.event-series__details > summary::before {
    content: "";
    width: .5rem;
    height: .5rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-.1rem) rotate(-45deg);
}

.event-series__details[open] > summary::before {
    transform: translateY(-.25rem) rotate(45deg);
}

.event-series__list {
    margin: 0;
    padding: 0 0 .25rem;
    list-style: none;
}

.event-series__list > li {
    min-height: 52px;
    padding: .4rem 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .5rem .9rem;
    border-top: 1px solid var(--line);
}

.event-series__list > li.is-cancelled {
    color: var(--muted);
}

.event-series__list time {
    min-width: 0;
    display: grid;
    gap: .1rem;
}

.event-series__list time b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.event-series__list time span {
    color: var(--muted);
    font-size: .84rem;
}

.event-series__actions {
    min-width: 0;
    flex-wrap: wrap;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.event-steps {
    padding: .5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-surface);
    background: var(--surface);
}

.event-steps > li {
    grid-template-columns: 1.7rem minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
    row-gap: .1rem;
}

.event-steps > li::before {
    grid-row: 1 / span 2;
    align-self: center;
}

.event-steps > li > a {
    min-height: 0;
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.event-steps > li > a:hover {
    text-decoration: underline;
}

.event-steps > li > small {
    grid-column: 2;
}

.event-form__group + .event-form__group {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--line);
}

.event-form__subheading {
    margin: 0 0 .6rem;
    font: 700 1.05rem "LM Space", sans-serif;
}

.event-form__subnote {
    margin: 0 0 .9rem;
    color: var(--muted);
    font-size: .88rem;
}

.event-form .event-time-grid input[type="time"] {
    width: 100%;
    min-width: 10.5rem;
}

.event-form .event-time-grid input[type="date"] {
    width: 100%;
    min-width: 10.5rem;
}

.event-form .form-actions {
    align-items: center;
}

.form-actions__hint {
    margin: 0;
    color: var(--muted);
    font-size: .86rem;
}

/* Auf dem Terminformular gibt es kein Veröffentlichen; das gehört auf die Liste.
   Der gemeinsame Aktionsbaustein kennt noch keinen Parameter dafür (siehe Bericht). */

@media (max-width: 38rem) {
    .event-series__list > li {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .event-series__actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .event-steps {
        grid-template-columns: 1fr;
    }

    .event-form .event-time-grid input[type="time"],
    .event-form .event-time-grid input[type="date"] {
        min-width: 0;
    }
}

/* ===== Veröffentlichungen und Betrieb ==================================== */
.publication-history-hint {
    max-width: var(--measure-reading);
    margin: calc(-1 * var(--space-2)) 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.profile-completeness {
    margin: 0;
}

.profile-completeness a {
    color: inherit;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .hours-editor .hours-switch input[type="checkbox"],
    .hours-editor .hours-switch input[type="checkbox"]::before,
    .menu-section-fold__chevron {
        transition: none;
    }
}

.event-series__actions .text-button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

@container (max-width: 43rem) {
    .hours-editor .hours-table__head { display: none; }
    .hours-editor .hours-table .hours-day { grid-template-columns: minmax(0, 1fr) auto; }
    .hours-editor .hours-table .hours-windows,
    .hours-editor .hours-table .hours-day__closed-note { grid-column: 1 / -1; }
    .hours-editor .hours-table .time-window { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
    .hours-editor .hours-table .time-window > span { display: none; }
    .hours-editor .hours-table .time-window input[type="time"] { min-width: 0; }
    .hours-editor .hours-table .time-window > div[data-time-boundary] > label {
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 0 .25rem !important;
        overflow: visible !important;
        clip: auto !important;
        white-space: normal !important;
    }
}
