<?php
// Admin identity
$adminEmail = $_SESSION['admin_email'] ?? ($_SESSION['email'] ?? 'Admin');

// Get current page
$currentPage = basename($_SERVER['PHP_SELF']);
?>

<aside class="admin-sidebar">

    <!-- Logo -->
    <div class="sidebar-header">
        <img src="/../assets/images/logo.png" class="logo">
        <h2>Admin Panel</h2>
    </div>

    <!-- Admin Info -->
    <div class="admin-info">
        <p>Logged in as:</p>
        <strong><?= htmlspecialchars($adminEmail); ?></strong>
    </div>

    <!-- MENU -->
    <ul class="sidebar-menu">

        <li>
            <a href="/admin/index.php"
               class="<?= $currentPage == 'index.php' ? 'active' : '' ?>">
               🏠 Dashboard
            </a>
        </li>
         <li>
            <a href="/admin/change_password.php"
               class="<?= $currentPage == 'change_password.php' ? 'active' : '' ?>">
               🔑  Password
            </a>
        </li>
        <li>
            <a href="/admin/users.php"
               class="<?= $currentPage == 'users.php' ? 'active' : '' ?>">
               👤 Manage Users
            </a>
        </li>

        <li>
            <a href="/admin/create_user.php"
               class="<?= $currentPage == 'create_user.php' ? 'active' : '' ?>">
               ➕ Create User
            </a>
        </li>

        <li>
            <a href="/admin/transactions.php"
               class="<?= $currentPage == 'transactions.php' ? 'active' : '' ?>">
               💸 Transactions
            </a>
        </li>

        <li>
            <a href="/admin/assign_token_steps.php"
               class="<?= $currentPage == 'assign_token_steps.php' ? 'active' : '' ?>">
               🔐 Token Engine
            </a>
        </li>

        <li>
            <a href="/admin/system_settings.php"
               class="<?= $currentPage == 'system_settings.php' ? 'active' : '' ?>">
               ⚙️ System Settings
            </a>
        </li>

        <li>
            <a href="/admin/user_logs.php"
               class="<?= $currentPage == 'user_logs.php' ? 'active' : '' ?>">
               📄 User Logs
            </a>
        </li>

        <li>
            <a href="/admin/user_actions.php"
               class="<?= $currentPage == 'user_actions.php' ? 'active' : '' ?>">
               🧾 Admin Actions
            </a>
        </li>

        <li class="logout">
            <a href="/admin/logout.php">
                🚪 Logout
            </a>
        </li>

    </ul>

</aside>