<?php $ev = $event ?? null; ?>
<form class="form-card" method="post" action="<?= e(url('admin/etkinlik/kaydet')) ?>" enctype="multipart/form-data">
    <?= csrf_field() ?>
    <input type="hidden" name="id" value="<?= (int)($ev['id'] ?? 0) ?>">

    <div class="form-group">
        <label>Başlık *</label>
        <input name="title" value="<?= e($ev['title'] ?? '') ?>" required>
    </div>
    <div class="form-group">
        <label>Açıklama</label>
        <textarea name="description" rows="3"><?= e($ev['description'] ?? '') ?></textarea>
    </div>
    <div class="form-row">
        <div class="form-group"><label>Tarih / Saat metni</label><input name="date_text" value="<?= e($ev['date_text'] ?? '') ?>" placeholder="Cumartesi · 19:00"></div>
        <div class="form-group"><label>Rozet</label><input name="badge" value="<?= e($ev['badge'] ?? '') ?>" placeholder="Ücretsiz / Sınırlı Kontenjan"></div>
    </div>
    <div class="form-row">
        <div class="form-group"><label>Fiyat metni</label><input name="price_text" value="<?= e($ev['price_text'] ?? '') ?>" placeholder="600₺ / Ücretsiz"></div>
        <div class="form-group"><label>Sıra</label><input name="sort_order" type="number" value="<?= (int)($ev['sort_order'] ?? 0) ?>"></div>
    </div>
    <div class="form-row">
        <div class="form-group"><label>Buton Linki (URL)</label><input name="link_url" value="<?= e($ev['link_url'] ?? '') ?>" placeholder="https://..."></div>
        <div class="form-group"><label>Buton Metni</label><input name="link_text" value="<?= e($ev['link_text'] ?? '') ?>" placeholder="Etkinliğe Katıl"></div>
    </div>
    <div class="form-row">
        <div class="form-group">
            <label>Görsel</label>
            <input name="image" type="file" accept="image/*">
            <?php if (!empty($ev['image'])): ?>
                <div class="current-media"><img src="<?= e(media_url($ev['image'])) ?>" alt=""></div>
                <label class="switch small"><input type="checkbox" name="remove_image"> Görseli kaldır</label>
            <?php endif; ?>
        </div>
        <div class="form-group">
            <label>Video (mp4/webm)</label>
            <input name="video" type="file" accept="video/*">
            <?php if (!empty($ev['video'])): ?>
                <div class="current-media"><video muted loop autoplay playsinline><source src="<?= e(media_url($ev['video'])) ?>"></video></div>
                <label class="switch small"><input type="checkbox" name="remove_video"> Videoyu kaldır</label>
            <?php endif; ?>
        </div>
    </div>
    <label class="switch"><input type="checkbox" name="is_active" <?= (!$ev || $ev['is_active'])?'checked':'' ?>> Aktif</label>
    <div class="form-actions">
        <button class="btn-primary" type="submit">Kaydet</button>
        <a class="btn-ghost" href="<?= e(url('admin/etkinlikler')) ?>">İptal</a>
    </div>
</form>
