/* ═══════════════════════════════════════════════════════
   Geo&Notes – Full-Screen-Layout
   Toolbar sitzt direkt unter der Bootstrap-Navbar (80px).
   geo-main füllt den Rest des Viewports.
═══════════════════════════════════════════════════════ */

:root {
    --gn-navbar-h: 80px;
    --gn-toolbar-h: 48px;
    --gn-handle-w: 8px;
}

/* Kein Body-Scroll auf dieser App-Seite */
html, body { overflow: hidden; }

/* Footer ausblenden – Seite ist eine Vollbild-App */
footer { display: none !important; }

/* ── Werkzeug-Toolbar ── */
#geo-toolbar {
    position: fixed;
    top: var(--gn-navbar-h);
    left: 0; right: 0;
    height: var(--gn-toolbar-h);
    background: linear-gradient(135deg, #1e3c72 0%, #2980b9 100%);
    border-bottom: 1px solid #154360;
    display: flex; align-items: center;
    padding: 0 12px; gap: 6px;
    z-index: 200;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* ── Haupt-Split-Bereich ── */
#geo-main {
    position: fixed;
    top: calc(var(--gn-navbar-h) + var(--gn-toolbar-h));
    left: 0; right: 0; bottom: 0;
    display: flex;
}

/* ── GeoGebra-Panel ── */
#geo-wrap {
    flex: 0 0 auto;
    width: 50%;
    background: #fff;
    position: relative;
    min-width: 160px;
    overflow: hidden;
}

#ggb-element { width: 100%; height: 100%; }

/* Transparentes Overlay – blockiert das GeoGebra-iframe beim Drag */
#geo-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: none;
    cursor: col-resize;
}

/* Lade-Overlay */
#geo-loading {
    position: absolute; inset: 0;
    background: #fff;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    z-index: 10;
    transition: opacity .4s;
}
#geo-loading.gone { opacity: 0; pointer-events: none; }
.ggb-spinner {
    width: 32px; height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: ggbSpin .7s linear infinite;
}
@keyframes ggbSpin { to { transform: rotate(360deg); } }
#geo-loading p {
    font-size: 12px; color: #999;
    font-family: 'Poppins', sans-serif;
}

/* ── Trennbalken ── */
#geo-handle {
    flex: 0 0 var(--gn-handle-w);
    width: var(--gn-handle-w);
    background: #f0f2f5;
    cursor: col-resize;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
    user-select: none;
    border-left: 1px solid #dde2ea;
    border-right: 1px solid #dde2ea;
    transition: background .15s;
}
#geo-handle::after {
    content: '';
    width: 3px; height: 40px;
    border-radius: 2px;
    background: #b0b8c8;
    transition: background .15s, height .15s;
}
#geo-handle:hover { background: #e8ecf2; }
#geo-handle:hover::after { background: #3498db; height: 52px; }
#geo-handle.dragging::after { background: #1e3c72; height: 60px; }

/* ── Notiz-Panel ── */
#notes-wrap {
    flex: 1 1 0;
    min-width: 160px;
    position: relative; overflow: hidden;
    background-color: #fafcff;
    background-image:
        linear-gradient(to right,  rgba(52, 152, 219, .18) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(52, 152, 219, .18) 1px, transparent 1px),
        linear-gradient(to right,  rgba(52, 152, 219, .06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(52, 152, 219, .06) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}

#draw-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    touch-action: none;
    cursor: crosshair;
}
/* ── Text-Ebene ── */
#text-layer {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}
#text-layer.active {
    pointer-events: auto;
    cursor: text;
}

.geo-textbox {
    position: absolute;
    min-width: 60px;
    padding: 2px 5px;
    border: 1px dashed transparent;
    border-radius: 2px;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Poppins', sans-serif;
    line-height: 1.4;
    cursor: text;
    box-sizing: border-box;
    transition: border-color .15s;
}
/* Alle Boxen leicht anzeigen, wenn Text-Modus aktiv */
#text-layer.active .geo-textbox {
    border-color: rgba(52, 152, 219, 0.2);
}
/* Fokussierte Box deutlich hervorheben */
.geo-textbox:focus {
    border-color: rgba(52, 152, 219, 0.75);
    background: rgba(255, 255, 255, 0.35);
}

