<?php

$activeAdminPage = $activeAdminPage ?? 'dashboard';
$adminNavItems = [
    'dashboard' => ['route' => 'admin', 'icon' => 'bi-speedometer2', 'label' => 'Tổng quan'],
    'users' => ['route' => 'admin/users', 'icon' => 'bi-people', 'label' => 'Người dùng'],
    'permissions' => ['route' => 'admin/permissions', 'icon' => 'bi-shield-lock', 'label' => 'Phân quyền'],
    'moderation' => ['route' => 'admin/moderation', 'icon' => 'bi-file-earmark-text', 'label' => 'Bài viết'],
    'logs' => ['route' => 'admin/activity-logs', 'icon' => 'bi-journal-text', 'label' => 'Activity Logs'],
    'settings' => ['route' => 'admin/system-settings', 'icon' => 'bi-gear', 'label' => 'System Settings']
];
?>

<aside class="admin-sidebar">
    <div class="admin-sidebar-brand">
        <div class="admin-sidebar-icon"><i class="bi bi-shield-check"></i></div>
        <div><small>Quản trị</small><strong>PET SPA</strong></div>
        <button class="sidebar-toggle" type="button" aria-label="Mở menu Admin" aria-expanded="false"><i class="bi bi-list"></i></button>
    </div>
    <nav class="admin-menu" aria-label="Menu Admin">
        <?php foreach ($adminNavItems as $key => $item): ?>
            <a class="<?= $activeAdminPage === $key ? 'active' : '' ?>" href="<?= BASE_URL ?>/?url=<?= htmlspecialchars($item['route']) ?>"><i class="bi <?= htmlspecialchars($item['icon']) ?>"></i><span><?= htmlspecialchars($item['label']) ?></span></a>
        <?php endforeach; ?>
        <form method="post" action="<?= BASE_URL ?>/?url=logout"><input type="hidden" name="_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>"><button class="admin-menu-logout" type="submit"><i class="bi bi-box-arrow-right"></i><span>Đăng xuất</span></button></form>
    </nav>
</aside>
