<?php
declare(strict_types=1);

if (!isset($pageTitle)) $pageTitle = 'Admin';
$csrf = csrf_token();
$flash = flash_get();
?>
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title><?= htmlspecialchars($pageTitle) ?></title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="/css/admin.css">
  <?php if (!empty($extraCss)): ?>
    <?php foreach ((array)$extraCss as $css): ?>
      <link rel="stylesheet" href="<?= htmlspecialchars((string)$css) ?>">
    <?php endforeach; ?>
  <?php endif; ?>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark">
  <div class="container py-3">
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="nav">
      <ul class="navbar-nav ms-auto gap-1">
        <li class="nav-item"><a class="nav-link" href="/public/admin/projects.php">Projects</a></li>
        <li class="nav-item"><a class="nav-link" href="/public/admin/skills.php">Skills</a></li>
        <li class="nav-item"><a class="nav-link" href="/public/admin/contacts.php">Contacts</a></li>
        <li class="nav-item"><a class="nav-link" href="/">View site</a></li>
        <li class="nav-item"><a class="nav-link" href="/public/admin/logout.php">Logout</a></li>
      </ul>
    </div>
  </div>
</nav>

<div class="container pb-5">
  <?php if ($flash): ?>
    <div class="alert alert-<?= htmlspecialchars($flash['type']) ?> card-glass border-0 mt-3">
      <?= htmlspecialchars($flash['msg']) ?>
    </div>
  <?php endif; ?>
