<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Akkurtcast - Yayın Akışı</title>
    <link rel="icon" type="image/png" href="/static/img/icon.png">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <style>
        :root { --sidebar-bg: #1a1d21; --sidebar-hover: #2a2e35; --sidebar-text: #a8b2c0; --page-bg: #f0f2f5; --card-bg: #fff; --card-border: #e2e8f0; --accent: #0d6efd; }
        * { box-sizing: border-box; }
        body { background: var(--page-bg); margin: 0; font-family: system-ui, -apple-system, sans-serif; }
        .sidebar { min-height: 100vh; background: var(--sidebar-bg); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
        .brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; color: #fff; font-weight: 800; border-bottom: 1px solid #2a2e35; }
        .brand img { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; }
        .brand-mark { display: flex; flex-direction: column; line-height: 1.05; }
        .brand-name { color: #f8fafc; font-size: 1.18rem; font-weight: 850; }
        .brand-subtitle { margin-top: 4px; color: #7dd3fc; font-size: .63rem; font-weight: 700; letter-spacing: 1.25px; text-transform: uppercase; }
        .nav-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #4a5568; padding: 14px 18px 4px; }
        .sidebar a { color: var(--sidebar-text); display: flex; align-items: center; gap: 8px; padding: 9px 18px; text-decoration: none; font-size: .875rem; font-weight: 500; border-left: 3px solid transparent; transition: all .15s; }
        .sidebar a:hover { background: var(--sidebar-hover); color: #fff; }
        .sidebar a.active { background: rgba(13,110,253,.12); color: #4d9fff; border-left-color: var(--accent); }
        .sidebar a .nav-icon { width: 22px; height: 22px; min-width: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: .78rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 6px 14px rgba(0,0,0,.18); }
        .nav-icon-panel { background: linear-gradient(135deg,#2563eb,#38bdf8); }
        .nav-icon-music { background: linear-gradient(135deg,#7c3aed,#ec4899); }
        .nav-icon-jingle { background: linear-gradient(135deg,#f59e0b,#f97316); }
        .nav-icon-library { background: linear-gradient(135deg,#0f766e,#22c55e); }
        .nav-icon-calendar { background: linear-gradient(135deg,#dc2626,#fb7185); }
        .nav-icon-automation { background: linear-gradient(135deg,#475569,#94a3b8); }
        .nav-icon-news { background: linear-gradient(135deg,#0891b2,#06b6d4); }
        .nav-icon-broadcast { background: linear-gradient(135deg,#4338ca,#818cf8); }
        .nav-icon-dj { background: linear-gradient(135deg,#111827,#64748b); }
        .nav-icon-mobile { background: linear-gradient(135deg,#0e7490,#14b8a6); }
        .nav-icon-reports { background: linear-gradient(135deg,#16a34a,#84cc16); }
        .nav-icon-widget { background: linear-gradient(135deg,#9333ea,#22d3ee); }
        .nav-icon-backup { background: linear-gradient(135deg,#6b7280,#d97706); }
        .nav-icon-settings { background: linear-gradient(135deg,#334155,#0ea5e9); }
        .nav-icon-logout { background: linear-gradient(135deg,#7f1d1d,#ef4444); }
        .sidebar-footer { margin-top: auto; border-top: 1px solid #2a2e35; padding: 8px 0; }
        .topbar { background: #fff; border-bottom: 1px solid var(--card-border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 100; }
        .topbar-title { font-weight: 700; font-size: .95rem; color: #1a202c; }
        .panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden; }
        .timeline-row { border-left: 3px solid transparent; }
        .timeline-row.conflict { border-left-color: #f59e0b; background: #fffbeb; }
        @media (max-width: 767px) {
            html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
            .container-fluid > .row.g-0 { display: block; width: 100%; margin: 0; }
            .sidebar { width: 100% !important; min-width: 0 !important; max-width: 100% !important; min-height: auto !important; height: auto !important; position: relative !important; flex-direction: row !important; overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
            .brand { min-width: 188px; padding: 10px 12px !important; }
            .brand img { width: 40px !important; height: 40px !important; }
            .nav-section-label { display: none; }
            .sidebar a { flex: 0 0 auto; padding: 12px 10px !important; border-left: none; border-bottom: 3px solid transparent; }
            .sidebar-footer { display: flex; flex: 0 0 auto; margin-top: 0; border-top: none; }
            main[class*="col"] { width: 100% !important; max-width: 100% !important; }
            main > .p-4 { padding: 14px !important; }
        }
    </style>
</head>
<body>
<div class="container-fluid p-0">
    <div class="row g-0">
        <aside class="col-12 col-md-auto sidebar p-0" style="width: 220px; min-width: 220px;">
            <div class="brand">
                <img src="/static/img/akkurtcast-badge.png" alt="Akkurtcast">
                <span class="brand-mark"><span class="brand-name">Akkurtcast</span><span class="brand-subtitle">Broadcast Panel</span></span>
            </div>
            <div class="nav-section-label">Yayın</div>
            <a href="/"><span class="nav-icon nav-icon-panel"><i class="bi bi-house-door-fill"></i></span> Panel</a>
            <a href="/muzik"><span class="nav-icon nav-icon-music"><i class="bi bi-music-note-beamed"></i></span> Müzik listesi</a>
            <a href="/jingle"><span class="nav-icon nav-icon-jingle"><i class="bi bi-bell-fill"></i></span> Jingle listesi</a>
            <a href="/kutuphane"><span class="nav-icon nav-icon-library"><i class="bi bi-folder-fill"></i></span> Kütüphane</a>
            <div class="nav-section-label">Planlama</div>
            <a href="/takvim"><span class="nav-icon nav-icon-calendar"><i class="bi bi-calendar-week-fill"></i></span> Takvim</a>
            <a href="/otomasyon"><span class="nav-icon nav-icon-automation"><i class="bi bi-sliders"></i></span> Otomasyon</a>
            <a href="/haber-bulteni"><span class="nav-icon nav-icon-news"><i class="bi bi-newspaper"></i></span> Haber Bülteni</a>
            <div class="nav-section-label">Yayın Araçları</div>
            <a href="/naklen-yayin"><span class="nav-icon nav-icon-broadcast"><i class="bi bi-broadcast-pin"></i></span> Naklen Yayın</a>
            <a href="/dj"><span class="nav-icon nav-icon-dj"><i class="bi bi-headphones"></i></span> DJ</a>
            <a href="/mobil"><span class="nav-icon nav-icon-mobile"><i class="bi bi-phone-fill"></i></span> Mobil</a>
            <div class="nav-section-label">Sistem</div>
            <a href="/raporlar"><span class="nav-icon nav-icon-reports"><i class="bi bi-bar-chart-fill"></i></span> Raporlar</a>
            <a href="/widgetler"><span class="nav-icon nav-icon-widget"><i class="bi bi-puzzle-fill"></i></span> Widget</a>
            <a href="/yedek"><span class="nav-icon nav-icon-backup"><i class="bi bi-device-hdd-fill"></i></span> Yedek</a>
            <a href="/ayarlar"><span class="nav-icon nav-icon-settings"><i class="bi bi-gear-fill"></i></span> Ayarlar</a>
            <a class="active" href="/akis"><span class="nav-icon nav-icon-calendar"><i class="bi bi-list-check"></i></span> Yayın Akışı</a>
            <div class="sidebar-footer">
                <a href="/logout"><span class="nav-icon nav-icon-logout"><i class="bi bi-box-arrow-right"></i></span> Çıkış</a>
            </div>
        </aside>
        <main class="col p-0" style="min-width: 0;">
            <div class="topbar">
                <div>
                    <div class="topbar-title">Yayın Akışı</div>
                    <div class="small text-muted">Bugünün planlı yayın, jingle ve naklen akışı</div>
                </div>
                <span class="badge {{ 'text-bg-success' if durum == 'YAYINDA' else 'text-bg-danger' }}">{{ durum }}</span>
            </div>
            <div class="p-4">
                {% if warnings %}
                <div class="row g-3 mb-3">
                    {% for warning in warnings %}
                    <div class="col-md-6 col-xl-3"><div class="alert alert-{{ warning.level }} mb-0 py-2"><div class="fw-bold small">{{ warning.title }}</div><div class="small">{{ warning.text }}</div></div></div>
                    {% endfor %}
                </div>
                {% endif %}
                <section class="panel">
                    <div class="px-3 py-3 border-bottom d-flex flex-column flex-md-row gap-2 justify-content-between">
                        <div class="fw-bold">Bugünkü akış</div>
                        <div class="small text-muted">Sıradaki planlı yayın: {{ planned_next.name or 'Yok' }}{% if planned_next.time %} · {{ planned_next.time }}{% endif %}</div>
                    </div>
                    <div class="table-responsive">
                        <table class="table align-middle mb-0">
                            <thead><tr><th>Saat</th><th>Başlık</th><th>Tür</th><th>Durum</th><th>Detay</th></tr></thead>
                            <tbody>
                            {% for item in flow %}
                            <tr class="timeline-row {{ 'conflict' if item.conflict else '' }}">
                                <td class="fw-bold">{{ item.time }}{% if item.end %}<br><span class="small text-muted">{{ item.end }}</span>{% endif %}</td>
                                <td>{{ item.title }}{% if item.conflict %}<span class="badge text-bg-warning ms-2">Aynı saate denk geliyor</span>{% endif %}</td>
                                <td>{{ item.type }}</td>
                                <td><span class="badge {{ 'text-bg-success' if item.status == 'Aktif' else 'text-bg-secondary' }}">{{ item.status }}</span></td>
                                <td class="text-muted small">{{ item.detail }}</td>
                            </tr>
                            {% else %}
                            <tr><td colspan="5" class="text-muted">Bugün için planlı akış bulunamadı.</td></tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </section>
            </div>
        </main>
    </div>
</div>
<script src="/static/js/mobile-nav.js"></script>
</body>
</html>
