@import url('./design-tokens.css');

/* =============================================================================
   BRAIN SCENE STYLES (brain-scene.css)
   =============================================================================
   Brain-3D-Szene-spezifische Styles, extrahiert aus brain.css (2026-02 Cleanup).
   Nur für das Brain-Fenster (scene_brain.js / brain-scene.html).

   Enthält:
   - #brain-canvas — 3D-Canvas
   - #brain-buttons — Steuerungsleiste (Footer)
   - #brain-info-box — Info-Tabelle (nur Vollbild)
   - #audio-guide-image — Audio-Guide-Bild (nur Vollbild)
   - #scan-status, #sector-status — Scan-Anzeigen
   - #scan-results-popup — Scan-Ergebnisse
   - .click-popup — Klick-Info-Popup
   ============================================================================= */

/* ── Fullscreen Canvas Optimierung ────────────────────────────────────────── */

.base-window.fullscreen #brain-canvas,
.base-window:fullscreen #brain-canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
}

/* ── Brain Canvas ─────────────────────────────────────────────────────────── */

#brain-canvas {
    flex: 1; /* Füllt den restlichen Raum des Flex-Containers */
    background: transparent;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    padding: 0;
    display: block; /* Verhindert Inline-Lücken */
}

.brain-content[style*="display: block"] #brain-canvas {
    visibility: visible;
}

/* ── Brain Buttons (Footer-Leiste) ────────────────────────────────────────── */

#brain-buttons {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 3px;
    padding-left: 5px;
    padding-right: 5px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid #00bfff;
    position: absolute;
    bottom: 0; /* Füllt bis zum Ende des Inhalts */
    height: 30px;
    width: 100%;
    visibility: visible;
    opacity: 1;
    z-index: 10;
    flex-shrink: 0; /* Verhindert Schrumpfen */
}

/* ── Audio-Guide-Bild (nur Vollbild) ──────────────────────────────────────── */

#audio-guide-image {
    position: absolute;
    bottom: 80px;
    left: 10px;
    height: 164px;
    width: auto;
    z-index: 12;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: none; /* Standard: ausgeblendet */
}

/* Audio-Guide-Bild nur im Vollbildmodus anzeigen */
.base-window.fullscreen #audio-guide-image,
.base-window:fullscreen #audio-guide-image {
    display: block;
}

#audio-guide-image:hover {
    transform: scale(1.20);
}

/* ── Brain Info Box (nur Vollbild) ─────────────────────────────────────────── */

#brain-info-box {
    position: absolute;
    left: 10px;
    top: 180px;
    width: 260px; /* Angepasst an Karten ohne Neigung */
    max-height: 70vh;
    background: linear-gradient(135deg, rgba(20, 30, 50, 0.96), rgba(15, 22, 38, 0.94));
    color: #ffffff;
    padding: 0;
    border-radius: var(--radius-md);
    z-index: 13;
    font-family: var(--font-sans, sans-serif);
    font-size: 10px;
    box-shadow: 0 8px 32px rgba(40, 80, 140, 0.4),
                0 0 60px rgba(60, 110, 180, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: none; /* Standard: ausgeblendet */
    border: 1px solid rgba(80, 140, 200, 0.4);
    backdrop-filter: blur(var(--glass-blur-md));
    overflow-y: auto;
    overflow-x: hidden;
}

/* Brain Info Box nur im Vollbildmodus anzeigen */
.base-window.fullscreen #brain-info-box,
.base-window:fullscreen #brain-info-box {
    display: block !important;
    border: 1px solid rgba(0, 255, 255, 0.5);
    transition: opacity 0.5s ease;
    resize: both;
    min-width: 300px;
    min-height: 200px;
    max-width: 80vw;
    max-height: 80vh;
    overflow: auto;
}

/* ── Brain Info Box — Tabelle ─────────────────────────────────────────────── */

#brain-info-box table {
    width: 100%;
    border-collapse: collapse;
    color: #ffffff;
    font-size: 9px;
    table-layout: fixed; /* Fixed layout for consistent column widths */
}

#brain-info-box thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(0, 0, 0, 0.9); /* Solid background for sticky header */
}

#brain-info-box th {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.4), rgba(0, 0, 255, 0.4));
    padding: 8px 6px;
    border-bottom: 1px solid rgba(0, 191, 255, 0.5);
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: #ffffff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5), inset 0 0 10px rgba(0, 255, 255, 0.3);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#brain-info-box th:hover {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7), inset 0 0 12px rgba(0, 255, 255, 0.4);
    transform: scale(1.01);
}

/* Column widths - optimized for content */
#brain-info-box th:nth-child(1),
#brain-info-box td:nth-child(1) {
    width: 15%;
}

#brain-info-box th:nth-child(2),
#brain-info-box td:nth-child(2) {
    width: 18%;
}

#brain-info-box th:nth-child(3),
#brain-info-box td:nth-child(3) {
    width: 30%;
}

#brain-info-box th:nth-child(4),
#brain-info-box td:nth-child(4) {
    width: 30%;
}

#brain-info-box th:nth-child(5),
#brain-info-box td:nth-child(5) {
    width: 7%;
    text-align: center;
}

#brain-info-box td {
    padding: 6px;
    border-bottom: 1px solid rgba(0, 191, 255, 0.2);
    word-wrap: break-word;
    color: #ffffff;
    font-size: 11px;
    line-height: 1.3;
    vertical-align: top;
}

