<?php
// includes/admin_layout_top.php
// Use at TOP of every admin page after auth/db are loaded.

$PAGE_TITLE     = $PAGE_TITLE     ?? 'Admin';
$BRANCH_OPTIONS = $BRANCH_OPTIONS ?? ''; // <option>…</option> list (optional)

?>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title><?= esc($PAGE_TITLE) ?> — EDEN LMS</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet">
  <style>
    :root{--blue:#1b2b78;--blue2:#263fa0;--ink:#0f172a;--bg:#f5f7fb}
    body{background:var(--bg);color:var(--ink)}
    .eden-topbar{background:linear-gradient(90deg,var(--blue),var(--blue2));color:#fff;height:50px;display:flex;align-items:center;padding:0 .75rem;position:sticky;top:0;z-index:1000}
    .eden-topbar .brand{font-weight:700;letter-spacing:.3px}
    .eden-topbar .branch select{background:rgba(255,255,255,.15);color:#fff;border:none}
    .eden-shell{display:flex;min-height:calc(100vh - 50px)}
    .eden-main{flex:1;padding:16px}
  </style>
</head>
<body>

<!-- TOP BAR -->
<div class="eden-topbar">
  <div class="brand">EDEN CAMPUS LEARNING MANAGEMENT SYSTEMS</div>
  <div class="ms-auto d-flex align-items-center gap-3">
    <?php if ($BRANCH_OPTIONS !== ''): ?>
      <form method="get" class="branch">
        <select name="branch_id" class="form-select form-select-sm" onchange="this.form.submit()">
          <?= $BRANCH_OPTIONS ?>
        </select>
      </form>
    <?php endif; ?>
    <div class="small"><i class="bi bi-person-circle me-1"></i><?= esc($_SESSION['user']['username'] ?? 'Admin') ?></div>
  </div>
</div>

<div class="eden-shell">
  <?php include __DIR__ . '/admin_sidebar.php'; ?>
  <main class="eden-main">
