/* ---------------------------------------------------------
// [SIGNATUR]
// Agent: Refactor-Master | Task: H1 – CSS-Auslagerung setup.html
// Datum: 2026-07-23 | Ziel: 400-Zeilen-Regel – 1/9 Dateien bereinigt
// --------------------------------------------------------- */

/* ==================================================================
   SETUP-SCREEN – Zwei-Stufen-Formular (Stammdaten → Sitzplatz-Grid)
   ================================================================== */
.setup-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: calc(2rem + env(safe-area-inset-top, 0px)) calc(1rem + env(safe-area-inset-right, 0px)) calc(2rem + env(safe-area-inset-bottom, 0px)) calc(1rem + env(safe-area-inset-left, 0px));
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    overflow-y: auto;
}

.setup-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 1.5rem;
    padding: 2.5rem 2rem;
    width: 94%;
    max-width: 960px;
    margin: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.setup-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #e2e8f0;
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.setup-card .subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    text-align: center;
    margin: 0 0 2rem 0;
    line-height: 1.5;
}

/* ==============================================================
   STAGE-NAVIGATION (Schritt 1 / Schritt 2)
   ============================================================== */
.stage-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #475569;
    transition: background 0.3s;
}

.stage-dot.active {
    background: #67e8f9;
}

.stage-label {
    color: #94a3b8;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.stage-label strong {
    color: #e2e8f0;
}

/* ==============================================================
   STAGE 1 – STAMMDATEN-FORMULAR
   ============================================================== */

/* --- Responsives 2-Spalten-Grid für kompakte Desktop-Ansicht --- */
.setup-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.setup-grid-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-grid-full {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0;
}

.setup-field-hint {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-top: 0.1rem;
}

.setup-field label {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
}

.setup-field input,
.setup-field select {
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    color: #e2e8f0;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    min-height: 52px;
    box-sizing: border-box;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.setup-field input:focus,
.setup-field select:focus {
    border-color: #67e8f9;
}

.setup-field input::placeholder {
    color: #64748b;
}

/* Zahleneingabe ohne Spinner */
.setup-field input[type="number"]::-webkit-outer-spin-button,
.setup-field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.setup-field input[type="number"] {
    -moz-appearance: textfield;
}

/* Date-Input: konsistentes Styling mit anderen Inputs */
.setup-field select.setup-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border, rgba(255,255,255,0.1));
    border-radius: 8px;
    background: var(--color-surface-alt);
    color: var(--color-text);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.setup-field select.setup-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.setup-field input[type="date"] {
    -webkit-appearance: none;
    min-height: 52px;
}

.setup-field input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
    padding: 0.4rem;
}

.setup-btn {
    background: linear-gradient(135deg, #67e8f9, #22d3ee);
    color: #0f172a;
    border: none;
    border-radius: 0.75rem;
    padding: 0.85rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    -webkit-tap-highlight-color: transparent;
}

.setup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(103, 232, 249, 0.3);
}

.setup-btn:active {
    transform: translateY(0);
}

.setup-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.setup-btn-secondary {
    background: transparent;
    border: 2px solid #475569;
    color: #cbd5e1;
}

.setup-btn-secondary:hover {
    border-color: #67e8f9;
    color: #67e8f9;
    transform: translateY(-2px);
}

.setup-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: #fca5a5;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}

.setup-error.visible {
    display: block;
}

.setup-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(15, 23, 42, 0.3);
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.setup-btn.loading .setup-loader {
    display: inline-block;
}

.setup-btn.loading .setup-btn-text {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.setup-footer {
    margin-top: 1rem;
    text-align: center;
    color: #475569;
    font-size: 0.8rem;
}

.setup-footer .archive-nav-link {
    color: #67e8f9;
    text-decoration: none;
    transition: color 0.2s;
}

.setup-footer .archive-nav-link:hover {
    color: #22d3ee;
    text-decoration: underline;
}

/* Fehler-Fallback (DB-Error) */
.setup-error-db {
    color: #f87171;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* STAGE 2 – SITZPLATZ-GRID (Klassenzimmer-Layout 3×10)         */
/* ============================================================== */
.stage-hidden { display: none !important; }

.grid-summary {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 0.75rem;
}

/* --- Prüfer-Info-Banner (einfach, stabil) --- */
.pult-banner {
    text-align: center;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    margin-top: 16px;
    background-color: #1e293b;
    border-radius: 0.5rem;
    border: 1px solid #334155;
    letter-spacing: 0.03em;
}
.pult-banner #pultPrueferName {
    color: #e2e8f0;
    font-weight: 700;
}

/* --- Modal-Widening für Stage 2 (Setup-Card) --- */
/* Wird via JS-Klasse .stage2-active auf .setup-card gesetzt */
.setup-card.stage2-active {
    max-width: 1100px;
    width: 95vw;
}

/* --- Seat Grid: Multi-Container-Layout mit 3 Reihen --- */
.seat-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #0f172a;
    border-radius: 0.75rem;
}

