<?php $pageTitle = 'My Tests'; ?>
<div class="mb-4"><p class="text-secondary">Tests and quizzes you've created</p></div>
<?php if (empty($tests)): ?>
    <div class="empty-state"><i class="fas fa-laptop-code"></i><h5>No Tests</h5><p>Create tests from the admin panel or question bank.</p></div>
<?php else: ?>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix">
            <thead><tr><th>Test</th><th>Type</th><th>Course</th><th>Duration</th><th>Pass Mark</th><th>Status</th></tr></thead>
            <tbody>
            <?php 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><?= e($t['course_title']) ?></td>
                <td><?= (int)$t['duration_minutes'] ?> min</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; ?>
            </tbody>
        </table>
    </div>
</div>
<?php endif; ?>
