<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ course.title }} — IIL Learn Hub</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            color: #e2e8f0;
            min-height: 100vh;
        }
        .nav { padding: 1rem 2rem; }
        .nav a { color: #94a3b8; text-decoration: none; font-size: 0.9rem; }
        .nav a:hover { color: #e2e8f0; }
        .header {
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem;
            border-bottom: 1px solid #334155;
        }
        .header h1 {
            font-size: 2rem;
            font-weight: 700;
            background: linear-gradient(90deg, #38bdf8, #818cf8);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-bottom: 0.75rem;
        }
        .header .description {
            color: #94a3b8;
            line-height: 1.6;
            font-size: 1rem;
        }
        .meta {
            display: flex;
            gap: 1rem;
            margin-top: 1rem;
            flex-wrap: wrap;
        }
        .badge {
            display: inline-block;
            font-size: 0.8rem;
            padding: 0.3rem 0.75rem;
            border-radius: 999px;
            background: #334155;
            color: #94a3b8;
        }
        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 2rem;
        }
        .chapter {
            margin-bottom: 2rem;
        }
        .chapter-title {
            font-size: 1.3rem;
            font-weight: 600;
            color: #f1f5f9;
            margin-bottom: 0.75rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid #334155;
        }
        .chapter-desc {
            color: #94a3b8;
            font-size: 0.9rem;
            margin-bottom: 0.75rem;
        }
        .lesson-list {
            list-style: none;
        }
        .lesson-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            border-radius: 0.5rem;
            margin-bottom: 0.25rem;
            transition: background 0.15s;
        }
        .lesson-item:hover {
            background: rgba(59, 130, 246, 0.08);
        }
        .lesson-icon {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: #334155;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            color: #94a3b8;
            flex-shrink: 0;
        }
        .lesson-title {
            font-size: 0.95rem;
            color: #e2e8f0;
        }
        .lesson-duration {
            margin-left: auto;
            font-size: 0.8rem;
            color: #64748b;
        }
        .empty-chapters {
            text-align: center;
            padding: 3rem;
            color: #64748b;
        }
    </style>
</head>
<body>
    <div class="nav">
        <a href="{% url 'iil_learnfw:course-list' %}">&larr; Alle Kurse</a>
    </div>
    <div class="header">
        <h1>{{ course.title }}</h1>
        {% if course.description %}
        <p class="description">{{ course.description }}</p>
        {% endif %}
        <div class="meta">
            {% if course.category %}
            <span class="badge">{{ course.category.name }}</span>
            {% endif %}
            {% if course.estimated_duration_minutes %}
            <span class="badge">{{ course.estimated_duration_minutes }} Min.</span>
            {% endif %}
            <span class="badge">{{ chapters|length }} Kapitel</span>
        </div>
    </div>
    <div class="container">
        {% if chapters %}
            {% for chapter in chapters %}
            <div class="chapter">
                <h2 class="chapter-title">{{ forloop.counter }}. {{ chapter.title }}</h2>
                {% if chapter.description %}
                <p class="chapter-desc">{{ chapter.description }}</p>
                {% endif %}
                {% if chapter.lessons.all %}
                <ul class="lesson-list">
                    {% for lesson in chapter.lessons.all %}
                    <li class="lesson-item">
                        <div class="lesson-icon">{{ forloop.counter }}</div>
                        <span class="lesson-title">{{ lesson.title }}</span>
                        {% if lesson.estimated_duration_minutes %}
                        <span class="lesson-duration">{{ lesson.estimated_duration_minutes }} Min.</span>
                        {% endif %}
                    </li>
                    {% endfor %}
                </ul>
                {% endif %}
            </div>
            {% endfor %}
        {% else %}
        <div class="empty-chapters">
            <p>Kursinhalte werden gerade erstellt.</p>
        </div>
        {% endif %}
    </div>
</body>
</html>