/* Einzelne Reihe (1–10, 11–20, 21–30) */
.seat-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.seat-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 0.25rem;
}

/* 5 Desk-Pairs pro Reihe horizontal angeordnet */
.seat-row-inner {
    display: flex;
    gap: 14px;
    justify-content: center;
}

/* --- Desk-Pair: Sichtbare Doppeltisch-Karte --- */
.desk-pair {
    display: flex;
    gap: 1px;
    flex: 1;
    max-width: 180px;
    min-width: 0;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 0.75rem;
    padding: 0.4rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Jeder Sitzplatz im Desk-Pair */
.seat-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    flex: 1;
    min-width: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.3rem 0.25rem;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    overflow: hidden;
}

.seat-item .seat-number {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    text-align: center;
    flex-shrink: 0;
}

.seat-item .seat-name-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid #475569;
    color: #e2e8f0;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.15rem 0;
    outline: none;
    font-family: inherit;
    min-height: 42px;
    box-sizing: border-box;
}

.seat-item .seat-name-input:focus {
    border-bottom-color: #67e8f9;
}

.seat-item .seat-name-input::placeholder {
    color: #475569;
}

/* Status-Pills – A/X/P (touch-friendly, größer) */
.seat-status {
    display: flex;
    gap: 3px;
    margin-top: auto;
    width: 100%;
}

.seat-status-btn {
    flex: 1;
    font-size: 0.7rem;
    min-width: 0;
    min-height: 38px;
    padding: 4px 2px;
    border-radius: 9999px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #475569;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    letter-spacing: 0.04em;
    -webkit-tap-highlight-color: transparent;
}

/* A – Anwesend (cyan/teal) */
.seat-status-btn.active {
    color: #5eead4;
    border-color: #5eead4;
    background: rgba(94, 234, 212, 0.15);
}

/* X – Abwesend (red/rose) */
.seat-status-btn.absent {
    color: #f87171;
}

.seat-status-btn.absent.active {
    border-color: #fb7185;
    background: rgba(251, 113, 133, 0.15);
    color: #fb7185;
}

/* P – Passiv (amber/yellow) */
.seat-status-btn.passive {
    color: #a16207;
}

