<?php $pageTitle = 'Question Banks'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Manage question banks for assessments</p>
    <a href="<?= base_url('admin/question-bank-create') ?>" class="btn-cix btn-cix-accent btn-cix-sm"><i class="fas fa-plus"></i> New Bank</a>
</div>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix"><thead><tr><th>Bank Name</th><th>Category</th><th>Difficulty</th><th>Questions</th><th>Actions</th></tr></thead>
        <tbody><?php if (empty($banks)): ?><tr><td colspan="5" class="text-center text-secondary p-4">No question banks</td></tr>
        <?php else: foreach ($banks as $b): ?>
        <tr><td><strong><?= e($b['name']) ?></strong><br><small class="text-secondary"><?= e($b['description'] ?? '') ?></small></td>
        <td class="text-secondary"><?= e($b['category'] ?? '-') ?></td><td><?= ucfirst(e($b['difficulty'])) ?></td>
        <td><?php $qc = $pdo->prepare("SELECT COUNT(*) FROM questions WHERE bank_id = ?"); $qc->execute([$b['id']]); echo $qc->fetchColumn(); ?></td>
        <td><a href="<?= base_url('admin/question-bank/' . $b['id']) ?>" class="btn-cix btn-cix-sm btn-cix-primary"><i class="fas fa-eye"></i> View</a></td></tr>
        <?php endforeach; endif; ?></tbody></table>
    </div>
</div>
