<?php $pageTitle = 'Create Course'; ?>
<div class="mb-3"><a href="<?= base_url('teacher/courses') ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back to Courses</a></div>
<div class="card-cix">
    <div class="card-cix-header"><h5 class="mb-0"><i class="fas fa-plus-circle text-orange me-2"></i> New Course</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><i class="fas fa-exclamation-circle"></i> <?= $error ?></div><?php endif; ?>
    <?php if (!empty($success)): ?><div class="alert-cix alert-cix-success"><i class="fas fa-check-circle"></i> <?= $success ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('teacher/course-create') ?>">
        <?= csrf_field() ?>
        <div class="row g-3">
            <div class="col-md-8"><div class="form-group-cix"><label class="form-label-cix">Title *</label><input type="text" name="title" class="form-control-cix" required></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Duration (hours)</label><input type="number" name="duration_hours" class="form-control-cix" value="0"></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Subtitle</label><input type="text" name="subtitle" class="form-control-cix"></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="4"></textarea></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Category</label><select name="category_id" class="form-control-cix"><option value="">None</option><?php foreach ($categories as $cat): ?><option value="<?= $cat['id'] ?>"><?= e($cat['name']) ?></option><?php endforeach; ?></select></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Level</label><select name="level_id" class="form-control-cix"><option value="">None</option><?php foreach ($levels as $lvl): ?><option value="<?= $lvl['id'] ?>"><?= e($lvl['name']) ?></option><?php endforeach; ?></select></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Pass Mark (%)</label><input type="number" name="pass_mark" class="form-control-cix" value="50" min="0" max="100"></div></div>
            <div class="col-md-4"><div class="form-group-cix"><label class="form-label-cix">Certificate Eligible</label><select name="certificate_eligible" class="form-control-cix"><option value="1">Yes</option><option value="0">No</option></select></div></div>
            <div class="col-md-4"><div class="form-group-cix"><div class="form-check form-check-inline mt-4"><input class="form-check-input" type="checkbox" name="is_published" value="1"><label class="form-check-label text-secondary">Publish</label></div></div></div>
        </div>
        <button type="submit" class="btn-cix btn-cix-accent mt-3"><i class="fas fa-save"></i> Create Course</button>
    </form>
</div>
