            <h1>Podcasty a Záznamy pořadů</h1>
            <div style="margin-bottom: 20px;">
                <button onclick="openPodcastModal()">➕ Přidat podcast / záznam</button>
            </div>
            <div class="modal-overlay" id="podcastModal">
                <div class="modal-content" style="width: 800px; max-height: 90vh; overflow-y: auto;">
                    <h3>Přidat / Upravit podcast</h3>
                    <form id="form-podcasts" class="form-group" style="flex-wrap: wrap;">
                        <input type="hidden" id="podId"> <input type="text" id="podTitle" placeholder="Název záznamu / epizody" required style="width:100%;">
                        <label style="width:100%; margin-top: 10px;">Audio soubor (MP3, WAV): <input type="file" id="podAudio" accept="audio/*" style="width:100%; border: 1px solid var(--glass-border); padding: 8px; border-radius: 8px; background: rgba(0,0,0,0.2);"></label>
                        <div id="podAudioPreview" style="width:100%;"></div>
                        <label style="width:100%; margin-top: 10px;">Obrázek (volitelný): <input type="file" id="podImage" accept="image/*" style="width:100%; border: 1px solid var(--glass-border); padding: 8px; border-radius: 8px; background: rgba(0,0,0,0.2);"></label> <div id="podImagePreview" style="width:100%; margin-bottom:10px;"></div>
                        <textarea id="podDesc" class="tinymce" rows="8" placeholder="Popis záznamu" style="width:100%; background: rgba(0,0,0,0.2); color:#fff; border:1px solid var(--glass-border); padding:10px; border-radius:8px;"></textarea>
                        <div style="width: 100%; margin-top: 10px; display: flex; gap: 10px;">
                            <button type="submit">Uložit</button> <button type="button" onclick="closePodcastModal()" style="background: rgba(255,255,255,0.2);">Zrušit</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="glass" style="padding: 20px;"><table><thead><tr><th>Obrázek</th><th>Název</th><th>Audio</th><th>Akce</th></tr></thead><tbody id="tbody-podcasts"></tbody></table></div>
            <script>
                function openPodcastModal() { document.getElementById('podcastModal').style.display = 'flex'; }
                function closePodcastModal() { document.getElementById('podcastModal').style.display = 'none'; document.getElementById('form-podcasts').reset(); document.getElementById('podId').value=''; document.getElementById('podImagePreview').innerHTML=''; document.getElementById('podAudioPreview').innerHTML=''; setTinyContent('podDesc', ''); }
                async function loadPodcasts() { const res = await fetch('/admin/api/podcasts'); const json = await res.json(); document.getElementById('tbody-podcasts').innerHTML = (json.data || []).sort((a,b) => new Date(b.created_at) - new Date(a.created_at)).map(p => `<tr><td>${p.image ? `<img src="/${p.image}" style="height:40px; border-radius:4px; object-fit:cover;">` : '-'}</td><td>${p.title}</td><td><audio controls src="${p.audio_url.startsWith('http') ? p.audio_url : '/' + p.audio_url}" style="height:30px;"></audio></td><td><button class="action-btn" onclick='editPodcast(${JSON.stringify(p).replace(/'/g, "\\'")})'>Upravit</button><button class="action-btn btn-delete" onclick="delPodcast('${p.id}')">Smazat</button></td></tr>`).join(''); }
                function editPodcast(p) { document.getElementById('podId').value = p.id; document.getElementById('podTitle').value = p.title; document.getElementById('podAudioPreview').innerHTML = p.audio_url ? `Aktuální soubor: ${p.audio_url}` : ''; setTinyContent('podDesc', p.description); document.getElementById('podImagePreview').innerHTML = p.image ? `<img src="/${p.image}" style="max-height:100px; border-radius:8px;">` : ''; openPodcastModal(); }
                async function delPodcast(id) { customConfirm('Smazat podcast?', async () => { await fetch('/admin/api/podcasts', { method: 'DELETE', headers: {'Content-Type':'application/json'}, body: JSON.stringify({id}) }); loadPodcasts(); }); }
                document.getElementById('form-podcasts').addEventListener('submit', async (e) => { e.preventDefault(); const formData = new FormData(); formData.append('id', document.getElementById('podId').value); formData.append('title', document.getElementById('podTitle').value); formData.append('description', getTinyContent('podDesc')); const aFile = document.getElementById('podAudio'); if(aFile.files.length > 0) formData.append('audio', aFile.files[0]); const iFile = document.getElementById('podImage'); if(iFile.files.length > 0) formData.append('image', iFile.files[0]); await fetch('/admin/api/podcasts', { method: 'POST', body: formData }); closePodcastModal(); loadPodcasts(); });
                loadPodcasts();
            </script>