<!DOCTYPE html>
<html>
<head>
 <title>Attendance Report</title>
 <style>
 body { font-family: 'Helvetica', sans-serif; font-size: 10px; color: #333; margin: 0; padding: 0; }
 .header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid #3b82f6; padding-bottom: 10px; }
 .header h1 { margin: 0; font-size: 20px; color: #1e40af; }
 .header p { margin: 5px 0 0; color: #666; font-size: 12px; }
 .info { margin-bottom: 20px; width: 100%; }
 .info td { padding: 2px 0; }
 .table { width: 100%; border-collapse: collapse; margin-top: 10px; }
 .table th { background: #f8fafc; color: #475569; font-weight: bold; text-transform: uppercase; font-size: 9px; border: 1px solid #e2e8f0; padding: 8px; text-align: left; }
 .table td { border: 1px solid #e2e8f0; padding: 8px; vertical-align: top; }
 .status-present { color: #059669; font-weight: bold; }
 .status-absent { color: #dc2626; font-weight: bold; }
 .status-late { color: #d97706; font-weight: bold; }
 .footer { position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 8px; color: #94a3b8; padding: 10px 0; border-top: 1px solid #e2e8f0; }
 </style>
</head>
<body>
 <div class="header">
 <h1><?php echo $settings['institute_name'] ?? 'Training Management System'; ?></h1>
 <p>Student Attendance Report</p>
 </div>

 <table class="info">
 <tr>
 <td width="50%"><strong>Report Period:</strong> <?php echo date('d/m/Y', strtotime($params['from_date'])); ?> to <?php echo date('d/m/Y', strtotime($params['to_date'])); ?></td>
 <td width="50%" align="right"><strong>Generated On:</strong> <?php echo date('d/m/Y h:i A'); ?></td>
 </tr>
 </table>

 <table class="table">
 <thead>
 <tr>
 <th width="10%">Date</th>
 <th width="20%">Student Name</th>
 <th width="15%">Batch</th>
 <th width="10%">Status</th>
 <th width="15%">In / Out</th>
 <th width="30%">Remarks</th>
 </tr>
 </thead>
 <tbody>
 <?php if(empty($report)): ?>
 <tr><td colspan="6" align="center">No attendance records found.</td></tr>
 <?php else: ?>
 <?php foreach($report as $r): ?>
 <tr>
 <td><?php echo date('d M, Y', strtotime($r['date'])); ?></td>
 <td>
 <strong><?php echo $r['student_name']; ?></strong><br>
 <small><?php echo $r['student_code']; ?></small>
 </td>
 <td><?php echo $r['batch_name'] ?: 'N/A'; ?></td>
 <td class="status-<?php echo strtolower($r['status']); ?>">
 <?php echo $r['status']; ?>
 </td>
 <td>
 IN: <?php echo $r['in_time'] ? date('h:i A', strtotime($r['in_time'])) : '--:--'; ?><br>
 OUT: <?php echo $r['out_time'] ? date('h:i A', strtotime($r['out_time'])) : '--:--'; ?>
 </td>
 <td><?php echo htmlspecialchars($r['remarks'] ?: '-'); ?></td>
 </tr>
 <?php endforeach; ?>
 <?php endif; ?>
 </tbody>
 </table>

 <!-- Footer removed as per user request -->
</body>
</html>
>
