<?php
// User/Include/menu.php
$activePage = $activePage ?? '';
$user = getCurrentUser();
$wallet = $user['walletAddress'] ?? '';
$shortWallet = $wallet ? (substr($wallet, 0, 8) . '...' . substr($wallet, -5)) : 'N/A';
?>
<div class="sidebar" id="sidebar">
  <div class="sidebar-logo">
    <img src="assets/img/logo.png" alt="">
  </div>

  <div style="padding:14px 16px;border-bottom:1px solid var(--border)">
    <div style="font-size:10px;letter-spacing:1px;text-transform:uppercase;color:#444;margin-bottom:5px">Logged in as
    </div>
    <div style="font-size:12px;font-family:monospace;color:var(--gold)"><?= e($shortWallet) ?></div>
    <div style="font-size:11px;color:var(--text-muted);margin-top:3px">ID: <?= e($user['user_id'] ?? '') ?></div>
  </div>

  <div style="flex:1;overflow-y:auto;padding-bottom:20px">

    <div class="nav-section">Main</div>
    <a href="Dashboard.php" class="nav-item <?= $activePage === 'dashboard' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-tachometer-alt"></i> Dashboard
    </a>
    <a href="ActiveUser.php" class="nav-item <?= $activePage === 'active' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-user-check"></i> My Activation
    </a>

    <div class="nav-section">Packages</div>
    <a href="NormalPackages.php" class="nav-item <?= $activePage === 'normal' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-layer-group"></i> Normal Packages
    </a>
    <a href="MatrixPackages.php" class="nav-item <?= $activePage === 'matrix' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-th"></i> Matrix Packages
    </a>
    <a href="MatrixTree.php" class="nav-item <?= $activePage === 'tree' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-sitemap"></i> Matrix Tree
    </a>

    <div class="nav-section">Team</div>
    <a href="MyReferrals.php" class="nav-item <?= $activePage === 'referrals' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-user-plus"></i> My Referrals
    </a>
    <a href="MyTeam.php" class="nav-item <?= $activePage === 'team' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-users"></i> My Team
    </a>
    <a href="autoPoolStatus.php" class="nav-item <?= $activePage === 'poolstatus' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-users"></i> Auto Pool Status
    </a>
    <div class="nav-section">Income</div>
    <a href="ReferralIncome.php" class="nav-item <?= $activePage === 'referral_income' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-coins"></i> Referral Income
    </a>
    <a href="SponserIncome.php" class="nav-item <?= $activePage === 'sponser_income' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-coins"></i> Sponsor Income
    </a>
    <a href="LevelIncome.php" class="nav-item <?= $activePage === 'level_income' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-chart-line"></i> Level Income
    </a>
    <a href="PoolIncome.php" class="nav-item <?= $activePage === 'pool_income' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-swimming-pool"></i> Matrix Income
    </a>
    <a href="UpgradeIncome.php" class="nav-item <?= $activePage === 'upgrade_income' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-arrow-up"></i> Placement Upline Income
    </a>
    <a href="WalletStatement.php" class="nav-item <?= $activePage === 'wallet' ? 'active' : '' ?>">
      <i class="nav-icon fas fa-wallet"></i> Wallet Statement
    </a>

    <div class="nav-section">Account</div>
    <a href="Logout.php" class="nav-item" style="color:var(--danger)">
      <i class="nav-icon fas fa-sign-out-alt"></i> Logout
    </a>
  </div>
</div>
