/* ============================================================
   style.css – SKG Buchungssystem 2027
   ============================================================ */

/* ── Reset & Basis ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blau:         #2B4DBB;
    --blau-dunkel:  #1E3A9A;
    --blau-hell:    #EEF2FF;
    --rot:          #B82828;
    --gold:         #E8B800;
    --gold-hell:    #FFFBE6;
    --gold-rand:    #D4A800;
    --gruen:        #1A6E1A;
    --gruen-hell:   #E8F5E8;
    --creme:        #FAF6F0;
    --grau:         #555;
    --rahmen:       #DDD;
    --text:         #222;
}

html { scroll-behavior: smooth; }

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--creme);
    color: var(--text);
    font-size: 15px;           /* ↑ 14 → 15: Basis-Lesbarkeit verbessert */
    padding-bottom: 40px;
}

/* ============================================================
   HAUPT-LAYOUT: Sitzplan (links, ~75 %) + Schnellauswahl (rechts)
   ============================================================ */

#haupt-layout {
    display: flex;
    flex-direction: row;
    gap: 16px;
    max-width: 1200px;
    margin: 16px auto 0;
    align-items: flex-start;
    padding: 0 12px;
}

/* ── Sitzplan-Spalte (linke Seite, flex-order 1) ─────────── */
#saal-spalte {
    order: 1;                          /* visuell links */
    flex: 1 1 0;
    min-width: 0;
    border: 2px solid var(--blau);
    border-radius: 6px;
    overflow-x: clip;                  /* Modul 7: nur horizontal clippen */
    overflow-y: visible;               /* vertikal frei: rotierte Tischenden */
                                       /* müssen aus dem Container herausragen */
                                       /* dürfen, damit alle Plätze anklickbar sind */
    background: #fff;
    box-shadow: 0 2px 8px rgba(43,77,187,.12);
}

.saal-header {
    background: var(--blau);
    color: #fff;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid var(--gold);
    font-weight: bold;
    font-size: .95em;
    letter-spacing: .3px;
    user-select: none;
}

/* ── Schnellauswahl-Spalte (rechte Seite, flex-order 2) ───── */
#qa-spalte {
    order: 2;                          /* visuell rechts */
    flex: 0 0 290px;
    min-width: 260px;
}

/* ── Responsiv: Mobile untereinander ─────────────────────── */
@media (max-width: 820px) {
    #haupt-layout {
        flex-direction: column;
        padding: 0 8px;
    }
    #saal-spalte,
    #qa-spalte {
        order: unset;   /* DOM-Reihenfolge: QA oben, Sitzplan unten */
        flex: none;
        width: 100%;
        min-width: 0;
    }
}

/* ============================================================
   SCHNELLAUSWAHL-PANEL
   ============================================================ */
#qa-container {
    max-width: none;              /* in Spalte: kein eigenes max-width */
    margin: 0;
    border: 2px solid var(--blau);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(43,77,187,.12);
}

.qa-header {
    background: var(--blau);
    color: #fff;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    border-bottom: 3px solid var(--gold);
}
.qa-header:hover { background: var(--blau-dunkel); }

.qa-titel {
    font-weight: bold;
    font-size: .95em;
    letter-spacing: .3px;
}

#qa-pfeil {
    font-size: .75em;
    transition: transform .2s;
}

.qa-body {
    padding: 14px 16px 10px;
}

.qa-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.qa-fg {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qa-fg label {
    font-size: .78em;          /* ↑ .75 → .78 */
    font-weight: bold;
    color: var(--grau);
    white-space: nowrap;
}

.qa-fg select,
.qa-fg input[type=number] {
    padding: 7px 10px;
    border: 1px solid var(--rahmen);
    border-radius: 4px;
    font-size: .9em;
    font-family: inherit;
    background: #fff;
}
.qa-fg select:focus,
.qa-fg input[type=number]:focus {
    outline: 2px solid var(--blau);
    border-color: var(--blau);
}

/* Stepper-Eingabe */
.qa-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--rahmen);
    border-radius: 4px;
    overflow: hidden;
}
.qa-stepper input[type=number] {
    border: none;
    border-radius: 0;
    width: 58px;
    text-align: center;
    padding: 7px 4px;
    -moz-appearance: textfield;
}
.qa-stepper input[type=number]::-webkit-outer-spin-button,
.qa-stepper input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.qa-stepper input[type=number]:focus { outline: none; background: var(--blau-hell); }

