/* ==========================================================================
   SCROLL SIDEBAR - Mobile Navigation für Scroll-Sektionen
   Nur sichtbar auf Mobile (< 900px)
   ========================================================================== */

/* ==================== VARIABLEN ==================== */
:root {
    --sidebar-width: 280px;
    --peek-width: 44px;
    --peek-expanded-width: 140px;
    --sidebar-bg: rgba(15, 23, 42, 0.98);
    --sidebar-border: rgba(0, 255, 255, 0.2);
    --sidebar-z-overlay: 9996;
    --sidebar-z-peek: 9997;
    --sidebar-z-main: 9998;
}

/* ==================== PEEK INDICATOR ==================== */
/* Immer sichtbar am rechten Rand (nur Mobile) - Mit Mini-Icons */

.sidebar-peek {
    display: none;
    /* Default versteckt, nur auf Mobile sichtbar */
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: var(--sidebar-z-peek);
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 12px 0;
    cursor: pointer;
}

/* Peek verstecken wenn Sidebar offen */
.sidebar-peek.is-hidden {
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* ==================== PEEK ICONS (ersetzt Dots) ==================== */

.sidebar-peek-dots {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.sidebar-peek-dot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    height: 36px;
    padding: 0 10px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-right: none;
    border-radius: 18px 0 0 18px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    /* Default: Collapsed (nur Icon sichtbar) */
    min-width: 42px;
    max-width: 42px;
}

/* SVG Icon im peek-dot */
.sidebar-peek-dot .peek-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.sidebar-peek-dot .peek-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Label im peek-dot - Default: versteckt */
.sidebar-peek-dot .peek-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-white, #fff);
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover: Expand temporär */
.sidebar-peek-dot:hover {
    background: rgba(0, 255, 255, 0.15);
    min-width: 110px;
    max-width: 140px;
}

.sidebar-peek-dot:hover .peek-icon {
    opacity: 1;
}

.sidebar-peek-dot:hover .peek-label {
    opacity: 1;
    max-width: 80px;
}

/* Aktive Sektion (via Scroll): Ausgeklappt mit Namen */
.sidebar-peek-dot.active {
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.2), var(--sidebar-bg));
    border-color: var(--primary-cyan, #00ffff);
    min-width: 110px;
    max-width: 140px;
    box-shadow: -2px 0 15px rgba(0, 255, 255, 0.2),
        0 0 20px rgba(0, 255, 255, 0.1);
}

.sidebar-peek-dot.active .peek-icon {
    opacity: 1;
}

.sidebar-peek-dot.active .peek-label {
    opacity: 1;
    max-width: 80px;
    color: var(--primary-cyan, #00ffff);
}

/* Peek-Pfeil Indikator (unten) */
.sidebar-peek-arrow {
    width: 32px;
    height: 32px;
    margin-top: 8px;
    padding: 8px;
    background: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-right: none;
    border-radius: 16px 0 0 16px;
    opacity: 0.6;
    transition: all 0.2s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
}

.sidebar-peek:hover .sidebar-peek-arrow,
.sidebar-peek-arrow:hover {
    opacity: 1;
    background: rgba(0, 255, 255, 0.15);
    transform: translateX(-2px);
}

/* ==================== SIDEBAR OVERLAY ==================== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--sidebar-z-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ==================== HAUPTSIDEBAR ==================== */

.scroll-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height für Mobile */
    z-index: var(--sidebar-z-main);
    background: var(--sidebar-bg);
    border-left: 1px solid var(--sidebar-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(0, 255, 255, 0.05);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    /* Default versteckt */
    flex-direction: column;
    overflow: hidden;
}

.scroll-sidebar.is-open {
    transform: translateX(0);
}

/* ==================== SIDEBAR HEADER ==================== */

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.15);
    background: linear-gradient(180deg,
            rgba(0, 255, 255, 0.08) 0%,
            transparent 100%);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-white, #fff);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-title-icon {
    color: var(--primary-cyan, #00ffff);
}

.sidebar-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-close:hover,
.sidebar-close:focus {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white, #fff);
    outline: none;
}

.sidebar-close:active {
    transform: scale(0.95);
}

/* ==================== SIDEBAR NAVIGATION ==================== */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-light, rgba(226, 232, 240, 0.9));
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-link:hover,
.sidebar-link:focus {
    background: rgba(0, 255, 255, 0.1);
    border-color: rgba(0, 255, 255, 0.2);
    color: var(--primary-cyan, #00ffff);
    outline: none;
}

.sidebar-link:active {
    transform: scale(0.98);
}

.sidebar-link.active {
    background: rgba(0, 255, 255, 0.15);
    border-color: rgba(0, 255, 255, 0.3);
    color: var(--primary-cyan, #00ffff);
}

.sidebar-link-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-link-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ==================== SIDEBAR FOOTER ==================== */

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 255, 255, 0.15);
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(0, 255, 255, 0.05) 100%);
}

