<section class="features-section">
    <div class="container">
        <div class="text-center mb-4"><h2>Our <span style="color:var(--secondary)">Courses</span></h2><p class="text-secondary">Explore our comprehensive course catalogue</p></div>
        <div class="row g-4">
            <?php if (!empty($courses)): foreach ($courses as $course): ?>
            <div class="col-md-4">
                <div class="course-card">
                    <div class="course-thumb"><i class="fas fa-brain"></i><span class="course-level"><?= e($course['level_name'] ?? 'Beginner') ?></span></div>
                    <div class="course-body">
                        <span class="badge-cix badge-pending mb-2"><?= e($course['category_name'] ?? 'General') ?></span>
                        <h5><?= e($course['title']) ?></h5>
                        <p><?= e(substr($course['subtitle'] ?? '', 0, 120)) ?></p>
                        <div class="course-meta"><span><i class="fas fa-clock"></i> <?= $course['duration_hours'] ?? 0 ?>h</span><span><i class="fas fa-signal"></i> <?= e($course['level_name'] ?? 'Beginner') ?></span></div>
                        <a href="<?= base_url('course/' . $course['slug']) ?>" class="btn-cix btn-cix-primary btn-cix-sm w-100 mt-2">View Course</a>
                    </div>
                </div>
            </div>
            <?php endforeach; else: ?>
            <div class="col-12"><div class="empty-state"><i class="fas fa-book"></i><h5>No courses available yet</h5><p>Check back soon for new courses.</p></div></div>
            <?php endif; ?>
        </div>
    </div>
</section>
