<?php include __DIR__ . '/../layout/header.php'; ?>

<div class="admin-card">
    <form action="<?php echo $baseUrl; ?>/admin/categories/store" method="POST">
        <div class="form-row" style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
            <div class="form-group">
                <label for="name">Kategori Adı</label>
                <input type="text" name="name" id="name" class="admin-input" required placeholder="Kategori adını girin">
            </div>
            <div class="form-group">
                <label for="slug">URL Uzantısı (Slug - Opsiyonel)</label>
                <input type="text" name="slug" id="slug" class="admin-input" placeholder="bos-birakirsaniz-otomatik-olusturulur">
            </div>
        </div>

        <div class="form-group" style="margin-top: 16px;">
            <label for="parent_slug">Üst Kategori</label>
            <select name="parent_slug" id="parent_slug" class="admin-input">
                <option value="">Yok (Ana Kategori)</option>
                <?php foreach ($categories as $cat): ?>
                <option value="<?php echo $cat->slug; ?>"><?php echo htmlspecialchars($cat->name); ?></option>
                <?php endforeach; ?>
            </select>
        </div>

        <div style="margin-top: 24px; display: flex; gap: 10px;">
            <button type="submit" class="admin-btn admin-btn-primary"><i class="fa fa-save"></i> Kaydet</button>
            <a href="<?php echo $baseUrl; ?>/admin/categories" class="admin-btn" style="background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);"><i class="fa fa-times"></i> İptal</a>
        </div>
    </form>
</div>

<?php include __DIR__ . '/../layout/footer.php'; ?>
