<!DOCTYPE html>
<html lang="de" data-bs-theme="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Intern{% endblock %} - Kurs-Booking (Intern)</title>

    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" rel="stylesheet">

    <style>
        :root {
            --kb-primary: #dc2626;
            --kb-primary-hover: #b91c1c;
            --kb-success: #22c55e;
            --kb-warning: #f59e0b;
            --kb-danger: #ef4444;
        }

        body {
            min-height: 100vh;
            background: linear-gradient(135deg, #1a1a2e 0%, #2d1f1f 100%);
        }

        .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: 280px;
            height: 100vh;
            background: rgba(30, 20, 20, 0.95);
            border-right: 1px solid rgba(220, 38, 38, 0.3);
            overflow-y: auto;
            z-index: 1000;
        }

        .sidebar-brand {
            padding: 1.5rem;
            border-bottom: 1px solid rgba(220, 38, 38, 0.3);
            background: linear-gradient(135deg, #dc2626, #991b1b);
        }

        .sidebar-brand h4 {
            margin: 0;
            font-weight: 700;
        }

        .sidebar-nav {
            padding: 1rem 0;
        }

        .nav-section {
            padding: 0.5rem 1.5rem;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: rgba(255,255,255,0.5);
            margin-top: 1rem;
        }

        .nav-link {
            padding: 0.6rem 1.5rem;
            color: rgba(255,255,255,0.8);
            display: flex;
            align-items: center;
            gap: 0.75rem;
            transition: all 0.2s;
            border-left: 3px solid transparent;
        }

        .nav-link:hover {
            background: rgba(220, 38, 38, 0.1);
            color: #fff;
            border-left-color: var(--kb-primary);
        }

        .nav-link.active {
            background: rgba(220, 38, 38, 0.2);
            color: #fff;
            border-left-color: var(--kb-primary);
        }

        .nav-link i {
            font-size: 1.1rem;
            width: 1.5rem;
        }

        .main-content {
            margin-left: 280px;
            padding: 2rem;
            min-height: 100vh;
        }

        .card {
            background: rgba(30, 20, 20, 0.8);
            border: 1px solid rgba(220, 38, 38, 0.2);
            border-radius: 12px;
        }

        .card-header {
            background: rgba(220, 38, 38, 0.1);
            border-bottom: 1px solid rgba(220, 38, 38, 0.2);
        }

        .topic-card {
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .topic-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2);
        }

        .content-body h2 {
            color: var(--kb-primary);
            border-bottom: 1px solid rgba(220, 38, 38, 0.3);
            padding-bottom: 0.5rem;
            margin-top: 2rem;
        }

        .content-body h3 {
            color: #fca5a5;
            margin-top: 1.5rem;
        }

        .content-body table {
            width: 100%;
            margin: 1rem 0;
        }

        .content-body table th,
        .content-body table td {
            padding: 0.75rem;
            border: 1px solid rgba(220, 38, 38, 0.2);
        }

        .content-body table th {
            background: rgba(220, 38, 38, 0.2);
        }

        .content-body code {
            background: rgba(220, 38, 38, 0.2);
            padding: 0.2rem 0.4rem;
            border-radius: 4px;
            color: #fca5a5;
        }

        .content-body pre {
            background: rgba(0,0,0,0.4);
            padding: 1rem;
            border-radius: 8px;
            overflow-x: auto;
            border: 1px solid rgba(220, 38, 38, 0.2);
        }

        .intern-badge {
            background: var(--kb-primary);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .toc-sidebar {
            position: sticky;
            top: 2rem;
        }

        .toc-link {
            display: block;
            padding: 0.4rem 0.75rem;
            color: rgba(255,255,255,0.7);
            text-decoration: none;
            font-size: 0.875rem;
            border-left: 2px solid transparent;
        }

        .toc-link:hover {
            color: #fff;
            background: rgba(220, 38, 38, 0.1);
        }

        .toc-link.active {
            color: var(--kb-primary);
            border-left-color: var(--kb-primary);
        }

        @media (max-width: 991px) {
            .sidebar {
                transform: translateX(-100%);
                transition: transform 0.3s;
            }
            .sidebar.show {
                transform: translateX(0);
            }
            .main-content {
                margin-left: 0;
            }
        }
    </style>
</head>
<body>
    <!-- Sidebar -->
    <nav class="sidebar">
        <a href="/intern/" class="sidebar-brand text-decoration-none text-white d-block">
            <h4><i class="bi bi-shield-lock me-2"></i>Intern</h4>
            <small class="text-white-50">Entwickler-Dokumentation</small>
        </a>

        <div class="sidebar-nav">
            <a href="/intern/" class="nav-link {% if request.path == '/intern/' %}active{% endif %}">
                <i class="bi bi-house"></i>
                <span>Uebersicht</span>
            </a>

            <a href="/" class="nav-link text-warning">
                <i class="bi bi-arrow-left"></i>
                <span>Zurueck zur Hilfe</span>
            </a>

            {% for section in content.sections %}
            <div class="nav-section">{{ section.title }}</div>
            {% for topic in section.topics %}
            <a href="/intern/topic/{{ topic.id }}" class="nav-link {% if request.path == '/intern/topic/' + topic.id %}active{% endif %}">
                <i class="bi bi-{{ topic.icon|default('file-lock') }}"></i>
                <span>{{ topic.title }}</span>
            </a>
            {% endfor %}
            {% endfor %}
        </div>
    </nav>

    <!-- Main Content -->
    <main class="main-content">
        {% block content %}{% endblock %}
    </main>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>

    <!-- Auto-scroll sidebar to active menu item -->
    <script>
    document.addEventListener('DOMContentLoaded', function() {
        const activeLink = document.querySelector('.sidebar .nav-link.active');
        if (activeLink) {
            activeLink.scrollIntoView({ block: 'center', behavior: 'instant' });
        }
    });
    </script>
</body>
</html>
