<?php include_once('header.php'); 

if(!empty($_POST['child_id']))
$child_id=$_POST['mid'];
else if(!empty($_GET['child_id']))
$child_id=$_GET['child_id'];
else
$child_id='';
?>

<style>

/* Space for scrolling */
.spacer {
    height: 100px;
}

/* Course Card */
.course-card {
    padding: 25px;
    border: 1px solid #eee;
    border-radius: 12px;
    margin-bottom: 40px;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s;
    will-change: transform;
}

/* Hover */
.course-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* Text */
.course-title {
    font-size: 20px;
    font-weight: 600;
}

.course-desc {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* Button */
.course-btn {
    margin-top: 12px;
    border-radius: 20px;
}

</style>


<div class="container py-5">
   <?php 		 
		$sql=executework("SELECT * FROM lms_cart_list cl JOIN lms_cart_course cc ON cc.cart_id = cl.cart_id JOIN lms_instructor_courses ic ON ic.id = cl.purchage_course_id
WHERE cl.child_id = '".$child_id."' AND cl.parent_id = '".$_SESSION['login_id']."' AND cc.order_status = 'completed'");
		 	$cntt=@mysqli_num_rows($sql);
			if(mysqli_num_rows($sql)>0)
			{
				
				while($row=mysqli_fetch_assoc($sql))
				{
	?>
    <div class="course-card parallax" data-speed="2">
        <div class="course-title">Full Stack Development</div>
        <div class="course-desc">Learn frontend and backend with real-time projects.</div>
        <button class="btn btn-primary course-btn">View Course</button>
    </div>
	<?php } } if($cntt==0){ ?>
    	<div> <center> <strong class="text-danger"> No Courses Available <a href="view_courses.php?child_id=<?php echo $_GET['child_id']; ?>" style="text-decoration:none"> Enrol Now </a> </strong></center></div>
    <?php } ?>
</div>

<script>

// Parallax Scroll Effect
window.addEventListener("scroll", () => {
    const cards = document.querySelectorAll(".parallax");

    cards.forEach(card => {
        const speed = card.getAttribute("data-speed");
        const y = window.scrollY;

        card.style.transform = `translateY(${y / speed}px)`;
    });
});

</script>


<?php include_once('footer.php'); ?>