<?php
$current = basename($_SERVER['PHP_SELF']);

if (!function_exists('active')) {
    function active($name, $current) {
        return $name === $current ? "active" : "";
    }
}
?>

<aside class="sidebar">
  <div class="brand">
    <div class="brand-badge"><i class="bi bi-box-seam"></i></div>
    <div>
      <div class="brand-title">Smart Drop Point</div>
      <div class="brand-sub">Monitoring & Auth Resi</div>
    </div>
  </div>

  <nav class="nav flex-column mt-3">
    <a class="nav-link <?= active('index.php', $current) ?>" href="/smart-drop-point/public/index.php">
      <i class="bi bi-speedometer2 me-2"></i>Dashboard
    </a>

    <a class="nav-link <?= active('resi.php', $current) ?>" href="/smart-drop-point/public/resi.php">
      <i class="bi bi-upc-scan me-2"></i>Data Resi
    </a>

    <a class="nav-link <?= active('log.php', $current) ?>" href="/smart-drop-point/public/log.php">
      <i class="bi bi-clock-history me-2"></i>Log Akses
    </a>

    <div class="nav-divider"></div>

    <a class="nav-link <?= active('resi_add.php', $current) ?>" href="/smart-drop-point/public/resi_add.php">
      <i class="bi bi-plus-circle me-2"></i>Tambah Resi
    </a>

    <a class="nav-link <?= active('upload_barcode.php', $current) ?>" href="/smart-drop-point/public/upload_barcode.php">
      <i class="bi bi-cloud-arrow-up me-2"></i>Upload Foto Barcode (Mock)
    </a>
  </nav>

  <div class="sidebar-footer">
    <div class="small text-muted">TA: Smart Pickup/Drop Point IoT</div>
  </div>
</aside>

<main class="main">
  <header class="topbar">
    <div class="topbar-left">
    </div>

    <div class="topbar-right">
      <div class="topbar-user">
        <div class="avatar">TA</div>
        <div>
          <div class="fw-semibold">Monitoring</div>
          <div class="small text-muted">ESP32-CAM + Barcode</div>
        </div>
      </div>
    </div>
  </header>

  <section class="content">