<!DOCTYPE html>
<html lang="id">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="app-url" content="<?= APP_URL ?>">
  <title><?= e($title ?? 'SINERGI') ?> — Dashboard Eksekutif</title>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
  <link rel="stylesheet" href="<?= asset('css/app.css') ?>">
  <style>
    :root { --clr-sidebar-bg: #1a0533; }
    .sidebar-brand-icon { background: #7c3aed !important; }
  </style>
  <?php if (isset($extraCss)) echo $extraCss; ?>
</head>
<body>
<div class="app-shell">
  <aside class="sidebar">
    <div class="sidebar-brand">
      <div class="sidebar-brand-icon">🏛</div>
      <div class="sidebar-brand-text">
        <h1>SINERGI</h1>
        <p>Dashboard Eksekutif</p>
      </div>
    </div>

    <div style="padding:14px 16px;background:rgba(255,255,255,0.06);margin:12px;border-radius:8px;text-align:center;">
      <div style="font-size:1.8rem;margin-bottom:4px;">🏛</div>
      <div style="font-size:0.88rem;color:#fff;font-weight:700;">Wali Kota Pontianak</div>
      <div style="font-size:0.75rem;color:rgba(255,255,255,0.5);">Dashboard Hanya Baca</div>
    </div>

    <div class="sidebar-section">
      <div class="sidebar-section-title">Menu</div>
      <ul class="sidebar-nav">
        <li><a href="<?= APP_URL ?>/walikota/dashboard" class="active"><span class="nav-icon">📊</span> Dashboard Eksekutif</a></li>
      </ul>
    </div>

    <div style="padding:16px;margin:0 12px;background:rgba(124,58,237,0.12);border-radius:8px;border:1px solid rgba(124,58,237,0.2);">
      <div style="font-size:0.72rem;color:rgba(255,255,255,0.5);margin-bottom:4px;">ℹ️ Mode Akses</div>
      <div style="font-size:0.78rem;color:rgba(255,255,255,0.7);">Hanya dapat melihat data. Tidak dapat mengubah data apapun.</div>
    </div>

    <div class="sidebar-footer">
      <div class="sidebar-user">
        <div class="sidebar-user-avatar" style="background:#7c3aed"><?= strtoupper(substr($user['nama'] ?? 'W', 0, 1)) ?></div>
        <div class="sidebar-user-info">
          <div class="sidebar-user-name"><?= e($user['nama'] ?? '') ?></div>
          <div class="sidebar-user-role">Wali Kota</div>
        </div>
        <a href="<?= APP_URL ?>/logout" class="sidebar-logout" title="Logout">⏻</a>
      </div>
    </div>
  </aside>

  <header class="topbar">
    <div class="topbar-title"><?= e($title ?? '') ?></div>
    <div class="topbar-actions">
      <span style="font-size:0.78rem;color:#7c3aed;font-weight:600;background:#f3e8ff;padding:4px 10px;border-radius:20px;">🏛 Wali Kota — Read Only</span>
      <span class="topbar-time" id="live-clock"></span>
    </div>
  </header>

  <main class="main-content">
    <?= $content ?>
  </main>
</div>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet.heat@0.2.0/dist/leaflet-heat.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<script src="<?= asset('js/app.js') ?>"></script>
<?php if (isset($extraJs)) echo $extraJs; ?>
</body>
</html>
