/* Sidebar styles extracted from sidebar_macros.html to comply with CSP (no inline styles) */
.sidebar {
    width: 350px;
    background: white;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: margin-right 0.3s ease;
    z-index: 1000;
    order: 2;
}

.sidebar.collapsed {
    margin-right: -320px;
}

.sidebar.collapsed #toggleSidebar {
    position: fixed;
    right: 10px;
    top: 70px;
    z-index: 1001;
    background: white;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.sidebar-header h5 {
    margin: 0;
    flex-grow: 1;
}

.sidebar-section {
    padding: 1rem;
    border-bottom: 1px solid #f1f3f4;
}

.sidebar-section h6 {
    margin-bottom: 0.75rem;
    color: #495057;
}

.stats-content {
    font-size: 0.9rem;
}

.stats-content div {
    margin-bottom: 0.25rem;
}

.legend-content {
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-item i,
.legend-item span {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.legend-line {
    width: 20px;
    height: 2px;
    display: inline-block;
    margin-right: 0.5rem;
}

.legend-line.direct {
    background-color: #28a745;
}

.legend-line.indirect {
    background: linear-gradient(90deg, #ffc107 50%, transparent 50%);
    background-size: 8px 2px;
}

.search-results {
    max-height: 200px;
    overflow-y: auto;
}

.selected-details {
    font-size: 0.9rem;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: 60vh; /* Increased height for better usability */
        border-left: none;
        border-top: 1px solid #dee2e6;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        order: 2;
        transition: transform 0.3s ease;
        transform: translateY(0);
    }

    .sidebar.collapsed {
        margin-right: 0;
        transform: translateY(calc(100% - 60px)); /* Show only header */
    }

    .sidebar.collapsed #toggleSidebar {
        position: static;
        right: auto;
        top: auto;
        z-index: auto;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .sidebar.collapsed .sidebar-header {
        border-bottom: none;
    }

    .sidebar-header {
        flex-shrink: 0;
    }

    .sidebar-section {
        flex: unset; /* Allow sections to take natural height */
        overflow: visible; /* Remove nested scrolling on each section */
    }

    /* Update toggle button icon for mobile */
    .sidebar:not(.collapsed) #toggleSidebar i {
        transform: rotate(90deg); /* Point down when expanded */
    }

    .sidebar.collapsed #toggleSidebar i {
        transform: rotate(-90deg); /* Point up when collapsed */
    }
}

