<?php $pageTitle = 'Create Package'; ?>
<div class="mb-3"><a href="<?= base_url('admin/packages') ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back</a></div>
<div class="card-cix">
    <div class="card-cix-header"><h5 class="mb-0"><i class="fas fa-box text-orange me-2"></i> New Package</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><?= $error ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('admin/package-create') ?>">
        <?= csrf_field() ?>
        <div class="row g-3">
            <div class="col-md-8"><div class="form-group-cix"><label class="form-label-cix">Name *</label><input type="text" name="name" class="form-control-cix" required></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Price (ZAR) *</label><input type="number" name="price" class="form-control-cix" step="0.01" required></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Description</label><textarea name="description" class="form-control-cix" rows="3"></textarea></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Duration (days)</label><input type="number" name="duration_days" class="form-control-cix" value="365"></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Trial Days</label><input type="number" name="trial_days" class="form-control-cix" value="0"></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Max Courses</label><input type="number" name="max_courses" class="form-control-cix" value="1"></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Sort Order</label><input type="number" name="sort_order" class="form-control-cix" value="0"></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Approval</label><select name="approval_type" class="form-control-cix"><option value="manual">Manual</option><option value="auto">Automatic</option></select></div></div>
            <div class="col-md-3"><div class="form-check mt-4"><input class="form-check-input" type="checkbox" name="certificate_eligible" value="1" checked><label class="form-check-label text-secondary">Certificate Eligible</label></div></div>
            <div class="col-md-3"><div class="form-check mt-4"><input class="form-check-input" type="checkbox" name="assessment_required" value="1" checked><label class="form-check-label text-secondary">Assessment Required</label></div></div>
            <div class="col-md-3"><div class="form-check mt-4"><input class="form-check-input" type="checkbox" name="is_active" value="1" checked><label class="form-check-label text-secondary">Active</label></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Include Courses</label><select name="course_ids[]" class="form-control-cix" multiple><?php foreach ($courses as $c): ?><option value="<?= $c['id'] ?>"><?= e($c['title']) ?></option><?php endforeach; ?></select></div></div>
        </div>
        <button type="submit" class="btn-cix btn-cix-accent mt-3"><i class="fas fa-save"></i> Create Package</button>
    </form>
</div>
