<?php

$folder = "generated_pdfs/";

$files = glob($folder . "*.pdf");

?>

<!DOCTYPE html>
<html>
<head>
<title>Download Reports</title>

<style>
body{
background:#0b1020;
color:white;
font-family:Arial;
padding:30px;
}

.card{
background:#111827;
padding:25px;
border-radius:10px;
max-width:700px;
margin:auto;
}

a{
display:block;
margin:10px 0;
padding:10px;
background:#0ea5e9;
color:white;
text-decoration:none;
border-radius:6px;
width:300px;
text-align:center;
}

</style>
</head>

<body>

<div class="card">

<h2>Learning Style Reports</h2>

<?php

if(count($files)==0){
echo "No reports generated yet.";
}

foreach($files as $file){

$name = basename($file);

echo "<a href='$file' download>$name</a>";

}

?>

</div>

</body>
</html>