<?php
/**
 * Sidebar partial.
 * Set $activeNav before including: 'dashboard' | 'campaigns' | 'add-campaign' | 'profile' | 'credit'
 */
$activeNav = $activeNav ?? 'dashboard';
function navActive(string $key, string $current): string {
    return $key === $current ? 'active' : '';
}
?>
<aside class="sidebar" id="sidebar">
    <div class="sidebar-logo">
        <div class="logo-icon"><i class="bi bi-gear-fill"></i></div>
        <span class="logo-text">DroidTester</span>
    </div>
    <nav class="sidebar-nav">
        <div class="sidebar-section-label">Menu</div>
        <a href="/dashboard" class="sidebar-nav-item <?= navActive('dashboard', $activeNav) ?>">
            <i class="bi bi-grid-fill"></i> Dashboard
        </a>
        <a href="/dashboard/campaigns" class="sidebar-nav-item <?= navActive('campaigns', $activeNav) ?>">
            <i class="bi bi-collection-fill"></i> My Campaigns
        </a>
        <a href="/dashboard/campaigns/add" class="sidebar-nav-item <?= navActive('add-campaign', $activeNav) ?>">
            <i class="bi bi-plus-circle-fill"></i> Add Campaign
        </a>
        <a href="/dashboard/credit-history" class="sidebar-nav-item <?= navActive('credit', $activeNav) ?>">
            <i class="bi bi-clock-history"></i> Credit History
        </a>
        <a href="/dashboard/profile" class="sidebar-nav-item <?= navActive('profile', $activeNav) ?>">
            <i class="bi bi-person-fill"></i> My Profile
        </a>

        <div class="sidebar-section-label">General</div>
        <a href="mailto:support@droidtester.com" class="sidebar-nav-item">
            <i class="bi bi-headset"></i> Contact Support
        </a>
        <a href="#" class="sidebar-nav-item">
            <i class="bi bi-question-circle-fill"></i> Help
        </a>
        <a href="/privacy-policy" class="sidebar-nav-item">
            <i class="bi bi-shield-check"></i> Privacy Policy
        </a>
        <a href="/terms-condition" class="sidebar-nav-item">
            <i class="bi bi-file-text-fill"></i> Terms &amp; Condition
        </a>
        <a href="#" class="sidebar-nav-item" data-modal="logout">
            <i class="bi bi-box-arrow-right"></i> Logout
        </a>
    </nav>
    <div class="sidebar-download-card">
        <div class="star-icon"><i class="bi bi-star-fill"></i></div>
        <h6>Download our Mobile App</h6>
        <p>Test apps & earn rewards</p>
        <button class="btn-download" onclick="window.open('https://play.google.com/store/apps/details?id=com.droidtester','_blank')">Download</button>
    </div>
</aside>
<div class="sidebar-overlay" id="sidebarOverlay"></div>
