<?php
// includes/sidebar.php
?>

<div id="sidebarBackdrop" class="fixed inset-0 bg-gray-900/60 z-40 hidden backdrop-blur-sm transition-opacity" onclick="toggleSidebar()"></div>

<aside id="sidebar" class="fixed inset-y-0 right-0 z-50 w-64 bg-white shadow-[rgba(0,0,0,0.05)_4px_0px_24px] transform translate-x-full md:translate-x-0 transition-all duration-300 flex flex-col h-full border-l border-gray-100">
    
    <div class="h-20 flex items-center justify-center border-b border-gray-50 bg-gradient-to-b from-gray-50/50 to-white shrink-0">
        <span class="text-3xl font-black text-transparent bg-clip-text bg-gradient-to-l from-blue-700 to-indigo-600 tracking-tighter drop-shadow-sm logo-full">VPNet</span>
        <span class="text-3xl font-black text-transparent bg-clip-text bg-gradient-to-l from-blue-700 to-indigo-600 tracking-tighter drop-shadow-sm logo-mini">VP</span>
    </div>
    
    <div class="flex-1 overflow-y-auto custom-scrollbar flex flex-col pb-6">
        
        <?php if($showSidebarTimer): ?>
        <div class="mx-3 mt-4 mb-1 bg-gradient-to-br from-amber-500 to-orange-500 rounded-2xl p-4 text-white shadow-lg relative overflow-hidden shrink-0 sidebar-banner">
            <div class="absolute -right-4 -top-4 opacity-20 text-6xl">🎁</div>
            <div class="relative z-10 text-center">
                <span class="block text-[11px] font-black uppercase mb-2 drop-shadow-sm">جشنواره بونوس کیف پول</span>
                <span class="block text-sm font-mono font-black tracking-widest sidebar-timer-el bg-black/20 px-2 py-1 rounded-lg" data-target="<?php echo $sidebarTimerTarget; ?>">--:--:--</span>
            </div>
        </div>
        <?php endif; ?>

        <?php if($showFestivalTimer): ?>
        <a href="/vpnet-panel/modules/store/store.php" class="block mx-3 <?php echo $showSidebarTimer ? 'mt-2' : 'mt-4'; ?> mb-1 bg-gradient-to-br from-rose-500 to-pink-600 rounded-2xl p-4 text-white shadow-lg relative overflow-hidden shrink-0 hover:scale-[1.02] hover:shadow-xl transition-all cursor-pointer group sidebar-banner">
            <div class="absolute -right-4 -top-4 opacity-20 text-6xl group-hover:scale-110 transition-transform duration-300">🛍️</div>
            <div class="relative z-10 text-center">
                <span class="block text-[11px] font-black uppercase mb-2 drop-shadow-sm flex items-center justify-center gap-1">
                    تخفیف ویژه: <?php echo htmlspecialchars($festivalPlanName); ?>
                    <svg class="w-3 h-3 animate-pulse" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M15 19l-7-7 7-7"></path></svg>
                </span>
                <span class="block text-sm font-mono font-black tracking-widest sidebar-timer-el bg-black/20 px-2 py-1 rounded-lg" data-target="<?php echo $festivalTimerTarget; ?>">--:--:--</span>
            </div>
        </a>
        <?php endif; ?>
        
        <div class="py-3 px-3 space-y-1.5 mt-2">
            
            <a href="/vpnet-panel/modules/dashboard/dashboard.php" data-tooltip="داشبورد" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
                <span class="sidebar-text whitespace-nowrap">داشبورد</span>
            </a>
            
            <div class="pt-4 pb-1 sidebar-text">
                <span class="px-4 text-[10px] font-black text-gray-400 tracking-wider uppercase">سرویس‌ها و فروش</span>
            </div>
            <a href="/vpnet-panel/modules/store/store.php" data-tooltip="فروشگاه" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">فروشگاه محصولات</span>
            </a>
            <a href="/vpnet-panel/modules/subscriptions/subscriptions.php" data-tooltip="اشتراک‌ها" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5v2m0 4v2m0 4v2M5 5a2 2 0 00-2 2v3a2 2 0 110 4v3a2 2 0 002 2h14a2 2 0 002-2v-3a2 2 0 110-4V7a2 2 0 00-2-2H5z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">مدیریت اشتراک‌ها</span>
            </a>
            <a href="/vpnet-panel/modules/customers.php" data-tooltip="مشتریان" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">لیست مشتریان</span>
            </a>

            <?php if($is_admin_header): ?>
                <div class="pt-4 pb-1 sidebar-text">
                    <span class="px-4 text-[10px] font-black text-gray-400 tracking-wider uppercase">زیرساخت و سرور</span>
                </div>
                <a href="/vpnet-panel/modules/inventory/inventory.php" data-tooltip="انبار محصولات" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">انبار و ورود کالا</span>
                </a>
                <a href="/vpnet-panel/modules/pasarguard/pasarguard.php" data-tooltip="پاسارگارد" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">پنل پاسارگارد</span>
                </a>
                <a href="/vpnet-panel/modules/servers.php" data-tooltip="مدیریت سرورها" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">مدیریت پنل‌ها و سرورها</span>
                </a>
                <a href="/vpnet-panel/modules/provider.php" data-tooltip="تامین کننده سرور" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">تامین کننده سرور</span>
                </a>
            <?php endif; ?>

            <div class="pt-4 pb-1 sidebar-text">
                <span class="px-4 text-[10px] font-black text-gray-400 tracking-wider uppercase">مالی و مارکتینگ</span>
            </div>
            
            <?php if($is_admin_header): ?>
                <a href="/vpnet-panel/modules/wallet/wallet.php" data-tooltip="کیف پول" class="nav-item flex items-center gap-3 text-emerald-700 bg-emerald-50 hover:bg-emerald-100 px-4 py-3 rounded-xl transition-all duration-200 font-bold border border-emerald-100 shadow-sm dark:bg-[#064e3b] dark:border-[#065f46] dark:text-[#6ee7b7] dark:hover:bg-[#065f46]">
                    <svg class="w-5 h-5 shrink-0 text-emerald-500 dark:text-[#34d399]" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">امور مالی و کیف پول</span>
                </a>
                <a href="/vpnet-panel/modules/bonuses.php" data-tooltip="سیستم بونوس" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">سیستم بونوس</span>
                </a>
                <a href="/vpnet-panel/modules/festivals.php" data-tooltip="جشنواره‌ها" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                    <span class="sidebar-text whitespace-nowrap">جشنواره‌های فروش</span>
                </a>
            <?php else: ?>
                <div class="mb-2 space-y-2 sidebar-banner">
                    <?php if($sidebar_wallet < 500000): ?>
                        <div class="bg-orange-50 border border-orange-200 rounded-xl p-3 shadow-sm transition-all duration-200 relative overflow-hidden dark:bg-[#7c2d12] dark:border-[#9a3412]">
                            <div class="absolute -left-2 -top-2 opacity-10 text-4xl">⚠️</div>
                            <div class="flex justify-between items-center mb-1 relative z-10">
                                <span class="text-xs font-bold text-orange-700 dark:text-orange-200 flex items-center gap-1">
                                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"></path></svg>
                                    موجودی
                                </span>
                                <span class="text-sm font-black text-orange-600 dark:text-orange-300" dir="ltr"><?php echo number_format($sidebar_wallet); ?> <span class="text-[9px] font-normal">T</span></span>
                            </div>
                            <p class="text-[9px] text-orange-600 dark:text-orange-300 mb-2 font-bold leading-tight relative z-10">شارژ شما رو به اتمام است! همین حالا شارژ کنید.</p>
                            <a href="/vpnet-panel/modules/wallet/wallet.php" class="block w-full text-center bg-orange-500 hover:bg-orange-600 dark:bg-orange-600 dark:hover:bg-orange-500 text-white text-[11px] font-bold py-1.5 rounded-lg transition-colors shadow-sm relative z-10">شارژ فوری حساب</a>
                        </div>
                    <?php else: ?>
                        <a href="/vpnet-panel/modules/wallet/wallet.php" class="nav-item block bg-emerald-50 border border-emerald-100 hover:bg-emerald-100 rounded-xl p-3 shadow-sm transition-colors dark:bg-[#064e3b] dark:border-[#065f46] dark:hover:bg-[#065f46]">
                            <div class="flex justify-between items-center">
                                <span class="text-xs font-bold text-emerald-700 dark:text-emerald-300 flex items-center gap-1">
                                    <svg class="w-4 h-4 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"></path></svg>
                                    موجودی
                                </span>
                                <span class="text-sm font-black text-emerald-600 dark:text-emerald-400" dir="ltr"><?php echo number_format($sidebar_wallet); ?> <span class="text-[9px] font-normal">T</span></span>
                            </div>
                        </a>
                    <?php endif; ?>

                    <?php if($sidebar_credit_debt > 0): ?>
                        <a href="/vpnet-panel/modules/wallet/wallet.php" class="block bg-rose-50 border border-rose-100 hover:bg-rose-100 rounded-xl p-3 shadow-sm transition-colors dark:bg-[#881337] dark:border-[#9f1239] dark:hover:bg-[#9f1239]">
                            <div class="flex justify-between items-center">
                                <span class="text-xs font-bold text-rose-700 dark:text-rose-300 flex items-center gap-1">
                                    <svg class="w-4 h-4 shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
                                    بدهی اعتباری
                                </span>
                                <span class="text-sm font-black text-rose-600 dark:text-rose-400" dir="ltr"><?php echo number_format($sidebar_credit_debt); ?> <span class="text-[9px] font-normal">T</span></span>
                            </div>
                        </a>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
            
            <a href="/vpnet-panel/modules/reports.php" data-tooltip="گزارشات" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">گزارشات و آمار</span>
            </a>
            
            <div class="pt-4 pb-1 sidebar-text">
                <span class="px-4 text-[10px] font-black text-gray-400 tracking-wider uppercase">سیستم و دسترسی</span>
            </div>
            <?php if($is_admin_header): ?>
            <a href="/vpnet-panel/modules/users.php" data-tooltip="کاربران سیستم" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">لیست همکاران</span>
            </a>
            <?php endif; ?>
            
            <a href="/vpnet-panel/modules/tickets/tickets.php" data-tooltip="پشتیبانی و تیکتینگ" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
    <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
    </svg>
    <span class="sidebar-text whitespace-nowrap">پشتیبانی و تیکتینگ</span>
