<?php $__env->startSection('title', 'My Courses - Edunetra'); ?>

<?php $__env->startSection('content'); ?>
<!-- Page Header -->
<section class="bg-edunetra-dark text-white py-5">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-lg-8">
                <h1 class="display-4 fw-bold mb-3">My Courses</h1>
                <p class="fs-5 text-light opacity-90">Track your learning progress and continue your education journey</p>
            </div>
            <div class="col-lg-4 text-lg-end">
                <a href="<?php echo e(route('courses.public')); ?>" class="btn btn-edunetra btn-lg">
                    <i class="bi bi-plus-circle me-2"></i>Browse More Courses
                </a>
            </div>
        </div>
    </div>
</section>

<!-- My Courses Content -->
<section class="py-5 bg-light">
    <div class="container">
        <?php if($enrollments->count() > 0): ?>
            <div class="row g-4">
                <?php $__currentLoopData = $enrollments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $enrollment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php
                        $course = $enrollment->course;
                        $progressPercentage = $enrollment->progress;
                    ?>
                    <div class="col-lg-6 col-xl-4">
                        <div class="card h-100 border-0 shadow-sm">
                            <div class="card-img-top bg-light d-flex align-items-center justify-content-center" style="height: 180px;">
                                <?php if($course->image): ?>
                                    <img src="<?php echo e($course->image); ?>" alt="<?php echo e($course->title); ?>" class="img-fluid rounded-top" style="object-fit: cover; height: 100%; width: 100%;">
                                <?php else: ?>
                                    <div class="text-center text-muted">
                                        <i class="bi bi-book fs-1 mb-2"></i>
                                        <p class="mb-0 small"><?php echo e(Str::limit($course->title, 20)); ?></p>
                                    </div>
                                <?php endif; ?>
                            </div>

                            <div class="card-body d-flex flex-column">
                                <div class="d-flex justify-content-between align-items-center mb-2">
                                    <span class="badge bg-edunetra-yellow text-dark">
                                        <?php echo e(ucfirst($course->level)); ?>

                                    </span>
                                    <small class="text-muted">
                                        <i class="bi bi-calendar"></i> Enrolled <?php echo e($enrollment->enrolled_at->format('M d, Y')); ?>

                                    </small>
                                </div>

                                <h5 class="card-title fw-bold mb-2"><?php echo e($course->title); ?></h5>
                                <p class="card-text text-muted small flex-grow-1"><?php echo e(Str::limit($course->description, 80)); ?></p>

                                <!-- Progress Bar -->
                                <div class="mb-3">
                                    <div class="d-flex justify-content-between align-items-center mb-2">
                                        <small class="text-muted">Progress</small>
                                        <small class="text-muted"><?php echo e($progressPercentage); ?>%</small>
                                    </div>
                                    <div class="progress" style="height: 8px;">
                                        <div class="progress-bar bg-edunetra-yellow" role="progressbar" 
                                             style="width: <?php echo e($progressPercentage); ?>%" 
                                             aria-valuenow="<?php echo e($progressPercentage); ?>" 
                                             aria-valuemin="0" aria-valuemax="100"></div>
                                    </div>
                                </div>

                                <!-- Course Info -->
                                <div class="mb-3">
                                    <div class="d-flex justify-content-between align-items-center mb-1">
                                        <small class="text-muted">
                                            <i class="bi bi-person"></i> <?php echo e($course->teacher->name); ?>

                                        </small>
                                        <small class="text-muted">
                                            <i class="bi bi-list-ol"></i> <?php echo e($course->sessions->count()); ?> sessions
                                        </small>
                                    </div>
                                </div>

                                <!-- Action Buttons -->
                                <div class="d-grid gap-2">
                                    <a href="<?php echo e(route('courses.show', $course->slug)); ?>" class="btn btn-edunetra">
                                        <?php if($progressPercentage > 0): ?>
                                            <i class="bi bi-play-circle me-1"></i>Continue Learning
                                        <?php else: ?>
                                            <i class="bi bi-play-circle me-1"></i>Start Course
                                        <?php endif; ?>
                                    </a>
                                    <a href="<?php echo e(route('courses.progress', $course)); ?>" class="btn btn-outline-edunetra btn-sm">
                                        <i class="bi bi-graph-up me-1"></i>View Progress
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </div>
        <?php else: ?>
            <div class="text-center py-5">
                <i class="bi bi-collection display-1 text-muted mb-3"></i>
                <h3 class="fw-bold mb-2">No Enrolled Courses</h3>
                <p class="text-muted mb-4">You haven't enrolled in any courses yet. Start your learning journey today!</p>
                <div class="row justify-content-center">
                    <div class="col-md-6">
                        <div class="card border-0 shadow-sm">
                            <div class="card-body p-4">
                                <h5 class="fw-bold text-edunetra-dark mb-3">How to Get Started:</h5>
                                <ol class="text-start text-muted">
                                    <li class="mb-2">Browse available courses in the <strong>COURSES</strong> section</li>
                                    <li class="mb-2">Click on any course to view details and curriculum</li>
                                    <li class="mb-2">Click <strong>"Enroll Now"</strong> to join the course</li>
                                    <li class="mb-2">Return here to access your enrolled courses and track progress</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                </div>
                <a href="<?php echo e(route('courses.public')); ?>" class="btn btn-edunetra btn-lg">
                    <i class="bi bi-search me-2"></i>Browse Available Courses
                </a>
            </div>
        <?php endif; ?>
    </div>
</section>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/reihanpraja/ProjectWork/edunetra/resources/views/student/my-courses.blade.php ENDPATH**/ ?>