<?php $pageTitle = 'CBT Tests'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Computer-Based Tests & Quizzes</p>
    <a href="<?= base_url('admin/test-create') ?>" class="btn-cix btn-cix-accent btn-cix-sm"><i class="fas fa-plus"></i> New Test</a>
</div>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix"><thead><tr><th>Test</th><th>Type</th><th>Course</th><th>Module</th><th>Duration</th><th>Pass</th><th>Status</th></tr></thead>
        <tbody><?php if (empty($tests)): ?><tr><td colspan="7" class="text-center text-secondary p-4">No tests</td></tr>
        <?php else: foreach ($tests as $t): ?>
        <tr><td><strong><?= e($t['title']) ?></strong></td><td><span class="badge-cix badge-submitted"><?= strtoupper($t['test_type']) ?></span></td>
        <td class="text-secondary"><?= e($t['course_title'] ?? '') ?></td><td class="text-secondary"><?= e($t['module_title'] ?? '-') ?></td>
        <td><?= (int)$t['duration_minutes'] ?>m</td><td><?= (int)$t['pass_mark'] ?>%</td>
        <td><span class="badge-cix <?= $t['is_published'] ? 'badge-active' : 'badge-pending' ?>"><?= $t['is_published'] ? 'Published' : 'Draft' ?></span></td></tr>
        <?php endforeach; endif; ?></tbody></table>
    </div>
</div>
