<?php $pageTitle = 'Add Question'; ?>
<div class="mb-3"><a href="<?= base_url('admin/question-bank/' . $bank['id']) ?>" class="text-secondary"><i class="fas fa-arrow-left me-1"></i> Back to <?= e($bank['name']) ?></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 Question</h5></div>
    <?php if (!empty($error)): ?><div class="alert-cix alert-cix-error"><?= $error ?></div><?php endif; ?>
    <form method="POST" action="<?= base_url('admin/question-create/' . $bank['id']) ?>">
        <?= csrf_field() ?>
        <div class="row g-3">
            <div class="col-md-6"><div class="form-group-cix"><label class="form-label-cix">Type</label><select name="question_type" class="form-control-cix"><option value="multiple_choice">Multiple Choice</option><option value="true_false">True/False</option><option value="short_answer">Short Answer</option></select></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Difficulty</label><select name="difficulty" class="form-control-cix"><option value="easy">Easy</option><option value="medium" selected>Medium</option><option value="hard">Hard</option></select></div></div>
            <div class="col-md-3"><div class="form-group-cix"><label class="form-label-cix">Points</label><input type="number" name="points" class="form-control-cix" value="1" min="1"></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Question Text *</label><textarea name="question_text" class="form-control-cix" rows="3" required></textarea></div></div>
            <div class="col-12"><label class="form-label-cix">Options</label></div>
            <div class="row g-2 mb-2"><div class="col-11"><input type="text" name="option_text[]" class="form-control-cix" placeholder="Option 1" required></div><div class="col-1 text-center"><input type="radio" name="correct_option" value="0" checked></div></div>
            <div class="row g-2 mb-2"><div class="col-11"><input type="text" name="option_text[]" class="form-control-cix" placeholder="Option 2" required></div><div class="col-1 text-center"><input type="radio" name="correct_option" value="1"></div></div>
            <div class="row g-2 mb-2"><div class="col-11"><input type="text" name="option_text[]" class="form-control-cix" placeholder="Option 3"></div><div class="col-1 text-center"><input type="radio" name="correct_option" value="2"></div></div>
            <div class="row g-2 mb-2"><div class="col-11"><input type="text" name="option_text[]" class="form-control-cix" placeholder="Option 4"></div><div class="col-1 text-center"><input type="radio" name="correct_option" value="3"></div></div>
            <div class="col-12"><div class="form-group-cix"><label class="form-label-cix">Explanation</label><textarea name="explanation" class="form-control-cix" rows="2"></textarea></div></div>
        </div>
        <button type="submit" class="btn-cix btn-cix-accent mt-2"><i class="fas fa-save"></i> Add Question</button>
    </form>
</div>