.seat-status-btn.passive.active {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* Farbe am Seat-Item je nach Status */
.seat-item.status-active {
    border-color: #5eead4;
}

.seat-item.status-absent {
    border-color: #fb7185;
    opacity: 0.7;
}

.seat-item.status-passive {
    border-color: #fbbf24;
    opacity: 0.6;
}

/* Button-Reihe Stage 2 */
.seat-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.seat-actions .setup-btn {
    flex: 1;
    margin-top: 0;
}

/* ==============================================================
   RESPONSIVE – TABLET / LANDSCAPE
   ============================================================== */

/* iPad Air/Pro Landscape & größere Tablets (>768px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .setup-card {
        max-width: 95%;
        padding: 1.5rem 1rem;
    }

    .setup-card.stage2-active {
        max-width: 95vw;
    }

    .seat-grid {
        padding: 0.5rem;
        gap: 1rem;
    }

    .seat-row-inner {
        gap: 10px;
    }

    .desk-pair {
        max-width: 160px;
        padding: 0.3rem;
    }

    .seat-item {
        padding: 0.25rem 0.15rem;
    }

    .seat-item .seat-name-input {
        min-height: 36px;
        font-size: 0.7rem;
    }

    .seat-status-btn {
        min-height: 32px;
        font-size: 0.6rem;
    }
}

/* Tablets Portrait / große Phones (480px–767px) */
@media (max-width: 767px) {
    .setup-card {
        max-width: 100%;
        padding: 1rem 0.75rem;
        border-radius: 1rem;
    }

    .setup-card.stage2-active {
        max-width: 100vw;
        width: 100%;
    }

    /* Setup-Grid auf 1 Spalte für mobile Endgeräte */
    .setup-grid-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .setup-grid-col {
        gap: 0.6rem;
    }

    .setup-grid-full {
        gap: 0.4rem;
    }

    .setup-form {
        gap: 0.6rem;
    }

    .seat-grid {
        padding: 0.4rem;
        gap: 0.75rem;
    }

    .seat-row-inner {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .desk-pair {
        max-width: 140px;
        flex: 0 1 auto;
        min-width: 120px;
        padding: 0.3rem;
    }

    .pult-banner {
        margin-bottom: 0.75rem;
    }

    .seat-item {
        padding: 0.2rem 0.15rem;
        border-radius: 0.4rem;
    }

    .seat-item .seat-number {
        font-size: 0.6rem;
    }

    .seat-item .seat-name-input {
        min-height: 34px;
        font-size: 0.7rem;
    }

    .seat-status-btn {
        min-height: 30px;
        font-size: 0.6rem;
    }

    .seat-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Kleine Phones (<480px) */
@media (max-width: 480px) {
    .setup-card {
        padding: 0.75rem 0.5rem;
    }

    .setup-grid-container {
        gap: 0.5rem;
    }

    .setup-grid-col {
        gap: 0.4rem;
    }

    .setup-field {
        gap: 0.25rem;
    }

    .seat-grid {
        padding: 0.3rem;
        gap: 0.5rem;
    }

    .seat-row-inner {
        gap: 6px;
    }

    .desk-pair {
        max-width: 110px;
        min-width: 90px;
        padding: 0.2rem;
    }

    .seat-item {
        padding: 0.15rem 0.1rem;
    }

    .seat-item .seat-name-input {
        min-height: 28px;
        font-size: 0.6rem;
    }

    .seat-status-btn {
        min-height: 26px;
        font-size: 0.55rem;
    }
}

/* ==============================================================
   PHASE 35: TABLET PORTRAIT (768px–900px) – 1-Spalten-Grid
   Sorgt dafür, dass Stage-1-Formular auf Tablets im Hochformat
   volle Breite nutzt und nicht gequetscht wirkt.
   ============================================================== */
@media (min-width: 768px) and (max-width: 900px) {
    .setup-grid-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .setup-grid-col {
        gap: 0.6rem;
    }
    .setup-grid-full {
        gap: 0.4rem;
    }
}

/* ==============================================================
   PHASE 35: LANDSCAPE OPTIMIERUNG (orientation + max-height)
   Alles auf 100vh – kein vertikales Scrollen nötig.
   Behält 2 Spalten bei, reduziert aber alle vertikalen Abstände.
   ============================================================== */
@media (orientation: landscape) and (max-height: 800px) {
    .setup-screen {
        padding: 0.25rem 0.5rem;
        min-height: 100vh;
    }
    .setup-card {
        padding: 0.75rem 1rem;
    }
    .setup-card h1 {
        font-size: 1.25rem;
        margin-bottom: 0.15rem;
    }
    .setup-subtitle {
        display: none;
    }
    .stage-nav {
        margin-bottom: 0.5rem;
    }
    .stage-label {
        margin-bottom: 0.75rem;
    }
    .setup-grid-container {
        gap: 0.4rem;
    }
    .setup-grid-col {
        gap: 0.3rem;
    }
    .setup-field {
        gap: 0.1rem;
        margin-bottom: 0;
    }
    .setup-field label {
        font-size: 0.75rem;
    }
    .setup-field input,
    .setup-field select {
        padding: 0.3rem 0.6rem;
        min-height: 40px;
        font-size: 0.85rem;
    }
    .setup-field input[type="date"] {
        min-height: 42px;
    }
    .setup-form {
        gap: 0.4rem;
    }
    .setup-btn {
        padding: 0.45rem 0.75rem;
        min-height: 2.5rem;
        font-size: 0.95rem;
    }
    .setup-footer {
        margin-top: 0.25rem;
    }

    /* Stage 2 – ebenfalls kompakter im Landscape */
    .setup-card.stage2-active {
        max-width: 1000px;
        padding: 0.5rem;
    }
    .seat-grid {
        padding: 0.3rem;
        gap: 0.5rem;
    }
    .seat-row-inner {
        gap: 6px;
    }
    .desk-pair {
        padding: 0.2rem;
        max-width: 130px;
    }
    .seat-item {
        padding: 0.15rem 0.1rem;
    }
    .seat-item .seat-name-input {
        min-height: 30px;
        font-size: 0.65rem;
    }
    .seat-status-btn {
        min-height: 26px;
        font-size: 0.55rem;
    }
    .pult-banner {
        padding: 0.4rem 0.5rem;
        margin-top: 8px;
        font-size: 0.8rem;
    }
    .seat-actions {
        margin-top: 0.25rem;
        gap: 0.4rem;
    }
}

/* ================================================================ */
/*  PHASE 32: KLASSEN-PILLS / SUGGESTIONS                            */
/* ================================================================ */

.class-suggestions-container {
    display: none;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0;
}

.class-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: #1e293b;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    border: 1px solid transparent;
}

.class-pill:hover {
    background: #334155;
    color: #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.class-pill.active {
    background: #14b8a6;
    color: #0f172a;
    border-color: #2dd4bf;
    box-shadow: 0 0 0 1px #2dd4bf;
}

.class-pill.active:hover {
    background: #0d9488;
    color: #ffffff;
}