.qa-step {
    width: 32px;
    height: 34px;
    background: var(--blau-hell);
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--blau);
    transition: background .1s;
    flex-shrink: 0;
}
.qa-step:hover  { background: #c5d0f8; }
.qa-step:active { background: var(--blau); color: #fff; }

.qa-label-hint {
    font-size: .75em;          /* ↑ .72 → .75 */
    color: var(--grau);
    font-weight: normal;
}

/* Multi-Select Tischauswahl */
.qa-multiselect {
    min-width: 160px;
    padding: 4px 6px;
    border: 1px solid var(--rahmen);
    border-radius: 4px;
    font-size: .88em;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}
.qa-multiselect:focus { outline: 2px solid var(--blau); }
.qa-multiselect option { padding: 2px 4px; }
.qa-multiselect option:checked { background: var(--blau-hell); color: var(--blau); font-weight: bold; }

/* Vorschlag-Button */
.qa-fg-btn { justify-content: flex-end; }
#qa-btn {
    background: var(--blau);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: .9em;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s;
}
#qa-btn:hover    { background: var(--blau-dunkel); }
#qa-btn:disabled { background: #aaa; cursor: not-allowed; }

/* Meldungszeile */
.qa-meldung {
    font-size: .87em;          /* ↑ .84 → .87 */
    min-height: 1.4em;
    padding: 5px 0 2px;
    border-radius: 3px;
}
.qa-meldung.qa-ok  { color: var(--gruen); font-weight: bold; }
.qa-meldung.qa-err { color: var(--rot);   font-weight: bold; }

/* Hinweistext */
.qa-hinweis {
    font-size: .8em;           /* ↑ .77 → .80 */
    color: var(--grau);
    line-height: 1.5;
    padding-top: 4px;
    border-top: 1px dashed var(--rahmen);
    margin-top: 6px;
}

/* ============================================================
   SAAL-CONTAINER (innerhalb #saal-spalte)
   ============================================================ */
#saal-container {
    max-width: none;           /* kein eigenes max-width in der Spalte */
    margin: 0;
    padding: 14px 12px;
    background: #fff;
    border: none;              /* Rahmen kommt von #saal-spalte */
    border-radius: 0;
    box-shadow: none;
}

/* ── Bühne / Ausgang ────────────────────────────────────── */
.buehne, .ausgang {
    text-align: center;
    font-weight: bold;
    letter-spacing: 3px;
    font-size: .88em;          /* ↑ .85 → .88 */
    padding: 7px 16px;
    border-radius: 4px;
    margin-bottom: 14px;
    border: 2px solid var(--gold);
    background: var(--gold-hell);
    color: #6b5400;
}
.ausgang {
    margin-top: 14px;
    margin-bottom: 0;
    text-align: right;
}

/* ── Kategorie-Bereich ──────────────────────────────────── */
.kategorie-bereich {
    margin-bottom: 14px;
}

.kat-label {
    background: #4a7c4e;
    color: #fff;
    font-size: .82em;          /* ↑ .75 → .82: besser lesbar */
    font-weight: bold;
    letter-spacing: .5px;
    padding: 3px 10px;
    margin-bottom: 8px;
    border-radius: 3px;
}

/* ── Tische-Reihe ───────────────────────────────────────── */
.tische-reihe {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    justify-content: center;
    /* Modul 7: Padding-bottom gibt rotierten Tischenden Platz im Scroll-Container.
     * sin(14°) × Tischhöhe (~300px) ≈ 73px — 40px reichen da die äußeren
     * Tische nur am Rand stark rotiert sind. */
    padding: 10px 8px 40px;
}

/* ── Modul 7: Schräge Außentische ───────────────────────── */
/*
 * Drehpunkt: 50% 0% = Bühnenkopf (oberes Ende = bühnennächste Seite).
 * Damit bleiben die Bühnenenden nah beieinander;
 * die Ausgangsenden spreizen sich nach außen — wie im echten Saalplan.
 *
 * Desktop (≥820px): volle Winkel 14° / 9° / 4°
 * Mobile  (<820px):  reduzierte Winkel 8° / 5° / 2° — Rotation sichtbar,
 *                    alle Plätze bleiben im Scroll-Container anwählbar.
 */
.tisch.schraeg-l-3 { transform: rotate(14deg); transform-origin: 50% 0%; }
.tisch.schraeg-l-2 { transform: rotate(9deg);  transform-origin: 50% 0%; }
.tisch.schraeg-l-1 { transform: rotate(4deg);  transform-origin: 50% 0%; }
.tisch.schraeg-r-1 { transform: rotate(-4deg);   transform-origin: 50% 0%; }
.tisch.schraeg-r-2 { transform: rotate(-9deg);   transform-origin: 50% 0%; }
.tisch.schraeg-r-3 { transform: rotate(-14deg);  transform-origin: 50% 0%; }
@media (max-width: 820px) {
    .tisch.schraeg-l-3 { transform: rotate(8deg);  transform-origin: 50% 0%; }
    .tisch.schraeg-l-2 { transform: rotate(5deg);  transform-origin: 50% 0%; }
    .tisch.schraeg-l-1 { transform: rotate(2deg);  transform-origin: 50% 0%; }
    .tisch.schraeg-r-1 { transform: rotate(-2deg); transform-origin: 50% 0%; }
    .tisch.schraeg-r-2 { transform: rotate(-5deg); transform-origin: 50% 0%; }
    .tisch.schraeg-r-3 { transform: rotate(-8deg); transform-origin: 50% 0%; }
    /* Weniger Padding nötig da kleinere Winkel: sin(8°)×300px ≈ 42px */
    .tische-reihe { padding-bottom: 24px; padding-left:60px; }
}