</a>
            
		    <a href="/vpnet-panel/modules/settings.php" data-tooltip="تنظیمات" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path></svg>
                <span class="sidebar-text whitespace-nowrap">تنظیمات سیستم</span>
            </a>
			
            <a href="/vpnet-panel/modules/backup.php" data-tooltip="پشتیبان‌گیری" class="nav-item flex items-center gap-3 text-gray-600 hover:bg-gray-50 hover:text-blue-600 px-4 py-3 rounded-xl transition-all duration-200 font-bold border-r-4 border-transparent">
                <svg class="w-5 h-5 shrink-0 text-gray-400 transition-colors" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"></path></svg>
                <span class="sidebar-text whitespace-nowrap">تهیه نسخه بکاپ</span>
            </a>
        </div>
    </div>
</aside>

<div id="mobileMenu" class="hidden md:hidden mt-4 mx-4 bg-white rounded-2xl shadow-lg border border-gray-100 p-3 flex flex-col gap-1 absolute top-20 right-0 left-0 z-40 dark:bg-slate-800 dark:border-slate-700">
    
    <button class="install-pwa-btn hidden mx-2 mb-3 bg-gradient-to-r from-blue-600 to-indigo-600 rounded-xl p-3 text-white shadow-md justify-between items-center transition-transform active:scale-95">
        <div class="flex items-center gap-3">
            <span class="text-2xl drop-shadow-md">📲</span>
            <div class="text-right">
                <span class="block text-sm font-black tracking-tight text-white mb-0.5">نصب اپلیکیشن VPNet</span>
                <span class="block text-[10px] text-blue-200 font-bold leading-none">دسترسی سریع و بدون مرورگر</span>
            </div>
        </div>
        <span class="bg-white text-blue-700 px-4 py-1.5 rounded-lg text-xs font-black shadow-sm">نصب</span>
    </button>

    <?php if($showSidebarTimer): ?>
    <div class="mx-2 mt-1 mb-2 bg-gradient-to-br from-amber-500 to-orange-500 rounded-xl p-3 text-white shadow-md flex justify-between items-center">
        <span class="text-[11px] font-black">🎁 فرصت ویژه بونوس:</span>
        <span class="text-xs font-mono font-black tracking-widest sidebar-timer-el" data-target="<?php echo $sidebarTimerTarget; ?>">--:--:--</span>
    </div>
    <?php endif; ?>

    <?php if($showFestivalTimer): ?>
    <a href="/vpnet-panel/modules/store/store.php" class="block mx-2 mb-3 bg-gradient-to-br from-rose-500 to-pink-600 rounded-xl p-3 text-white shadow-md flex justify-between items-center hover:scale-[1.02] transition-transform cursor-pointer group">
        <span class="text-[11px] font-black flex items-center gap-1">
            🛍️ تخفیف <?php echo htmlspecialchars($festivalPlanName); ?>
            <svg class="w-3 h-3 animate-pulse" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M15 19l-7-7 7-7"></path></svg>
        </span>
        <span class="text-xs font-mono font-black tracking-widest sidebar-timer-el" data-target="<?php echo $festivalTimerTarget; ?>">--:--:--</span>
    </a>
    <?php endif; ?>

    <a href="/vpnet-panel/modules/dashboard/dashboard.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">داشبورد</a>
    
    <div class="px-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700"><span class="px-2 text-[10px] font-black text-gray-400 uppercase">سرویس‌ها و فروش</span></div>
    <a href="/vpnet-panel/modules/store/store.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">فروشگاه</a>
    <a href="/vpnet-panel/modules/subscriptions/subscriptions.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">اشتراک‌ها</a>
    <a href="/vpnet-panel/modules/customers.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">مشتریان</a>         
    
    <?php if($is_admin_header): ?>
        <div class="px-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700"><span class="px-2 text-[10px] font-black text-gray-400 uppercase">مدیریت زیرساخت</span></div>
        <a href="/vpnet-panel/modules/inventory/inventory.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">انبار محصولات</a>
        <a href="/vpnet-panel/modules/pasarguard/pasarguard.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">پنل پاسارگارد</a>
        <a href="/vpnet-panel/modules/servers.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">مدیریت سرورها</a>
        <a href="/vpnet-panel/modules/provider.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">تامین کننده سرور</a>
        
        <div class="px-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700"><span class="px-2 text-[10px] font-black text-gray-400 uppercase">مالی و مارکتینگ</span></div>
        <a href="/vpnet-panel/modules/wallet/wallet.php" class="block px-4 py-3 text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/30 rounded-xl font-bold">امور مالی و کیف پول</a>
        <a href="/vpnet-panel/modules/reports.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">گزارشات و آمار</a>
        <a href="/vpnet-panel/modules/bonuses.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">سیستم بونوس</a>
        <a href="/vpnet-panel/modules/festivals.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">جشنواره‌های فروش</a>
        
        <div class="px-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700"><span class="px-2 text-[10px] font-black text-gray-400 uppercase">سیستم و دسترسی</span></div>
        <a href="/vpnet-panel/modules/users.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">لیست همکاران</a>
    <?php else: ?>
        <div class="px-2 space-y-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700">
            <span class="px-2 text-[10px] font-black text-gray-400 uppercase">مالی و مارکتینگ</span>
            <a href="/vpnet-panel/modules/reports.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">گزارشات و آمار</a>
            
            <?php if($sidebar_wallet < 500000): ?>
                <div class="bg-orange-50 border border-orange-200 rounded-xl p-3 shadow-sm dark:bg-[#7c2d12] dark:border-[#9a3412]">
                    <div class="flex justify-between items-center mb-2">
                        <span class="text-xs font-bold text-orange-700 dark:text-orange-200">موجودی</span>
                        <span class="text-sm font-black text-orange-600 dark:text-orange-300" dir="ltr"><?php echo number_format($sidebar_wallet); ?> <span class="text-[10px]">T</span></span>
                    </div>
                    <p class="text-[10px] text-orange-600 dark:text-orange-300 mb-2 font-bold">⚠️ شارژ رو به اتمام است.</p>
                    <a href="/vpnet-panel/modules/wallet/wallet.php" class="block w-full text-center bg-orange-500 hover:bg-orange-600 dark:bg-orange-600 dark:hover:bg-orange-500 text-white text-[11px] font-bold py-2 rounded-lg shadow-sm transition">شارژ فوری</a>
                </div>
            <?php else: ?>
                <a href="/vpnet-panel/modules/wallet/wallet.php" class="block bg-emerald-50 border border-emerald-100 rounded-xl p-3 shadow-sm dark:bg-[#064e3b] dark:border-[#065f46]">
                    <div class="flex justify-between items-center">
                        <span class="text-xs font-bold text-emerald-700 dark:text-emerald-300">موجودی کیف پول</span>
                        <span class="text-sm font-black text-emerald-600 dark:text-emerald-400" dir="ltr"><?php echo number_format($sidebar_wallet); ?> <span class="text-[10px]">T</span></span>
                    </div>
                </a>
            <?php endif; ?>
            
            <?php if($sidebar_credit_debt > 0): ?>
                <a href="/vpnet-panel/modules/wallet/wallet.php" class="block bg-rose-50 border border-rose-100 rounded-xl p-3 shadow-sm dark:bg-[#881337] dark:border-[#9f1239]">
                    <div class="flex justify-between items-center">
                        <span class="text-xs font-bold text-rose-700 dark:text-rose-300">بدهی اعتباری</span>
                        <span class="text-sm font-black text-rose-600 dark:text-rose-400" dir="ltr"><?php echo number_format($sidebar_credit_debt); ?> <span class="text-[10px]">T</span></span>
                    </div>
                </a>
            <?php endif; ?>
            <div class="px-2 mt-3 border-t border-gray-100 pt-3 dark:border-slate-700"><span class="px-2 text-[10px] font-black text-gray-400 uppercase">تنظیمات سیستم</span></div>
        </div>
    <?php endif; ?>
    
    <a href="/vpnet-panel/modules/settings.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">تنظیمات سیستم</a>
    <a href="/vpnet-panel/modules/backup.php" class="block px-4 py-3 text-gray-700 dark:text-gray-200 hover:bg-blue-50 dark:hover:bg-slate-700 rounded-xl font-bold">تهیه نسخه بکاپ</a>
</div>