<?php
$stmt = $conn->query("SELECT school_name, school_logo, school_favicon FROM administratives LIMIT 1");
if ($stmt && $stmt->num_rows > 0) {
    $adminData = $stmt->fetch_assoc();
    $school_name = $adminData['school_name'] ?? 'CBT Admin Panel';
    $school_logo = !empty($adminData['school_logo']) ? $adminData['school_logo'] : null;
    $school_favicon = !empty($adminData['school_favicon']) ? $adminData['school_favicon'] : null;
}
?>
<?php
$student_name = '';
$student_photo = ''; // fallback photo

if (isset($_SESSION['student_id'])) {
    $student_id = $_SESSION['student_id'];
    $stmt = $conn->prepare("SELECT firstname, lastname, passport FROM students WHERE id = ? LIMIT 1");
    $stmt->bind_param("i", $student_id);
    $stmt->execute();
    $result = $stmt->get_result();
    if ($result && $result->num_rows > 0) {
        $student = $result->fetch_assoc();
        $student_name = $student['firstname'] . ' ' . $student['lastname'];
        $student_photo = !empty($student['passport']) ? $student['passport'] : $student_photo;
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><?= htmlspecialchars($school_name) ?> - Student Panel</title>

  <!-- Favicon -->
  <?php if (!empty($school_favicon)): ?>
    <link rel="icon" href="../../<?= htmlspecialchars($school_favicon) ?>" type="image/x-icon">
  <?php endif; ?>

  <!-- AdminLTE & Icons -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
  
  <!-- FullCalendar CSS -->
  <link href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.global.min.css" rel="stylesheet" />

  <style>
    .content-wrapper {
      overflow-y: auto;
      max-height: calc(100vh - 114px); /* Adjust for header + footer height */
    }
  </style>
</head>
<div class="wrapper">
