<?php $__template->layout('Layout.main'); ?>
<?php $__template->section('title'); ?>إضافة خبر جديد<?php $__template->endSection(); ?>

<?php $__template->section('page_actions'); ?>
<a href="/news" class="btn btn-outline"><i data-lucide="arrow-right" style="width:15px;height:15px;vertical-align:middle;margin-left:4px;"></i> العودة للأخبار</a>
<?php $__template->endSection(); ?>

<?php $__template->section('content'); ?>

<form method="POST" action="/news" enctype="multipart/form-data">
    <?= csrf_field() ?>

    <div class="card" style="margin-bottom:20px;">
        <div style="padding:15px 20px;border-bottom:1px solid #E5E7EB;display:flex;align-items:center;gap:8px;">
            <i data-lucide="newspaper" style="width:18px;height:18px;color:#1e3a5f;"></i>
            <h3 style="margin:0;color:#1e3a5f;font-size:15px;">بيانات الخبر</h3>
        </div>
        <div style="padding:20px;">
            <div class="form-group" style="margin-bottom:15px;">
                <label class="form-label">العنوان <span style="color:#DC2626;">*</span></label>
                <input type="text" name="title_ar" value="<?= e(old('title_ar')) ?>" class="form-input" required placeholder="عنوان الخبر">
            </div>

            <div style="display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:15px;">
                <div class="form-group">
                    <label class="form-label">الفئة <span style="color:#DC2626;">*</span></label>
                    <select name="category" class="form-select" required>
                        <?php foreach ($categories as $key => $label): ?>
                        <option value="<?= e($key) ?>" <?= old('category') === $key ? 'selected' : '' ?>><?= e($label) ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label">صورة الغلاف</label>
                    <input type="file" name="cover_image" class="form-input" accept="image/jpeg,image/png" style="padding:8px;">
                    <small style="color:#9CA3AF;font-size:11px;">JPG أو PNG، الحد الأقصى 5 ميجابايت</small>
                </div>
            </div>

            <div class="form-group">
                <label class="form-label">المحتوى <span style="color:#DC2626;">*</span></label>
                <textarea name="body_ar" class="form-input" rows="12" required placeholder="اكتب محتوى الخبر هنا..." style="line-height:1.8;"><?= e(old('body_ar')) ?></textarea>
            </div>
        </div>
    </div>

    <div style="display:flex;justify-content:flex-start;gap:10px;">
        <button type="submit" class="btn btn-primary"><i data-lucide="save" style="width:16px;height:16px;vertical-align:middle;margin-left:4px;"></i> حفظ كمسودة</button>
        <a href="/news" class="btn btn-outline">إلغاء</a>
    </div>
</form>

<?php $__template->endSection(); ?>
