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

if(!empty($_POST['course_id']))
$course_id=$_POST['course_id'];
else if(!empty($_GET['course_id']))
$course_id=$_GET['course_id'];
else
$course_id='';

$latest_news=get_titles($course_id);
?>
<style>
body{
background:#f4f6fb;
font-family:Poppins;
}


.course-title{
text-align:center;
font-size:38px;
font-weight:700;
color:#ff7a00;
margin:40px 0;
animation:fadein 1s ease;
}

@keyframes fadein{
from{opacity:0;transform:translateY(-20px)}
to{opacity:1;transform:translateY(0)}
}

.chapter-card{
display:flex;
align-items:center;
justify-content:space-between;
background:white;
padding:25px;
border-radius:20px;
margin-bottom:25px;
box-shadow:0 8px 20px rgba(0,0,0,0.08);
transition:0.4s;
position:relative;
overflow:hidden;
}

.chapter-card:hover{
transform:translateY(-8px);
box-shadow:0 20px 40px rgba(0,0,0,0.15);
}

.chapter-card::before{
content:"";
position:absolute;
left:0;
top:0;
height:100%;
width:0%;
/*background:linear-gradient(90deg,#ff7a00,#ffc107);*/
background:linear-gradient(90deg, #7e52d6, #42286f);
transition:0.5s;
z-index:0;
}

.chapter-card:hover::before{
width:100%;
opacity:0.1;
}

.chapter-icon{
width:60px;
height:60px;
background:linear-gradient(45deg, #8458de, #8155da);
/*background:linear-gradient(45deg,#ff7a00,#ffb300);*/
border-radius:50%;
display:flex;
align-items:center;
justify-content:center;
color:white;
font-size:26px;
animation:iconPulse 2s infinite;
}

@keyframes iconPulse{
0%{transform:scale(1)}
50%{transform:scale(1.1)}
100%{transform:scale(1)}
}

.chapter-info{
flex:1;
margin-left:20px;
z-index:1;
}

.chapter-name{
font-weight:600;
font-size:18px;
color:#003366;
}

.video-count{
font-size:14px;
color:#0d6efd;
}

.action-buttons{
display:flex;
gap:15px;
z-index:1;
}

.btn-action{
padding:8px 18px;
border-radius:30px;
border:2px solid #e0e0e0;
background:white;
transition:0.3s;
font-weight:500;
cursor:pointer;
}

.btn-action:hover{
background:#0d6efd;
color:white;
transform:scale(1.05);
border-color:#0d6efd;
}

.btn-action i{
margin-right:6px;
}

</style>



<div class="container"> <input type="hidden" name="course_id" value="<?php echo $course_id; ?>" />

    <div class="course-title"> <?php echo get_course_name($course_id);?></div>
    <?php
		for($i=0;$i<count($latest_news);$i++)
		{
			if($latest_news[$i]['status']==0)
			$clr="primary";
			else
			$clr="success";
			
			$videos=get_videos_count($course_id,$latest_news[$i]['lesson_title']);
			
			if(empty($latest_news[$i]['video_url']) && empty($latest_news[$i]['video_upload']))
				$video_details="#";
			if(!empty($latest_news[$i]['video_url']) && empty($latest_news[$i]['video_upload']))
				$video_details=$latest_news[$i]['video_url'];
			if(empty($latest_news[$i]['video_url']) && !empty($latest_news[$i]['video_upload']))
				$video_details="instructor/lessons_uploads/".$latest_news[$i]['video_upload'];
				
			if(empty($latest_news[$i]['material_url']) && empty($latest_news[$i]['material_upload']))
				$meterial_details="#";
			if(!empty($latest_news[$i]['material_url']) && empty($latest_news[$i]['material_upload']))
				$meterial_details=$latest_news[$i]['material_url'];
			if(empty($latest_news[$i]['material_url']) && !empty($latest_news[$i]['material_upload']))
				$meterial_details="instructor/lessons_uploads/".$latest_news[$i]['material_upload'];
			
			if(empty($latest_news[$i]['assignment_upload']))
				$text_details="#";
			if(!empty($latest_news[$i]['assignment_upload']))
				$text_details="instructor/lessons_uploads/".$latest_news[$i]['assignment_upload'];
			
				
			
	?> 
        <div class="chapter-card">
            <div class="chapter-icon">
            	<i class="bi bi-calculator"></i>
            </div>
		   
        <div class="chapter-info">
            <div class="chapter-name">1.<?php echo $latest_news[$i]['lesson_title']; ?></div>
            <div class="video-count"><?php echo count($videos); ?> Videos</div>
        </div>
    
        <div class="action-buttons">
           <a href="<?php echo $video_details; ?>" target="_blank" style="text-decoration:none">
                <div class="btn-action">
                    <i class="bi bi-play-circle"></i>Videos
                </div>
            </a>
            
            <a href="<?php echo $meterial_details; ?>" target="_blank" style="text-decoration:none">
            <div class="btn-action">
            	<i class="bi bi-book"></i>Material
            </div>
            </a>
            
            <a href="<?php echo $text_details; ?>" target="_blank" style="text-decoration:none">
            <div class="btn-action">
           		<i class="bi bi-pencil-square"></i>Test
            </div>
            </a>
        </div>
         
    </div>
   <?php } ?>
    
    

</div>

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





