<?php
$current = $current_page ?? 'dashboard';
$nav = [
    'dashboard' => ['label' => 'Dashboard', 'url' => 'admin/dashboard', 'icon' => 'fa-home'],
    'transactions' => ['label' => 'Original Transactions', 'url' => 'admin/transactions', 'icon' => 'fa-credit-card'],
    'relworx-transactions' => ['label' => 'Relworx / Mobile Money', 'url' => 'admin/relworx-transactions', 'icon' => 'fa-mobile-alt'],
    'pesapal' => ['label' => 'PesaPal', 'url' => 'admin/relworx-transactions?payment_method=pesapal', 'icon' => 'fa-wallet'],
    'cardyfie-cards' => ['label' => 'Cardyfie Cards', 'url' => 'admin/cardyfie-cards', 'icon' => 'fa-credit-card'],
    'cardyfie-transactions' => ['label' => 'Cardyfie Transactions', 'url' => 'admin/cardyfie-transactions', 'icon' => 'fa-exchange-alt'],
    'cardyfie-customers' => ['label' => 'Cardyfie Customers', 'url' => 'admin/cardyfie-customers', 'icon' => 'fa-users'],
    'nowpayments' => ['label' => 'NOWPayments', 'url' => 'admin/nowpayments', 'icon' => 'fa-bitcoin-sign'],
    'yem' => ['label' => 'YEM', 'url' => 'admin/yem', 'icon' => 'fa-coins'],
    'yem-withdrawals' => ['label' => 'YEM withdrawals', 'url' => 'admin/yem-withdrawals', 'icon' => 'fa-hand-holding-dollar'],
    'disbursements' => ['label' => 'Disbursements', 'url' => 'admin/disbursements', 'icon' => 'fa-paper-plane'],
];
?>
<nav class="admin-navbar">
    <div class="admin-navbar-content">
        <a href="<?= site_url('admin/dashboard') ?>" class="admin-navbar-brand">
            <i class="fas fa-shield-alt"></i> Admin App
        </a>
        <div class="admin-navbar-user">
            <span class="admin-user-info"><i class="fas fa-user-circle"></i> <?= esc(session()->get('admin_username') ?? 'Admin') ?></span>
            <a href="<?= site_url('admin/logout') ?>" class="admin-logout-btn"><i class="fas fa-sign-out-alt"></i> Logout</a>
        </div>
    </div>
</nav>
<div class="admin-wrap">
    <aside class="admin-sidebar">
        <ul class="admin-sidebar-nav">
            <?php foreach ($nav as $key => $item): ?>
            <li>
                <?php $href = ($key === 'pesapal') ? (site_url('admin/relworx-transactions') . '?payment_method=pesapal') : site_url($item['url']); ?>
                <a href="<?= $href ?>" class="admin-sidebar-link <?= $current === $key ? 'active' : '' ?>">
                    <i class="fas <?= $item['icon'] ?>"></i>
                    <span><?= esc($item['label']) ?></span>
                </a>
            </li>
            <?php endforeach; ?>
        </ul>
    </aside>
    <main class="admin-main">