.sidebar-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--primary-cyan, #00ffff), #0080ff);
    color: var(--bg-dark, #030712);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.3);
}

.sidebar-cta:hover,
.sidebar-cta:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 255, 255, 0.4);
    outline: none;
}

.sidebar-cta:active {
    transform: translateY(0);
}

/* ==================== SWIPE HANDLE ==================== */

.sidebar-swipe-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 100%;
    cursor: ew-resize;
}

/* ==================== MOBILE ONLY ==================== */

@media (max-width: 900px) {
    .sidebar-peek {
        display: flex;
    }

    .scroll-sidebar {
        display: flex;
    }
}

/* ==================== LANDSCAPE OPTIMIERUNG ==================== */

@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .sidebar-peek {
        padding: 10px 4px;
        gap: 6px;
    }

    .sidebar-peek-dot {
        width: 6px;
        height: 6px;
    }

    .scroll-sidebar {
        width: 250px;
    }

    .sidebar-header {
        padding: 12px 16px;
    }

    .sidebar-nav {
        padding: 8px;
    }

    .sidebar-link {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .sidebar-footer {
        padding: 12px 16px;
    }
}

/* ==================== TABLET (601-900px) ==================== */

@media (min-width: 601px) and (max-width: 900px) {
    .scroll-sidebar {
        width: 320px;
    }

    .sidebar-link {
        padding: 16px 20px;
    }
}

/* ==================== ACCESSIBILITY ==================== */

@media (prefers-reduced-motion: reduce) {

    .sidebar-peek,
    .scroll-sidebar,
    .sidebar-overlay,
    .sidebar-peek-dot,
    .sidebar-link {
        transition: none;
    }
}

/* Focus-visible für Keyboard-Navigation */
.sidebar-close:focus-visible,
.sidebar-link:focus-visible,
.sidebar-cta:focus-visible {
    outline: 2px solid var(--primary-cyan, #00ffff);
    outline-offset: 2px;
}

/* ==================== DESKTOP TOPBAR FÜR INDEX ==================== */

.sticky-scroll-nav {
    display: none;
    /* Default versteckt, nur Desktop */
    position: sticky;
    top: 80px;
    z-index: 800;
    background: rgba(3, 7, 18, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 255, 255, 0.15);
    padding: 0.75rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Scrollbar verstecken (Webkit) */
.sticky-scroll-nav::-webkit-scrollbar {
    display: none;
}

.scroll-nav-inner {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.scroll-nav-link {
    color: var(--text-secondary, rgba(148, 163, 184, 0.9));
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    white-space: nowrap;
}

.scroll-nav-link:hover,
.scroll-nav-link.active {
    color: var(--bg-dark, #04111a);
    background: var(--primary-cyan, #00ffff);
    border-color: var(--primary-cyan, #00ffff);
}

.scroll-nav-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.scroll-nav-link-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Nur auf Desktop zeigen */
@media (min-width: 901px) {
    .sticky-scroll-nav {
        display: block;
    }
}

/* Auf Mobile verstecken */
@media (max-width: 900px) {
    .sticky-scroll-nav {
        display: none !important;
    }
}

/* ==================== TOPBAR UNTER HEADER ==================== */
/* Topbar erscheint unter dem Header wenn aus Banner-Bereich gescrollt */

@media (min-width: 901px) {
    /* Topbar fixed unter dem Header */
    .sticky-scroll-nav.topbar-elevated {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        z-index: 800;
        background: rgba(3, 7, 18, 0.95);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-bottom: 1px solid rgba(0, 255, 255, 0.15);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
        padding: 0;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    /* Topbar-Inner volle Breite */
    .sticky-scroll-nav.topbar-elevated .scroll-nav-inner {
        max-width: var(--container-xl);
        margin: 0 auto;
        padding: 0 1.5rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    /* Topbar Links */
    .sticky-scroll-nav.topbar-elevated .scroll-nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Topbar versteckt (ganz oben) */
    .sticky-scroll-nav.topbar-elevated.topbar-hidden {
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
    }

    /* Topbar sichtbar (nach Scroll) */
    .sticky-scroll-nav.topbar-elevated.topbar-visible {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
}

/* Schmale Desktop-Bildschirme */
@media (min-width: 901px) and (max-width: 1100px) {
    .sticky-scroll-nav.topbar-elevated .scroll-nav-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}