<?php $pageTitle = 'Lessons'; ?>
<div class="mb-4"><p class="text-secondary">All lessons across courses and modules</p></div>
<?php if (empty($lessons)): ?>
    <div class="empty-state"><i class="fas fa-file-alt"></i><h5>No Lessons</h5><p>Create lessons from the course module builder.</p></div>
<?php else: ?>
<div class="card-cix">
    <div class="table-responsive">
        <table class="table-cix"><thead><tr><th>#</th><th>Lesson</th><th>Module</th><th>Course</th><th>Type</th><th>Status</th></tr></thead>
        <tbody><?php foreach ($lessons as $i => $l): ?>
        <tr><td><?= $i + 1 ?></td><td><strong><?= e($l['title']) ?></strong></td><td class="text-secondary"><?= e($l['module_title'] ?? '') ?></td>
        <td class="text-secondary"><?= e($l['course_title'] ?? '') ?></td><td><span class="badge-cix badge-submitted"><?= ucfirst($l['lesson_type']) ?></span></td>
        <td><span class="badge-cix <?= $l['is_published'] ? 'badge-active' : 'badge-pending' ?>"><?= $l['is_published'] ? 'Published' : 'Draft' ?></span></td></tr>
        <?php endforeach; ?></tbody></table>
    </div>
</div>
<?php endif; ?>
