/* ==========================================================================
   Orga-Bereich: schlichte Arbeitsoberfläche über den Bausteinen aus app.css.
   Dunkle Seitenleiste (Logo, Festival, Menü), helle Leiste oben, ruhige weiße Flächen –
   ohne Graffiti-Hintergrund, gerissene Ränder und Pinselstriche der Website.
   ========================================================================== */

:root {
    /* Markenfarben (auf der Website aus dem generierten theme.css) */
    --juf-orange: #ff5a1a;
    --juf-yellow: #ffd400;
    --juf-green: #33bb45;
    --juf-blue: #1690e6;
    --juf-sky: #33c3f1;
    --juf-red: #d92d20;
    --juf-ink: #1d2a3a;
    --juf-white: #fff;

    --backend-bg: #f3f4f7;
    --backend-sidebar: #1d2a3a;
    --backend-sidebar-text: #dfe4ec;
    --backend-sidebar-muted: #8f9bad;
    --backend-line: #dfe2e8;
    --backend-radius: 8px;
    --backend-sidebar-width: 250px;
    --color-border: var(--backend-line);
}

body.page-backend { display: block; background: var(--backend-bg); }

/* Gerüst --------------------------------------------------------------------- */

.backend-shell { display: grid; grid-template-columns: var(--backend-sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.backend-content { display: flex; flex-direction: column; min-width: 0; }
.backend-main { flex: 1; width: 100%; max-width: 1320px; padding: 1.5rem 2rem 3rem; }
.backend-main--plain { max-width: 1100px; margin-inline: auto; }
.backend-main--plain > .container--form { background: #fff; border: 1px solid var(--backend-line); border-radius: var(--backend-radius); padding: 1.75rem 2rem; margin-top: 2rem; }

/* Seitenleiste */
.backend-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--backend-sidebar); color: var(--backend-sidebar-text); padding: 1rem .9rem 2rem; }
.backend-sidebar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.backend-sidebar__menu-button { display: none; }
.backend-sidebar .logo { transform: none; padding: 0; }
.backend-sidebar .logo__sub { color: #fff; }

.backend-sidebar .side-nav__link,
.backend-sidebar .side-nav__sublink { color: var(--backend-sidebar-text); border-radius: 6px; }
.backend-sidebar .side-nav__link { padding: .42rem .7rem; font-weight: 500; }
.backend-sidebar .side-nav__link:hover,
.backend-sidebar .side-nav__sublink:hover { color: #fff; background: rgb(255 255 255 / 7%); }
.backend-sidebar .side-nav__link.is-active { color: #fff; font-weight: 700; background: rgb(255 255 255 / 10%); box-shadow: inset 3px 0 0 var(--juf-orange); }
.backend-sidebar .side-nav__sub { border-left-color: rgb(255 255 255 / 14%); }
.backend-sidebar .side-nav__sublink.is-active { color: var(--juf-yellow); background: none; }
.backend-sidebar .side-nav__sublink--settings { color: var(--backend-sidebar-muted); }
.backend-sidebar .side-nav__section { color: var(--backend-sidebar-muted); margin: 1.2rem 0 .35rem .7rem; }

/* Bausteine der Module in der Seitenleiste */
.backend-sidebar .festival-switch { background: rgb(255 255 255 / 6%); border-radius: var(--backend-radius); }
.backend-sidebar .festival-switch__label,
.backend-sidebar .festival-switch__dates,
.backend-sidebar .festival-switch--empty { color: var(--backend-sidebar-muted); }
.backend-sidebar .festival-switch .field__input { border: 0; background: #fff; color: var(--color-text); border-radius: 6px; }
.backend-sidebar .live-mode-link { border-radius: var(--backend-radius); background: rgb(255 255 255 / 6%); border: 1px solid rgb(255 255 255 / 12%); }
.backend-sidebar .live-mode-link:hover { background: var(--juf-orange); border-color: var(--juf-orange); }

/* Leiste oben */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-end; gap: 1rem; min-height: 3.25rem; padding: .4rem 2rem; background: #fff; border-bottom: 1px solid var(--backend-line); }
.topbar--plain { justify-content: space-between; background: var(--backend-sidebar); border-bottom: 0; }
.topbar--plain .logo { transform: none; padding: 0; }
.topbar--plain .topbar__link { color: var(--backend-sidebar-text); }
.topbar__nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.topbar__link { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .65rem; border-radius: 6px; color: var(--color-text); text-decoration: none; font-size: .92rem; }
.topbar__link:hover { color: var(--color-text); background: var(--color-bg-soft); }
.topbar--plain .topbar__link:hover { color: #fff; background: rgb(255 255 255 / 8%); }
.topbar__button { border: 0; background: none; font: inherit; font-size: .92rem; cursor: pointer; }
.topbar__user { font-weight: 600; }
.topbar__avatar { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--juf-orange); color: #fff; font-size: .8rem; font-weight: 700; }

/* Inhalt --------------------------------------------------------------------- */

.page-backend h1 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); letter-spacing: .03em; }
.page-backend h2 { font-size: 1.35rem; }
.page-backend .page-header h1 { transform: none; font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.page-backend .page-header .lead { margin: 0; padding: 0; color: var(--color-muted); font-weight: 400; transform: none; }

/* Flächen und Rahmen: 1px grau statt Verlaufsrahmen */
.page-backend :is(.card, .tile, .panel, .stat, .choice, .table-wrap, .pagination__link, .block-editor__item, .media-item, .mail-body, .stand-row, .empty-state, .timeline__item) {
    border: 1px solid var(--backend-line);
    border-radius: var(--backend-radius);
    background: var(--surface, #fff);
}
.page-backend .panel { --surface: #fff; }
.page-backend :is(.card, .stat, a.tile):hover { transform: none; }
.page-backend .card:hover { box-shadow: 0 4px 14px rgb(0 0 0 / 8%); }
.page-backend .table-wrap { overflow-x: auto; }
.page-backend .table th { background: #f7f8fa; }

/* Bunte Schriftzüge der Website hier ruhig */
.page-backend :is(.title-gradient, .card__title, .post-row__title) { color: var(--color-text); background: none; filter: none; letter-spacing: .04em; }
.page-backend :is(.brush, .section > h2, .section__header h2, .block-text > h2, .block-gallery > h2) { transform: none; }
.page-backend :is(.section > h2, .section__header h2, .block-text > h2, .block-gallery > h2) { padding: 0; color: var(--color-text); }
.page-backend :is(.section > h2, .section__header h2, .block-text > h2, .block-gallery > h2)::before { display: none; }
.page-backend .brush { padding: .2em .6em; }
.page-backend .brush::before { inset: 0; border-radius: 4px; transform: none; -webkit-mask: none; mask: none; }
.page-backend .badge { transform: none; border-radius: 4px; }

/* Felder */
.page-backend .field__input { border: 1px solid #cfd4dc; border-radius: 6px; background: #fff; }
.page-backend .field__input:focus { border-color: var(--color-primary); }

/* Knöpfe: flach, ohne gerissenen Rand */
.page-backend .button {
    --pad-y: .45rem; --pad-x: .95rem;
    padding: var(--pad-y) var(--pad-x);
    border: 1px solid transparent; border-image: none; border-radius: 6px;
    background: var(--color-primary); color: #fff;
    font-family: var(--font); font-weight: 600; text-transform: none; letter-spacing: 0;
}
.page-backend .button:hover { background: var(--color-primary-dark); color: #fff; }
body.page-backend .button:not(.button--ghost), body.page-backend .button:not(.button--ghost):is(:hover, :active) { transform: none; filter: none; }
.page-backend :is(.button--ghost, .button--secondary, .button--inverted),
.page-backend :is(.sheet, .main > .container:not(.container--plain), .with-sidebar__content, .sidebar, .inline-dialog, .backend-main) .button:is(.button--secondary, .button--inverted) {
    padding: var(--pad-y) var(--pad-x);
    border: 1px solid #cfd4dc; background: #fff; color: var(--color-text);
}
.page-backend :is(.button--ghost, .button--secondary, .button--inverted):hover { background: var(--color-bg-soft); color: var(--color-text); }
.page-backend .button.button--danger,
.page-backend :is(.sheet, .with-sidebar__content, .inline-dialog, .backend-main) .button.button--danger { padding: var(--pad-y) var(--pad-x); border: 1px solid #f2c2bd; background: #fff; color: var(--color-danger); }
.page-backend .button.button--danger:hover { background: #fdecea; color: var(--color-danger); }
.page-backend .button--small { --pad-y: .22rem; --pad-x: .6rem; font-size: .84rem; }
.page-backend .button--large { --pad-y: .6rem; --pad-x: 1.3rem; font-size: 1.05rem; }

/* Reiter */
.page-backend .tabs { border-bottom: 1px solid var(--backend-line); border-image: none; }
.page-backend .tabs__link { font-family: var(--font); font-weight: 600; text-transform: none; }
.page-backend .tabs__link.is-active { color: var(--color-text); box-shadow: inset 0 -3px 0 var(--color-primary); }
.page-backend .tabs__link.is-active::after { display: none; }
.page-backend .admin-tabs { background: #fff; border: 1px solid var(--backend-line); border-radius: var(--backend-radius); padding: .25rem .4rem 0; }

/* Schmale Bildschirme: Seitenleiste wird zur Kopfzeile, Menü klappt auf ---------- */

@media (max-width: 900px) {
    .backend-shell { grid-template-columns: 1fr; }
    .backend-sidebar { position: sticky; top: 0; z-index: 60; height: auto; max-height: 100vh; padding: .6rem 1rem; }
    .backend-sidebar__head { margin: 0; }
    .backend-sidebar__menu-button { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border: 1px solid rgb(255 255 255 / 25%); border-radius: 6px; color: #fff; cursor: pointer; font-weight: 600; }
    .backend-sidebar__menu-button::before { content: "☰"; }
    .backend-sidebar__body { display: none; padding-top: 1rem; }
    .backend-shell__toggle:checked ~ .backend-sidebar .backend-sidebar__body { display: block; }
    .backend-shell__toggle:focus-visible ~ .backend-sidebar .backend-sidebar__menu-button { outline: 3px solid var(--juf-yellow); }
    .topbar { position: static; padding: .4rem 1rem; }
    .backend-main { padding: 1rem 1rem 2.5rem; }
}
