<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title><?= esc($title ?? 'Admin') ?> — LoanLMS</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="/assets/css/admin.css" rel="stylesheet">
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white py-3 shadow-sm">
  <div class="container-fluid">
    <a class="navbar-brand ms-3" href="/admin/dashboard">LoanLMS Admin</a>
    <div class="d-flex align-items-center me-3">
      <form class="d-none d-md-block me-3">
        <input class="form-control form-control-sm search-input" placeholder="Search loans, users..." />
      </form>
      <div class="me-3">
        <a class="btn btn-sm btn-outline-secondary" href="/" target="_blank">Go to site</a>
      </div>
      <div class="dropdown">
        <a class="d-flex align-items-center text-decoration-none dropdown-toggle" href="#" data-bs-toggle="dropdown">
          <img src="/assets/default-avatar.png" alt="admin" class="user-avatar me-2">
          <div class="small text-muted">Hello, <strong><?= esc(session()->get('user_name') ?? 'Admin') ?></strong></div>
        </a>
        <ul class="dropdown-menu dropdown-menu-end">
          <li><a class="dropdown-item" href="/admin/profile">Profile</a></li>
          <li><a class="dropdown-item" href="/logout">Logout</a></li>
        </ul>
      </div>
    </div>
  </div>
</nav>
<div class="container-fluid mt-4">
  <div class="row gx-4">
    <div class="col-md-3">
      <!-- Sidebar -->
      <div class="sidebar mb-4">
        <div class="mb-3">
          <div class="app-badge">Admin</div>
        </div>
        <nav class="nav flex-column">
          <a class="nav-link <?= (current_url(false) == base_url('/admin/dashboard') ? 'active':'' ) ?>" href="/admin/dashboard">Dashboard</a>
          <a class="nav-link <?= (strpos(current_url(false), '/admin/loans')!==false ? 'active':'' ) ?>" href="/admin/loans">Loans</a>
          <a class="nav-link <?= (strpos(current_url(false), '/admin/products')!==false ? 'active':'' ) ?>" href="/admin/products">Products</a>
          <a class="nav-link <?= (strpos(current_url(false), '/admin/users')!==false ? 'active':'' ) ?>" href="/admin/users">Users</a>
          <a class="nav-link" href="/admin/notifications">Notifications</a>
          <a class="nav-link" href="/admin/settings">Settings</a>
        </nav>
        <div class="footer-note mt-3">
          <div>Version 1.0</div>
          <div class="small-muted">Powered by LoanLMS</div>
        </div>
      </div>
    </div>
    <div class="col-md-9">
      <!-- main content -->
