/**
 * SITZPLAN-EINTEILUNG — Layout nur dieses Moduls.
 * Schrift/Skalierung/Header kommen global aus global/ui. Der Tisch selbst
 * (Aussehen + Bedien-Optik der `.st-*`-Klassen) kommt global aus
 * global/werkzeuge/elements/seattable/. Hier lebt NUR das Drumherum: Seite,
 * freie Fläche, Tafel-Hinweis und die Tisch-Leiste.
 *
 * Body-margin/padding NICHT setzen (Header-Reset ist global).
 *
 * Aufbau: Flex-Spalte über die volle Viewport-Höhe — Kopfzeile oben, große
 * freie Fläche (.sp-area, flex:1) in der Mitte, Tisch-Leiste (.sp-tray) unten.
 */

/* Volle Höhe, kein Scrollen — wie quizfussball-wettkampf. */
html, body { height: 100%; }
body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #eef2f1;
}
.header { flex: 0 0 auto; }

.sp-page {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: clamp(8px, 1.4vh, 14px);
    gap: clamp(8px, 1.4vh, 14px);
    box-sizing: border-box;
}

/* ---- Freie Fläche (der Raum) -------------------------------------------- */
.sp-area {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    /* feines Raster als Orientierung im sonst weißen Raum */
    background-color: #ffffff;
    background-image:
        repeating-linear-gradient(0deg, #e7eeec 0 1px, transparent 1px 28px),
        repeating-linear-gradient(90deg, #e7eeec 0 1px, transparent 1px 28px);
    border: 2px solid #d6e0dd;
    border-radius: 16px;
    touch-action: none;
}

/* Rückgängig / Wiederholen — oben links in der Fläche. */
.sp-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    gap: 6px;
    z-index: 80;
}
/* Undo/Redo im gleichen Stil wie die Header-Buttons (.nav-control):
   blauer Knopf mit 3D-Schatten, beim Drücken sackt er ein. */
.sp-tool-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--blue-main, #3498db);
    color: #ffffff;
    font-size: 21px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #2980b9;
    transition: transform 0.1s, box-shadow 0.1s;
}
.sp-tool-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.sp-tool-btn:disabled { opacity: 0.4; cursor: default; box-shadow: 0 4px 0 #9fb4c4; }

/* ×-Knopf der Mehrfach-Auswahl — löscht alle ausgewählten Tische auf einmal.
   Optik wie das Tisch-× (.st-del-table), sitzt an der Hülle der Auswahl. */
#sp-seldel, #sp-selrot {
    position: absolute;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
    color: white;
    font-size: 19px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 85;
}
#sp-seldel { background: #e74c3c; }            /* Auswahl löschen (×) */
/* Auswahl drehen (↻) — wie der Einzel-Dreh-Griff .st-handle-rotate (grün). */
#sp-selrot { background: #16a085; cursor: grab; touch-action: none; }

/* Aufzieh-Rechteck der Mehrfach-Auswahl. */
.sp-marquee {
    position: absolute;
    border: 2px dashed #16a085;
    background: rgba(22, 160, 133, 0.12);
    z-index: 70;
    pointer-events: none;
}

/* "Tafel/Front" zur Orientierung — nicht interaktiv. Breit wie eine echte Tafel. */
.sp-front {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: min(58%, 680px);
    box-sizing: border-box;
    background: #2c3e50;
    color: white;
    font-family: var(--ui-font, sans-serif);
    font-weight: 800;
    font-size: clamp(12px, 1.6vh, 16px);
    letter-spacing: 2px;
    text-align: center;
    padding: 5px 28px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0.9;
}

/* ---- Tisch-Leiste unten ------------------------------------------------- */
.sp-tray {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 22px);
    padding: clamp(8px, 1.2vh, 14px) clamp(12px, 2vw, 22px);
    background: #ffffff;
    border: 2px solid #d6e0dd;
    border-radius: 16px;
    overflow-x: auto;
}
.sp-tray-hint {
    font-family: var(--ui-font, sans-serif);
    font-weight: 700;
    color: #5b6b67;
    font-size: clamp(13px, 1.7vh, 16px);
    white-space: nowrap;
}

.sp-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 12px;
    background: #f4f7f6;
    border: 2px solid #d6e0dd;
    cursor: grab;
    touch-action: none;
    user-select: none;
    flex: 0 0 auto;
}
.sp-tool:hover { background: #eaf5f2; border-color: #16a085; }
.sp-tool:active { cursor: grabbing; }

/* Mini-Vorschau des Tisches (Holz-Rechteck, eckig wie die echten Tische) */
.sp-tool-prev {
    background: linear-gradient(#fdf6e9, #f3e6cf);
    border: 2px solid #c8a36a;
    border-radius: 0;
}
.sp-prev-einzel { width: 34px; height: 24px; }
.sp-prev-doppel { width: 58px; height: 24px; }
.sp-prev-vierer { width: 58px; height: 42px; }

.sp-tool-label {
    font-family: var(--ui-font, sans-serif);
    font-weight: 800;
    color: #2c3e50;
    font-size: clamp(12px, 1.6vh, 15px);
    white-space: nowrap;
}

/* ---- Drucken ------------------------------------------------------------ */
@media print {
    .header, .sp-tray, .sp-front, .sp-toolbar, .sp-marquee, #sp-seldel, #sp-selrot,
    .st-handle, .st-add, .st-del-table, .st-del-chair {
        display: none !important;
    }
    .main-container { visibility: visible !important; }
    body { background: white; }
    .sp-page { padding: 0; }
    .sp-area {
        border: none;
        background: white;
        overflow: visible;
    }
}
