<?php
$backBaseUrl = env('BACK_BASE_URL');
?>
<?php echo view('header.php') ?>

<!-- Main Section -->
<div class="container py-5" style="margin-top:200px;">
    <div class="text-center mb-5">
        <h2 style="font-weight: 700; color: #0d6efd; font-size: 2.5rem; position: relative; display: inline-block;">
            <i class="bi bi-journal-bookmark-fill me-2"></i> Previous Year Question Papers
            <div style="height: 4px; width: 80%; background-color: #0d6efd; border-radius: 4px; margin: 8px auto 0;"></div>
        </h2>
        <p style="margin-top: 1rem; color: #6c757d; font-size: 1.25rem;">
            Download question papers from past years to help with your preparation.
        </p>
    </div>

    <!-- Custom Table -->
    <div style="background-color: #ffffff; border: 1px solid #dee2e6; border-radius: 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); padding: 25px; overflow-x: auto;">
        <table style="width: 100%; border-collapse: collapse; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
            <thead>
                <tr style="background-color: #0d6efd; color: white;">
                    <th style="padding: 14px; text-align: left;">Year</th>
                    <th style="padding: 14px; text-align: left;">Course Name</th>
                    <th style="padding: 14px; text-align: left;">Paper Name</th>
                    <th style="padding: 14px; text-align: left;">Paper Type</th>
                    <th style="padding: 14px; text-align: left;">Prof. Year</th>
                    <th style="padding: 14px; text-align: left;">Action</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if(!empty($papers)){
                    foreach($papers as $pap){
                        ?>
                        <tr style="border-bottom: 1px solid #dee2e6;" onmouseover="this.style.backgroundColor='#f8f9fa'" onmouseout="this.style.backgroundColor='white'">
                            <td style="padding: 14px;"><?php echo $pap['calender_year']?></td>
                            <td style="padding: 14px;"><?php echo $pap['course_name']?></td>
                            <td style="padding: 14px;"><?php echo $pap['paper_name']?></td>
                            <td style="padding: 14px;"><?php echo $pap['paper_type']?></td>
                            <td style="padding: 14px;"><?php echo $pap['prof_year']?></td>
                            <td style="padding: 14px;">
                                <a target="_blank" href="<?php echo $backBaseUrl?>public/<?php echo $pap['file']?>" style="padding: 6px 12px; background-color: #0d6efd; color: white; border-radius: 4px; text-decoration: none; font-size: 14px;">
                                    <i class="bi bi-download"></i> Download
                                </a>
                            </td>
                        </tr>
                        <?php
                    }
                }
                ?>
                
               
            </tbody>
        </table>
    </div>
</div>

<?php echo view('footer.php') ?>