#brain-info-box tbody tr {
    transition: background 0.15s ease;
}

#brain-info-box tbody tr:hover {
    background: rgba(0, 191, 255, 0.08);
}

#brain-info-box td:nth-child(1) {
    font-weight: 600;
    white-space: nowrap;
}

#brain-info-box td:nth-child(2) {
    font-weight: 500;
}

#brain-info-box td:nth-child(3),
#brain-info-box td:nth-child(4) {
    white-space: normal;
    overflow: hidden;
}

#brain-info-box .functionalities {
    margin: 0;
    padding: 0;
    text-align: left;
    line-height: 1.4;
    font-size: 10px;
}

#brain-info-box td:nth-child(5) {
    text-align: center;
    vertical-align: middle;
}

#brain-info-box td:nth-child(5) button {
    padding: 4px 8px;
    font-size: 9px;
    color: #ffffff;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid #00ffff;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#brain-info-box td:nth-child(5) button:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    transform: scale(1.05);
}

/* ── Brain Info Box — Region-Farben ───────────────────────────────────────── */

#brain-info-box tr[data-name="Frontal_Lobe"] td:nth-child(1) {
    background: rgba(255, 0, 0, 0.2);
}
#brain-info-box tr[data-name="Parietal_Lobe"] td:nth-child(1) {
    background: rgba(255, 255, 0, 0.2);
}
#brain-info-box tr[data-name="Occipital_Lobe"] td:nth-child(1) {
    background: rgba(0, 0, 255, 0.2);
}
#brain-info-box tr[data-name="Temporal_Lobe"] td:nth-child(1) {
    background: rgba(0, 255, 0, 0.2);
}
#brain-info-box tr[data-name="Brainstem"] td:nth-child(1) {
    background: rgba(255, 165, 0, 0.2);
}
#brain-info-box tr[data-name="Cerebellum"] td:nth-child(1) {
    background: rgba(238, 130, 238, 0.2);
}

#brain-info-box tr:nth-child(even) {
    background: rgba(0, 255, 255, 0.05);
}

#brain-info-box tr:hover {
    background: rgba(0, 255, 255, 0.15);
    cursor: pointer;
    transition: background 0.2s ease;
}

#brain-info-box > div[style*="animation: shimmer"] {
    pointer-events: none;
}

#brain-info-box tr:hover td {
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
}

/* ── Scan-Status ──────────────────────────────────────────────────────────── */

#scan-status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    font-family: var(--font-sans, sans-serif);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    z-index: 14;
    display: none;
}

/* Scan-Status im Vollbildmodus */
.base-window.fullscreen #scan-status {
    font-size: 20px; /* Größere Schrift im Vollbildmodus */
}

/* ── Sector-Status ────────────────────────────────────────────────────────── */

#sector-status {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 8px;
    font-family: var(--font-sans, sans-serif);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    z-index: 14;
    display: none;
}

/* Sector-Status im Vollbildmodus */
.base-window.fullscreen #sector-status {
    font-size: 16px; /* Größere Schrift im Vollbildmodus */
}

/* ── Scan-Results-Popup ───────────────────────────────────────────────────── */

#scan-results-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(4, 155, 248, 0.3);
    z-index: var(--z-dropdown);
    font-family: var(--font-sans, sans-serif);
    text-align: center;
    font-size: 14px;
    transition: opacity 1s ease-out;
    opacity: 0;
}

.scan-results-title {
    font-size: 16px;
    margin-bottom: 10px;
    color: white;
}

.scan-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8px;
    color: white;
}

.scan-results-table th {
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding: 5px;
}

/* ── Click-Popup ──────────────────────────────────────────────────────────── */

.click-popup {
    position: absolute;
    bottom: 50px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    border-radius: 5px;
    z-index: 11;
    font-size: 10px;
}

/* ── Responsive Anpassungen (Brain-Scene) ─────────────────────────────────── */

@media (max-width: 600px) {
    #brain-info-box {
        width: 300px;
        font-size: 8px;
        min-width: 200px;
        min-height: 150px;
        max-width: 90vw;
        max-height: 70vh;
    }

    #brain-info-box table {
        font-size: 8px;
    }

    #brain-info-box th {
        font-size: 10px;
        padding: 4px;
    }

    #brain-info-box td {
        padding: 4px;
        font-size: 8px;
    }

    #brain-info-box th:nth-child(1) {
        width: 15%;
    }

    #brain-info-box th:nth-child(2) {
        width: 15%;
    }

    #brain-info-box th:nth-child(3) {
        width: 25%;
    }

    #brain-info-box th:nth-child(4) {
        width: 35%;
    }

    #brain-info-box th:nth-child(5) {
        width: 10%;
    }

    #brain-info-box td:nth-child(5) button {
        padding: 1px 3px;
        font-size: 8px;
    }

    #scan-results-popup {
        width: 90%;
    }

    .click-popup {
        font-size: 8px;
    }

    /* Responsive Anpassungen für Scan-Status im Vollbildmodus */
    .base-window.fullscreen #scan-status {
        font-size: 14px; /* Etwas kleinere Schrift für mobile Geräte im Vollbildmodus */
    }

    .base-window.fullscreen #sector-status {
        font-size: 10px; /* Etwas kleinere Schrift für mobile Geräte im Vollbildmodus */
    }
}
