<?php $pageTitle = 'Create Assignment'; ?>
<div class="mb-3"><a href="<?= base_url('admin/assignments') ?>" 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-plus-circle text-orange me-2"></i> New Assignment</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><?= $error ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('admin/assignment-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">Course *</label><select name="course_id" class="form-control-cix" required><option value="">Select...</option><?php foreach ($courses as $c): ?><option value="<?= $c['id'] ?>"><?= e($c['title']) ?></option><?php endforeach; ?></select></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-12"><div class="form-group-cix"><label class="form-label-cix">Instructions</label><textarea name="instructions" class="form-control-cix" rows="3"></textarea></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Max Score</label><input type="number" name="max_score" class="form-control-cix" value="100"></div></div>
            <div class="col-md-3"><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"></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Due Date</label><input type="datetime-local" name="due_date" class="form-control-cix"></div></div>
            <div class="col-md-3"><div class="form-check 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>
        <button type="submit" class="btn-cix btn-cix-accent mt-3"><i class="fas fa-save"></i> Create Assignment</button>
    </form>
</div>