/* ═══════════════════════════════════════════════════════
   Toolbar-Elemente
═══════════════════════════════════════════════════════ */

.geo-logo {
    font-size: 15px; font-weight: 700;
    color: #fff; letter-spacing: -.3px; flex-shrink: 0;
}
.geo-logo em { color: #85c1e9; font-style: normal; }

.geo-vr {
    width: 1px; height: 20px;
    background: rgba(255, 255, 255, .25);
    flex-shrink: 0; margin: 0 2px;
}

/* Moduswechsel-Pill */
.geo-mode-pill {
    display: flex;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 5px; overflow: hidden; flex-shrink: 0;
}
.geo-mode-pill button {
    padding: 0 8px; height: 28px;
    background: transparent; border: none;
    color: rgba(255, 255, 255, .7);
    font-family: 'Poppins', sans-serif; font-size: 9.5px;
    cursor: pointer;
    transition: background .12s, color .12s;
    white-space: nowrap;
}
.geo-mode-pill button.on {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}
.geo-mode-pill button + button {
    border-left: 1px solid rgba(255, 255, 255, .2);
}

/* Werkzeug-Buttons */
.geo-tb {
    display: flex; align-items: center; gap: 4px;
    height: 28px; padding: 0 9px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 5px;
    color: rgba(255, 255, 255, .75);
    font-family: 'Poppins', sans-serif; font-size: 10px;
    cursor: pointer; flex-shrink: 0; white-space: nowrap;
    transition: color .12s, border-color .12s, background .12s;
}
.geo-tb:hover { color: #fff; border-color: rgba(255, 255, 255, .6); }
.geo-tb.on {
    background: rgba(255, 255, 255, .2);
    border-color: #85c1e9;
    color: #fff;
}

/* Farbkreise */
.geo-swatch {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer; flex-shrink: 0;
    transition: transform .12s, border-color .12s;
}
.geo-swatch.on { border-color: #fff; transform: scale(1.25); }

/* Stärke-Slider */
.geo-slider {
    -webkit-appearance: none;
    width: 60px; height: 3px;
    background: rgba(255, 255, 255, .25);
    border-radius: 2px; outline: none; flex-shrink: 0;
}
.geo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #85c1e9;
    cursor: pointer;
}

.geo-lbl {
    font-size: 9px;
    color: rgba(255, 255, 255, .65);
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
}

.geo-spacer { flex: 1; min-width: 4px; }

/* PDF-Export-Button */
.geo-export-btn {
    display: flex; align-items: center; gap: 5px;
    height: 28px; padding: 0 12px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 5px;
    color: #fff;
    font-family: 'Poppins', sans-serif; font-size: 10px; font-weight: 600;
    cursor: pointer; flex-shrink: 0;
    transition: background .12s;
}
.geo-export-btn:hover { background: rgba(255, 255, 255, .25); }
.geo-export-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Toast ── */
#geo-toast {
    position: fixed;
    bottom: 18px; left: 50%; transform: translateX(-50%);
    background: #1e3c72;
    border: 1px solid #2980b9;
    color: #fff;
    font-size: 12px; font-family: 'Poppins', sans-serif;
    padding: 8px 16px; border-radius: 6px;
    opacity: 0; transition: opacity .25s;
    pointer-events: none; z-index: 400; white-space: nowrap;
}
#geo-toast.show { opacity: 1; }

/* ═══════════════════════════════════════════════════════
   Responsive – Mobil: vertikal stapeln
═══════════════════════════════════════════════════════ */
@media (max-width: 680px) {
    :root {
        --gn-navbar-h: 70px;
        --gn-toolbar-h: 44px;
    }

    #geo-main { flex-direction: column; }

    #geo-wrap {
        flex: 0 0 calc(50% - var(--gn-handle-w) / 2);
        width: 100% !important;
    }

    #geo-handle {
        flex: 0 0 var(--gn-handle-w);
        width: 100%;
        cursor: row-resize;
    }
    #geo-handle::after { width: 40px; height: 3px; }
    #geo-overlay { cursor: row-resize; }

    /* Auf kleinen Screens Modus-Pill und Label ausblenden */
    .geo-mode-pill { display: none; }
    .geo-lbl { display: none; }
    .geo-slider { width: 44px; }
}
