/* ============================================
   INTEGRATED SIDEBAR - DEFENCE TACTICAL STYLE
   Symbol Selection Panel with attached Toggle
   ============================================ */

/* Sidebar Panel Container */
#sidebar-panel {
    position: fixed;
    top: 12px;
    right: 0;
    z-index: 1500;
    display: flex;
    align-items: flex-start;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Collapsed state - slide off screen */
#sidebar-panel.collapsed {
    transform: translateX(calc(100% - 48px));
}

#sidebar-panel.collapsed #sidebar-content {
    opacity: 0;
    pointer-events: none;
}

/* Toggle Button - Attached Tab */
#toggle-sidebar {
    flex-shrink: 0;
    width: 48px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 20, 0.95);
    border: 1px solid var(--border-primary, #1a3a4a);
    border-right: none;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 
        -5px 0 15px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(0, 212, 170, 0.2);
}

#toggle-sidebar:hover {
    background: rgba(0, 50, 60, 0.95);
    box-shadow: 
        -5px 0 20px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(0, 212, 170, 0.4);
}

#toggle-sidebar i {
    color: var(--accent-cyan, #00d4aa);
    font-size: 1.6rem;
    transition: transform 0.3s ease;
}

#sidebar-panel.collapsed #toggle-sidebar i {
    transform: rotate(180deg);
}

/* Sidebar Content Container */
#sidebar-content {
    width: 300px;
    max-height: calc(100dvh - 24px);
    background: rgba(10, 14, 20, 0.95);
    border: 1px solid var(--border-primary, #1a3a4a);
    border-right: none;
    border-left: 3px solid var(--accent-cyan, #00d4aa);
    display: flex;
    flex-direction: column;
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(0, 212, 170, 0.2),
        inset 0 0 30px rgba(0, 212, 170, 0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
    transition: opacity 0.3s ease, width 0.3s ease;
}

/* Sidebar Header with Logo */
#sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(0, 40, 50, 0.5) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-primary, #1a3a4a);
}

#sidebar-header #appicon {
    width: 44px;
    height: 44px;
    padding: 4px;
    background: rgba(0, 20, 30, 0.6);
    border: 1px solid var(--border-primary, #1a3a4a);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    /* Material Icon specific styles */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem; /* Adjust size for settings icon */
    color: var(--accent-cyan, #00d4aa);
    text-shadow: 0 0 8px rgba(0, 212, 170, 0.6);
}

#sidebar-header #appicon.clickable-logo:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    box-shadow: 0 0 15px rgba(0, 212, 170, 0.5);
    color: var(--text-accent, #00ffcc); /* Brighter on hover */
    text-shadow: 0 0 12px rgba(0, 212, 170, 0.8);
}

#sidebar-header .header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#sidebar-header .header-title {
    font-family: 'Orbitron', 'Share Tech Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-accent, #00ffcc);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 212, 170, 0.5);
}

#sidebar-header .header-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-secondary, #8ba89e);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Scrollable Symbol List */
#sidebar-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Collapsible Categories */
#sidebar-list .collapsible {
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
}

#sidebar-list .collapsible-header {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 12px 16px;
    color: var(--text-primary, #e0f0e8);
    background: rgba(15, 25, 35, 0.6) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-primary, #1a3a4a) !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

#sidebar-list .collapsible-header::before {
    content: '▸';
    margin-right: 10px;
    color: var(--accent-cyan, #00d4aa);
    transition: transform 0.2s ease;
    font-size: 0.7rem;
}

#sidebar-list .collapsible-header:hover {
    background: rgba(0, 50, 60, 0.5) !important;
    color: var(--text-accent, #00ffcc);
}

/* Active/Open Category */
#sidebar-list li.active .collapsible-header {
    background: rgba(0, 60, 50, 0.6) !important;
    color: var(--text-accent, #00ffcc);
    border-left: 2px solid var(--accent-cyan, #00d4aa) !important;
}

#sidebar-list li.active .collapsible-header::before {
    content: '▾';
    color: var(--accent-cyan, #00d4aa);
    text-shadow: 0 0 8px var(--accent-cyan, #00d4aa);
}

/* Hide Materialize arrow icon */
#sidebar-list .collapsible-header i.material-icons {
    display: none;
}

/* Collapsible Body - Icon Grid */
#sidebar-list .collapsible-body {
    padding: 12px !important;
    background: rgba(5, 10, 15, 0.8) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-primary, #1a3a4a) !important;
    display: none;
}

#sidebar-list li.active .collapsible-body {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

/* Icon Images */
#sidebar-list .collapsible-body img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    padding: 4px;
    background: rgba(20, 35, 45, 0.6);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

#sidebar-list .collapsible-body img:hover {
    border-color: var(--accent-cyan, #00d4aa);
    background: rgba(0, 50, 60, 0.6);
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.4);
    transform: scale(1.05);
}

#sidebar-list .collapsible-body img.selected {
    border-color: var(--accent-green, #00ff88);
    background: rgba(0, 80, 60, 0.5);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
}

/* Loading & Empty States */
#sidebar-list .collapsible-body .loading-icons,
#sidebar-list .collapsible-body .no-icons {
    display: block;
    width: 100%;
    text-align: center;
    color: var(--text-secondary, #8ba89e);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    padding: 20px 16px;
    letter-spacing: 1px;
}

#sidebar-list .collapsible-body .loading-icons {
    color: var(--accent-cyan, #00d4aa);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Custom Scrollbar */
#sidebar-list::-webkit-scrollbar {
    width: 6px;
}

#sidebar-list::-webkit-scrollbar-track {
    background: rgba(10, 14, 20, 0.8);
}

#sidebar-list::-webkit-scrollbar-thumb {
    background: var(--border-primary, #1a3a4a);
}

#sidebar-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 170, 0.3);
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    #sidebar-panel {
        top: 8px;
        right: 0;
    }
    
    #sidebar-content {
        width: 260px;
        max-height: calc(100dvh - 16px);
    }
    
    #sidebar-panel.collapsed {
        transform: translateX(calc(100% - 40px));
    }
    
    /* Stelle sicher, dass Content auf Mobile vollständig ausgeblendet ist */
    #sidebar-panel.collapsed #sidebar-content {
        width: 0 !important;
        max-width: 0 !important;
        min-width: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        overflow: hidden !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: none !important;
        position: absolute !important;
        left: -9999px !important;
        clip: rect(0, 0, 0, 0) !important;
    }
    
    #toggle-sidebar {
        width: 40px;
        height: 70px;
    }
    
    #sidebar-header {
        padding: 10px 12px;
    }
    
    #sidebar-header #appicon {
        width: 36px;
        height: 36px;
        font-size: 1.5rem; /* Adjust size for settings icon on mobile */
    }
    
    #sidebar-header .header-title {
        font-size: 0.85rem;
    }
    
    #sidebar-list .collapsible-body img {
        width: 42px;
        height: 42px;
    }
    
    #sidebar-list .collapsible-header {
        font-size: 0.75rem;
        padding: 10px 14px;
    }
}
