<?php $pageTitle = 'My Courses'; ?>
<div class="d-flex justify-content-between align-items-center mb-4">
    <p class="text-secondary mb-0">Your enrolled courses</p>
</div>
<?php if (empty($enrollments)): ?>
    <div class="empty-state"><i class="fas fa-book-open"></i><h5>No Courses Yet</h5><p>You haven't been enrolled yet. Contact support or check your payment status.</p></div>
<?php else: ?>
<div class="row g-4">
    <?php foreach ($enrollments as $en): ?>
    <div class="col-md-6 col-lg-4">
        <div class="course-card">
            <div class="course-thumb"><i class="fas fa-brain"></i><span class="course-level"><?= e($en['duration_hours'] ?? 0) ?>h</span></div>
            <div class="course-body">
                <h5><?= e($en['course_title']) ?></h5>
                <p class="small"><?= e($en['subtitle'] ?? '') ?></p>
                <div class="progress-cix mt-2"><div class="progress-cix-bar orange" style="width:<?= (int)($en['progress_percent'] ?? 0) ?>%"></div></div>
                <small class="text-secondary"><?= (int)($en['progress_percent'] ?? 0) ?>% complete</small>
                <div class="mt-3">
                    <a href="<?= base_url('student/course/' . e($en['course_title'])) ?>" class="btn-cix btn-cix-primary btn-cix-sm"><i class="fas fa-play"></i> Continue</a>
                </div>
            </div>
        </div>
    </div>
    <?php endforeach; ?>
</div>
<?php endif; ?>
