<?php $pageTitle = 'Teachers'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Manage teachers and lecturers</p>
    <a href="<?= base_url('admin/teacher-create') ?>" class="btn-cix btn-cix-accent btn-cix-sm"><i class="fas fa-plus"></i> Add Teacher</a>
</div>
<div class="card-cix mb-4">
    <form method="GET" action="<?= base_url('admin/teachers') ?>" class="row g-3 align-items-end">
        <div class="col-md-6"><label class="form-label-cix">Search</label><input type="text" name="search" class="form-control-cix" placeholder="Name or email..." value="<?= e($search ?? '') ?>"></div>
        <div class="col-md-2"><button type="submit" class="btn-cix btn-cix-primary"><i class="fas fa-search"></i></button></div>
    </form>
</div>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix">
            <thead><tr><th>Name</th><th>Email</th><th>Specialization</th><th>Experience</th><th>Status</th></tr></thead>
            <tbody>
            <?php if (empty($teachers)): ?>
                <tr><td colspan="5" class="text-center text-secondary p-4">No teachers found</td></tr>
            <?php else: ?>
                <?php foreach ($teachers as $t): ?>
                <tr>
                    <td><strong><?= e($t['first_name'] . ' ' . $t['last_name']) ?></strong></td>
                    <td class="text-secondary"><?= e($t['email']) ?></td>
                    <td><?= e($t['specialization'] ?? '-') ?></td>
                    <td><?= (int)($t['experience_years'] ?? 0) ?> years</td>
                    <td><span class="badge-cix <?= $t['teacher_active'] ? 'badge-active' : 'badge-rejected' ?>"><?= $t['teacher_active'] ? 'Active' : 'Inactive' ?></span></td>
                </tr>
                <?php endforeach; ?>
            <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
