<?php
if (!isset($site_settings) && isset($pdo)) {
    $site_settings = get_site_settings($pdo);
}
$_logo = $site_settings['site_logo'] ?? 'assets/images/logo.png';
?>
<aside class="sidebar">
    <button type="button" class="sidebar-close-btn">
        <iconify-icon icon="radix-icons:cross-2"></iconify-icon>
    </button>
    <div>
        <a href="<?= SITE_URL ?>/dashboard" class="sidebar-logo">
            <img src="<?= SITE_URL ?>/<?= htmlspecialchars($_logo) ?>" alt="site logo" class="light-logo">
            <img src="<?= SITE_URL ?>/<?= htmlspecialchars($_logo) ?>" alt="site logo" class="dark-logo">
            <img src="<?= SITE_URL ?>/<?= htmlspecialchars($_logo) ?>" alt="site logo" class="logo-icon">
        </a>
    </div>
    <div class="sidebar-menu-area">
        <ul class="sidebar-menu" id="sidebar-menu">

            <li>
                <a href="<?= SITE_URL ?>/dashboard">
                    <iconify-icon icon="ri:dashboard-line" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Dashboard</span>
                </a>
            </li>

            <li class="dropdown">
                <a href="javascript:void(0)">
                    <iconify-icon icon="tabler:video" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Video</span>
                </a>
                <ul class="sidebar-submenu">
                    <li>
                        <a href="<?= SITE_URL ?>/upload"><i class="ri-circle-fill circle-icon text-primary-600 w-auto"></i> Upload</a>
                    </li>
                    <li>
                        <a href="<?= SITE_URL ?>/videos"><i class="ri-circle-fill circle-icon text-warning-main w-auto"></i> Manage Video</a>
                    </li>
                </ul>
            </li>

            <li>
                <a href="<?= SITE_URL ?>/domains">
                    <iconify-icon icon="icon-park-outline:page-template" width="20" height="20" class="menu-icon"></iconify-icon>
                    <span>Landing Pages</span>
                </a>
            </li>
            
            <li class="sidebar-menu-item">
                <a href="<?= SITE_URL ?>/revenue_stats">
                    <iconify-icon icon="solar:chart-2-bold-duotone" class="menu-icon"></iconify-icon>
                    <span>Revenue Analytics</span>
                </a>
            </li>
            <li class="sidebar-menu-item">
                <a href="<?= SITE_URL ?>/earnings">
                    <iconify-icon icon="solar:wallet-money-bold-duotone" class="menu-icon"></iconify-icon>
                    <span>My Earnings</span>
                </a>
            </li>
            <li class="sidebar-menu-item">
                <a href="<?= SITE_URL ?>/users">
                    <iconify-icon icon="solar:users-group-rounded-bold-duotone" class="menu-icon"></iconify-icon>
                    <span>Top Earners</span>
                </a>
            </li>
            <li class="sidebar-menu-item">
                <a href="<?= SITE_URL ?>/statistics">
                    <iconify-icon icon="solar:pie-chart-2-bold-duotone" class="menu-icon"></iconify-icon>
                    <span>Statistics</span>
                </a>
            </li>
            
            <li>
                <a href="<?= SITE_URL ?>/withdraw">
                    <iconify-icon icon="solar:cash-out-outline" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Withdraw</span>
                </a>
            </li>

            <li>
                <a href="<?= SITE_URL ?>/transactions">
                    <iconify-icon icon="material-symbols:blur-medium-rounded" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Transactions</span>
                </a>
            </li>
            
            <li class="sidebar-menu-item">
                <a href="<?= SITE_URL ?>/profile">
                    <iconify-icon icon="solar:user-circle-bold-duotone" class="menu-icon"></iconify-icon>
                    <span>Profile</span>
                </a>
            </li>
            <li>
                <a href="<?= SITE_URL ?>/settings">
                    <iconify-icon icon="hugeicons:configuration-02" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Templates</span>
                </a>
            </li>
            <li>
                <a href="<?= SITE_URL ?>/kindamba_sandbox.php">
                    <iconify-icon icon="lucide:test-tube" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Kindamba Pay Sandbox</span>
                </a>
            </li>
            
            <?php if(isset($_SESSION['role']) && $_SESSION['role'] === 'admin'): ?>
            <li>
                <a href="<?= SITE_URL ?>/instructions">
                    <iconify-icon icon="solar:document-text-bold-duotone" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Instructions</span>
                </a>
            </li>
            <li>
                <a href="<?= SITE_URL ?>/superadmin">
                    <iconify-icon icon="mdi:shield-account" width="24" height="24" class="menu-icon text-warning-main"></iconify-icon>
                    <span>Super Admin</span>
                </a>
            </li>
            <li>
                <a href="<?= SITE_URL ?>/user_uploads">
                    <iconify-icon icon="solar:video-library-bold-duotone" width="24" height="24" class="menu-icon text-info-main"></iconify-icon>
                    <span>All Uploads</span>
                </a>
            </li>
            <li>
                <a href="<?= SITE_URL ?>/admin_payments">
                    <iconify-icon icon="solar:card-2-outline" width="24" height="24" class="menu-icon text-success-main"></iconify-icon>
                    <span>Manage Payments</span>
                </a>
            </li>
            <?php endif; ?>

            <li>
                <a href="<?= SITE_URL ?>/tutorials">
                    <iconify-icon icon="mdi:cast-tutorial" width="24" height="24" class="menu-icon"></iconify-icon>
                    <span>Tutorial</span>
                </a>
            </li>
        </ul>
    </div>
</aside>

