<?php
// Get current page to handle active states in the terminal UI
$currentPage = basename($_SERVER['PHP_SELF']);
?>

<div id="sidebar-overlay" class="fixed inset-0 bg-black/60 z-30 hidden backdrop-blur-sm transition-opacity opacity-0 mt-[65px] md:hidden"></div>

<aside id="admin-sidebar" class="w-64 glass-panel border-r border-slate-800 fixed left-0 top-[65px] h-[calc(100vh-65px)] z-40 transform -translate-x-full md:translate-x-0 transition-transform duration-300 ease-in-out overflow-y-auto scroll-thin">
    <nav class="p-6 space-y-8 pb-24">
        
        <div>
            <p class="mono text-[10px] text-slate-500 mb-3 tracking-widest uppercase">System_Core</p>
            <ul class="space-y-1">
                <li>
                    <a href="dashboard.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'dashboard.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'dashboard.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./dashboard</span>
                    </a>
                </li>
                <li>
                    <a href="manage_users.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'manage_users.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'manage_users.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./user_nodes</span>
                    </a>
                </li>
                
            </ul>
        </div>

        <div>
            <p class="mono text-[10px] text-slate-500 mb-3 tracking-widest uppercase">Financial_Ops</p>
            <ul class="space-y-1">
                <li>
                    <a href="manage_deposits.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'manage_deposits.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'manage_deposits.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./deposits</span>
                        <span class="shrink-0 ml-auto px-1.5 py-0.5 text-[9px] text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 rounded">REQ</span>
                    </a>
                </li>
                <li>
                    <a href="manage_withdrawals.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'manage_withdrawals.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'manage_withdrawals.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./withdrawals</span>
                    </a>
                </li>
                <li>
                    <a href="manage_transfers.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'manage_transfers.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'manage_transfers.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./transfers</span>
                    </a>
                </li>
            </ul>
        </div>

        <div>
            <p class="mono text-[10px] text-slate-500 mb-3 tracking-widest uppercase">Trading_Control</p>
            <ul class="space-y-1">
                <li>
                    <a href="manage_plans.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'manage_plans.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'manage_plans.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./invest_plans</span>
                    </a>
                </li>
                <li>
                    <a href="market_controls.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'market_controls.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'market_controls.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./live_markets</span>
                    </a>
                </li>
                <li>
                    <a href="copytrade_masters.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'copytrade_masters.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'copytrade_masters.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./copy_trade_cfg</span>
                    </a>
                </li>
                <li>
                    <a href="ai_bot_config.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'ai_bot_config.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'ai_bot_config.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./ai_bot_cfg</span>
                    </a>
                </li>
                <li>
                    <a href="publish_signals.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'publish_signals.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'publish_signals.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./push_signals</span>
                        <span class="shrink-0 ml-auto px-1.5 py-0.5 text-[9px] text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded">VIP</span>
                    </a>
                </li>
            </ul>
        </div>

        <div>
            <p class="mono text-[10px] text-slate-500 mb-3 tracking-widest uppercase">Credit_&_Rewards</p>
            <ul class="space-y-1">
                <li>
                    <a href="loan_requests.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'loan_requests.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'loan_requests.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./loan_requests</span>
                    </a>
                </li>
                <li>
                    <a href="referral_config.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'referral_config.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'referral_config.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./referral_stats</span>
                    </a>
                </li>
            </ul>
        </div>

        <div>
            <p class="mono text-[10px] text-slate-500 mb-3 tracking-widest uppercase">System_Support</p>
            <ul class="space-y-1">
                <li>
                    <a href="support_tickets.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'support_tickets.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'support_tickets.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./active_tickets</span>
                        <span class="shrink-0 ml-auto px-1.5 py-0.5 text-[9px] text-red-400 bg-red-500/10 border border-red-500/20 rounded">03</span>
                    </a>
                </li>
                <li>
                    <a href="system_settings.php" class="nav-item group flex items-center gap-3 <?= $currentPage === 'system_settings.php' ? 'text-emerald-400 font-medium' : 'text-slate-400' ?> hover:text-emerald-400 transition-colors py-1.5">
                        <span class="nav-cursor text-emerald-500 mono <?= $currentPage === 'system_settings.php' ? 'opacity-100 translate-x-0' : '' ?>">&gt;</span>
                        <span class="mono text-sm">./settings_global</span>
                    </a>
                </li>
            </ul>
        </div>

        <div class="pt-6 border-t border-slate-800/50">
            <p class="mono text-[10px] text-slate-500 mb-4 tracking-widest uppercase">Diagnostics</p>
            
            <div class="space-y-4">
                <div>
                    <div class="flex justify-between text-[10px] mono mb-1">
                        <span class="text-slate-400">CPU_USAGE</span>
                        <span class="text-emerald-500">24%</span>
                    </div>
                    <div class="w-full bg-slate-800 h-1 rounded">
                        <div class="bg-emerald-500 h-1 rounded" style="width: 24%"></div>
                    </div>
                </div>
                <div>
                    <div class="flex justify-between text-[10px] mono mb-1">
                        <span class="text-slate-400">MEM_ALLOC</span>
                        <span class="text-amber-500">68%</span>
                    </div>
                    <div class="w-full bg-slate-800 h-1 rounded">
                        <div class="bg-amber-500 h-1 rounded" style="width: 68%"></div>
                    </div>
                </div>
            </div>
        </div>

    </nav>
</aside>