<%- include("navbar") %>

    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">

    <style>
        body {
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(135deg, #0f172a, #1e293b);
            min-height: 100vh;
        }

        /* Wrapper */
        .courses-wrapper {
            margin-left: 250px;
            margin-top: 90px;
            padding: 40px;
        }

        /* Header */
        .page-header {
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            padding: 35px;
            border-radius: 20px;
            color: white;
            box-shadow: 0 15px 40px rgba(99, 102, 241, 0.3);
            margin-bottom: 40px;
        }

        .page-header h2 {
            font-weight: 600;
            margin-bottom: 5px;
        }

        .page-header p {
            font-size: 14px;
            opacity: .9;
        }

        /* Grid */
        .course-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 30px;
        }

        /* Card */
        .course-card {
            background: white;
            padding: 25px;
            border-radius: 20px;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
            transition: .3s;
            position: relative;
            overflow: hidden;
        }

        .course-card:hover {
            transform: translateY(-6px);
        }

        .course-title {
            font-weight: 600;
            font-size: 18px;
            margin-bottom: 10px;
            color: #0f172a;
        }

        .course-desc {
            font-size: 13px;
            color: #64748b;
            margin-bottom: 15px;
        }

        /* Progress */
        .progress-container {
            background: #e2e8f0;
            height: 8px;
            border-radius: 20px;
            overflow: hidden;
            margin-bottom: 15px;
        }

        .progress-bar {
            height: 100%;
            width: 60%;
            background: linear-gradient(90deg, #6366f1, #22d3ee);
        }

        /* Button */
        .btn-open {
            display: inline-block;
            padding: 8px 15px;
            border-radius: 8px;
            background: linear-gradient(90deg, #6366f1, #22d3ee);
            color: white;
            font-size: 13px;
            text-decoration: none;
            box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
            transition: .3s;
        }

        .btn-open:hover {
            transform: translateY(-2px);
        }

        /* Badge */
        .badge {
            position: absolute;
            top: 15px;
            right: 15px;
            background: #22c55e;
            color: white;
            padding: 5px 10px;
            border-radius: 20px;
            font-size: 11px;
        }

        @media(max-width:992px) {
            .courses-wrapper {
                margin-left: 0;
                padding: 20px;
            }
        }
    </style>

    <div class="courses-wrapper">

        <!-- HEADER -->
        <div class="page-header">
            <h2>📚 My Courses</h2>
            <p>Continue learning and track your progress</p>
        </div>

        <!-- COURSES GRID -->
        <div class="course-grid">

            <% if(courses.length> 0){ %>

                <% courses.forEach(c=> { %>

                    <div class="course-card">

                        <span class="badge">Enrolled</span>

                        <div class="course-title">
                            <%= c.course_name %>
                        </div>

                        <div class="course-desc">
                            Start your journey in <%= c.course_name %> and enhance your skills.
                        </div>

                        <!-- Dummy Progress (You can make dynamic later) -->
                        <div class="progress-container">
                            <div class="progress-bar"></div>
                        </div>

                        <a href="/course/<%= c.course_id %>" class="btn-open">
                            Open Course →
                        </a>

                    </div>

                    <% }) %>

                        <% } else { %>

                            <p style="color:white;">No courses enrolled yet.</p>

                            <% } %>

        </div>

    </div>

    <%- include("footer") %>