<aside class="ldr-sidebar">
    <div class="ldr-sidebar-header">
        <h2 id="logo-link" style="cursor: pointer;"><i class="fas fa-atom"></i> Deep Research</h2>
    </div>
    <nav class="ldr-sidebar-nav">
        <!-- Research Section -->
        <div class="ldr-sidebar-section" role="group" aria-labelledby="sidebar-research-label">
            <div class="ldr-sidebar-section-label" id="sidebar-research-label" role="heading" aria-level="2">Research</div>
            <ul>
                <li {% if active_page == 'new-research' %}class="active"{% endif %} data-page="new-research">
                    <a href="/" title="New Research (Ctrl+Shift+1)">
                        <i class="fas fa-search"></i>
                        <span class="ldr-nav-text">New Research</span>
                    </a>
                </li>
                <li {% if active_page == 'history' %}class="active"{% endif %} data-page="history">
                    <a href="{{ url_for('history.history_page') }}" title="History (Ctrl+Shift+2)">
                        <i class="fas fa-history"></i>
                        <span class="ldr-nav-text">History</span>
                    </a>
                </li>
            </ul>
        </div>

        <!-- Knowledge Base Section -->
        <div class="ldr-sidebar-section" role="group" aria-labelledby="sidebar-kb-label">
            <div class="ldr-sidebar-section-label" id="sidebar-kb-label" role="heading" aria-level="2">Knowledge Base</div>
            <ul>
                <li {% if active_page == 'library' %}class="active"{% endif %} data-page="library">
                    <a href="{{ url_for('library.library_page') }}" title="Library">
                        <i class="fas fa-book"></i>
                        <span class="ldr-nav-text">Library</span>
                    </a>
                </li>
                <li {% if active_page == 'collections' %}class="active ldr-sidebar-item--nested"{% else %}class="ldr-sidebar-item--nested"{% endif %} data-page="collections">
                    <a href="{{ url_for('rag.collections_page') }}" title="Collections">
                        <i class="fas fa-folder-open"></i>
                        <span class="ldr-nav-text">Collections</span>
                    </a>
                </li>
                <li {% if active_page == 'download-manager' %}class="active ldr-sidebar-item--nested"{% else %}class="ldr-sidebar-item--nested"{% endif %} data-page="download-manager">
                    <a href="{{ url_for('library.download_manager_page') }}" title="Download Manager">
                        <i class="fas fa-download"></i>
                        <span class="ldr-nav-text">Downloads</span>
                    </a>
                </li>
            </ul>
        </div>

        <!-- News Section -->
        <div class="ldr-sidebar-section" role="group" aria-labelledby="sidebar-news-label">
            <div class="ldr-sidebar-section-label" id="sidebar-news-label" role="heading" aria-level="2">News</div>
            <ul>
                <li {% if active_page == 'news' %}class="active"{% endif %} data-page="news">
                    <a href="{{ url_for('news.news_page') }}" title="News">
                        <i class="fas fa-newspaper"></i>
                        <span class="ldr-nav-text">News</span>
                    </a>
                </li>
                <li {% if active_page == 'subscriptions' %}class="active"{% endif %} data-page="subscriptions">
                    <a href="{{ url_for('news.subscriptions_page') }}" title="Subscriptions">
                        <i class="fas fa-bell"></i>
                        <span class="ldr-nav-text">Subscriptions</span>
                    </a>
                </li>
            </ul>
        </div>

        <!-- Analytics Section -->
        <div class="ldr-sidebar-section" role="group" aria-labelledby="sidebar-analytics-label">
            <div class="ldr-sidebar-section-label" id="sidebar-analytics-label" role="heading" aria-level="2">Analytics</div>
            <ul>
                <li {% if active_page == 'metrics' %}class="active"{% endif %} data-page="metrics">
                    <a href="{{ url_for('metrics.metrics_dashboard') }}" title="Metrics (Ctrl+Shift+3)">
                        <i class="fas fa-chart-bar"></i>
                        <span class="ldr-nav-text">Metrics</span>
                    </a>
                </li>
                <li {% if active_page == 'benchmark' %}class="active"{% endif %} data-page="benchmark">
                    <a href="{{ url_for('benchmark.index') }}" title="Benchmark">
                        <i class="fas fa-tachometer-alt"></i>
                        <span class="ldr-nav-text">Benchmark</span>
                    </a>
                </li>
                <li {% if active_page == 'benchmark-results' %}class="active ldr-sidebar-item--nested"{% else %}class="ldr-sidebar-item--nested"{% endif %} data-page="benchmark-results">
                    <a href="{{ url_for('benchmark.results') }}" title="Benchmark Results">
                        <i class="fas fa-chart-line"></i>
                        <span class="ldr-nav-text">Results</span>
                    </a>
                </li>
            </ul>
        </div>

        <!-- Settings Section -->
        <div class="ldr-sidebar-section" role="group" aria-labelledby="sidebar-settings-label">
            <div class="ldr-sidebar-section-label" id="sidebar-settings-label" role="heading" aria-level="2">Settings</div>
            <ul>
                <li {% if active_page == 'embedding-settings' %}class="active"{% endif %} data-page="embedding-settings">
                    <a href="{{ url_for('rag.embedding_settings_page') }}" title="Embedding Settings">
                        <i class="fas fa-brain"></i>
                        <span class="ldr-nav-text">Embeddings</span>
                    </a>
                </li>
                <li {% if active_page == 'settings' %}class="active"{% endif %} data-page="settings">
                    <a href="{{ url_for('settings.settings_page') }}" title="Settings (Ctrl+Shift+4)">
                        <i class="fas fa-cog"></i>
                        <span class="ldr-nav-text">Configuration</span>
                    </a>
                </li>
            </ul>
        </div>
    </nav>
    <div class="ldr-sidebar-footer">
        <p>{{ version }}</p>
        <div class="ldr-sidebar-links">
            <a href="https://github.com/LearningCircuit/local-deep-research/issues" target="_blank" title="Report an issue">
                <i class="fas fa-bug"></i>
            </a>
            <a href="https://discord.gg/ttcqQeFcJ3" target="_blank" title="Join Discord">
                <i class="fab fa-discord"></i>
            </a>
            <a href="https://www.reddit.com/r/LocalDeepResearch/" target="_blank" title="Reddit community">
                <i class="fab fa-reddit"></i>
            </a>
        </div>
    </div>
</aside>
