<?php
/**
 * app/views/layouts/app.php
 *
 * The shared shell every authenticated page renders inside, called by
 * BaseController::view(). $content is the rendered output of whatever
 * view the controller asked for; $activeNav drives sidebar highlighting
 * (see partials/sidebar.php). Structure/classes are ported directly
 * from the completed frontend templates (assets/css/style.css).
 */
$activeNav = $activeNav ?? '';
$pageTitle = $title ?? config('app.name');
?><!DOCTYPE html>
<html lang="<?= e(config('app.locale', 'en')) ?>">
<head>
    
    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-MFHPEGL9GK"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-MFHPEGL9GK');
    </script>


<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= e($pageTitle) ?> · A&amp;B Hub</title>
<?= \App\Core\Csrf::metaTag() ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
<link rel="stylesheet" href="<?= asset('css/style.css') ?>">
</head>
<body>

<div class="ab-shell" id="abShell">
  <div class="ab-sidebar-overlay" id="abSidebarOverlay"></div>

  <?php require __DIR__ . '/../partials/sidebar.php'; ?>

  <div class="ab-main">
    <?php require __DIR__ . '/../partials/topbar.php'; ?>

    <div class="ab-breadcrumb-strip">
      <div>
        <nav aria-label="breadcrumb"><ol class="breadcrumb">
          <?php foreach (($breadcrumbs ?? [['Home', 'dashboard']]) as $i => $crumb): [$label, $path] = $crumb; ?>
            <?php if ($i === count($breadcrumbs ?? [['Home','dashboard']]) - 1): ?>
              <li class="breadcrumb-item active" aria-current="page"><?= e($label) ?></li>
            <?php else: ?>
              <li class="breadcrumb-item"><a href="<?= base_url($path) ?>"><?= e($label) ?></a></li>
            <?php endif; ?>
          <?php endforeach; ?>
        </ol></nav>
        <h1><?= e($pageTitle) ?></h1>
      </div>
      <?php if (isset($headerActions)): ?><div><?= $headerActions ?></div><?php endif; ?>
    </div>

    <main class="ab-content ab-fade-in">
<?= $content ?>
    </main>
  </div>
</div>

<div class="toast-container position-fixed bottom-0 end-0 p-3" id="abToastContainer" style="z-index:1080;"></div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
<script src="<?= asset('js/charts-theme.js') ?>"></script>
<script src="<?= asset('js/main.js') ?>"></script>
<script src="<?= asset('js/app-data.js') ?>"></script>
</body>
</html>