/* ── Einzelner Tisch ────────────────────────────────────── */
.tisch {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.tisch-nr {
    font-size: .85em;          /* ↑ .72 → .85: Tischnummern deutlich lesbarer */
    font-weight: bold;
    color: var(--blau);
    margin-bottom: 3px;
    white-space: nowrap;
}

.tisch-seiten {
    display: flex;
    gap: 3px;
}

.seite {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* ── Einzelner Platz ─────────────────────────────────────── */
.platz {
    width: 20px;               /* ↑ 18 → 20: etwas größere Klickfläche */
    height: 20px;
    border: 1px solid #bbb;
    border-radius: 2px;
    cursor: pointer;
    transition: background .1s, border-color .1s, transform .1s;
    flex-shrink: 0;
}

/* Zustände */
.platz.frei {
    background: #fff;
    border-color: #bbb;
}
.platz.frei:hover {
    background: var(--blau-hell);
    border-color: var(--blau);
    transform: scale(1.2);
    z-index: 1;
}

.platz.reserviert {
    background: #FFF3CD;
    border-color: #856404;
    cursor: not-allowed;
}

.platz.verkauft {
    background: #333;
    border-color: #111;
    cursor: not-allowed;
}

.platz.auswahl {
    background: var(--blau);
    border-color: var(--blau-dunkel);
    cursor: pointer;
}
.platz.auswahl:hover {
    background: var(--blau-dunkel);
    transform: scale(1.15);
}

.platz.vorschlag {
    background: var(--gold);
    border-color: var(--gold-rand);
    animation: vorschlag-pulse 1.5s ease-in-out 3;
}
.platz.vorschlag:hover {
    background: var(--gold-rand);
    transform: scale(1.15);
}

@keyframes vorschlag-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(232,184,0,.6); }
    50%  { box-shadow: 0 0 0 5px rgba(232,184,0,0); }
    100% { box-shadow: 0 0 0 0 rgba(232,184,0,0); }
}

/* ============================================================
   WARENKORB  (lebt innerhalb #qa-spalte, unterhalb Schnellauswahl)
   ============================================================ */
.warenkorb {
    margin-top: 16px;          /* Abstand zur Schnellauswahl darüber */
    background: #fff;
    border: 2px solid var(--blau);
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(43,77,187,.12);
}
.warenkorb.versteckt { display: none; }

.warenkorb h2 {
    color: var(--blau);
    font-size: .95em;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--gold);
    padding-bottom: 6px;
    margin-bottom: 10px;
}

#wk-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: .9em;           /* ↑ .88 → .90 */
    margin-bottom: 12px;
}
#wk-tabelle th {
    background: var(--blau);
    color: #fff;
    padding: 6px 10px;
    text-align: left;
}
#wk-tabelle td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--rahmen);
}

.btn-entfernen {
    background: none;
    border: 1px solid var(--rot);
    color: var(--rot);
    border-radius: 3px;
    cursor: pointer;
    padding: 1px 6px;
    font-size: .85em;
    line-height: 1.4;
}
.btn-entfernen:hover { background: var(--rot); color: #fff; }

#wk-weiter {
    background: var(--gruen);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 22px;
    font-size: .95em;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    transition: background .12s;
    margin-bottom: 6px;
}
#wk-weiter:hover    { background: #145414; }
#wk-weiter:disabled { background: #aaa; cursor: not-allowed; }

#wk-reset {
    background: transparent;
    color: var(--rot);
    border: 1px solid var(--rot);
    border-radius: 4px;
    padding: 7px 16px;
    font-size: .84em;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    transition: all .12s;
}
#wk-reset:hover { background: var(--rot); color: #fff; }

/* ============================================================
   LEGENDE
   ============================================================ */
.legende {
    max-width: 1200px;
    margin: 8px auto 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: .84em;          /* ↑ .80 → .84 */
    color: var(--grau);
    padding: 0 16px;
}

.legende-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legende-item .platz {
    width: 14px;
    height: 14px;
    cursor: default;
    pointer-events: none;
}
.legende-item .platz:hover { transform: none; }

/* ── Feldfehler ──────────────────────────────────────────── */
.feld-fehler {
    display: block;
    color: var(--rot);
    font-size: .83em;
    margin-top: 3px;
}

/* ============================================================
   RESPONSIVE: kleine Screens
   ============================================================ */
@media (max-width: 480px) {
    .platz {
        width: 17px;           /* ↑ 15 → 17 */
        height: 17px;
    }
    .tisch-nr {
        font-size: .76em;      /* ↑ .65 → .76 */
    }
    #saal-container {
        padding: 10px 6px;
    }
    .qa-controls {
        gap: 8px;
    }
    #qa-btn {
        width: 100%;
        justify-content: center;
    }
}
