<?php $pageTitle = 'My Courses'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Courses you manage</p>
    <a href="<?= base_url('teacher/course-create') ?>" class="btn-cix btn-cix-accent btn-cix-sm"><i class="fas fa-plus"></i> Create Course</a>
</div>
<?php if (empty($courses)): ?>
    <div class="empty-state"><i class="fas fa-book"></i><h5>No Courses</h5><p>You haven't created any courses yet.</p></div>
<?php else: ?>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix">
            <thead><tr><th>Course</th><th>Category</th><th>Status</th><th>Actions</th></tr></thead>
            <tbody>
            <?php foreach ($courses as $c): ?>
            <tr>
                <td><strong><?= e($c['title']) ?></strong><br><small class="text-secondary"><?= e($c['subtitle'] ?? '') ?></small></td>
                <td><?= e($c['category_name'] ?? '-') ?></td>
                <td><span class="badge-cix <?= $c['is_published'] ? 'badge-active' : 'badge-pending' ?>"><?= $c['is_published'] ? 'Published' : 'Draft' ?></span></td>
                <td><a href="<?= base_url('teacher/modules/' . $c['id']) ?>" class="btn-cix btn-cix-sm btn-cix-primary"><i class="fas fa-layer-group"></i> Modules</a></td>
            </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
<?php endif; ?>
