<?php require_once __DIR__.'/../config/config.php'; require_admin();
$A=current_user(); $self=basename($_SERVER['PHP_SELF']);
$__pending_orders    = (int)$pdo->query("SELECT COUNT(*) c FROM orders WHERE status='pending'")->fetch()['c'];
$__pending_recharges = (int)$pdo->query("SELECT COUNT(*) c FROM recharges WHERE status='pending'")->fetch()['c'];
function nav($h,$l,$i,$active,$count=0){
  $a=$active===$h?'active':'';
  $badge = $count>0 ? ' <span class="nav-badge">'.(int)$count.'</span>' : '';
  return '<a class="'.$a.'" href="'.$h.'">'.$i.' '.$l.$badge.'</a>';
}
?><!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title><?=e($PAGE_TITLE??'Admin')?></title>
<link href="https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../assets/css/style.css?v=<?=@filemtime(__DIR__."/../assets/css/style.css")?:time()?>">
<style>
.sidebar a .nav-badge{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;margin-left:6px;border-radius:999px;background:#dc2626;color:#fff;font-size:11px;font-weight:700;line-height:1;vertical-align:middle;box-shadow:0 2px 6px rgba(220,38,38,.45)}
.sb-close-a{display:none;position:absolute;top:10px;right:10px;width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.18);color:#fff;border:none;font-size:20px;line-height:1;cursor:pointer;z-index:5}
.sb-close-a:hover{background:rgba(255,255,255,.28)}
@media(max-width:768px){.sidebar.open .sb-close-a{display:flex;align-items:center;justify-content:center}}
</style>
</head><body>
<div class="app">
<aside class="sidebar" id="sb" style="background:linear-gradient(180deg,#4c1d95,#7c3aed)">
<button class="sb-close-a" onclick="document.getElementById('sb').classList.remove('open')" aria-label="Close menu">✕</button>
<h2>👑 Admin Panel</h2>
<?=nav('dashboard.php','সারসংক্ষেপ','📊',$self)?>
<?=nav('reports.php','রিপোর্ট','📈',$self)?>
<?=nav('customers.php','কাস্টমার','👥',$self)?>
<?=nav('orders.php','অর্ডার','📦',$self,$__pending_orders)?>
<?=nav('apis.php','API সমূহ','🔌',$self)?>
<?=nav('services.php','সার্ভিস','🎯',$self)?>
<?=nav('auto_nid.php','অটো NID মেক','🪪',$self)?>
<?=nav('recharges.php','রিচার্জ রিকোয়েস্ট','💰',$self,$__pending_recharges)?>
<?=nav('recharge_methods.php','রিচার্জ মেথড','💳',$self)?>
<?=nav('notices.php','নোটিশ','📢',$self)?>
<?=nav('maintenance.php','মেইনটেন্যান্স','🧹',$self)?>
<?=nav('settings.php','সেটিংস','⚙️',$self)?>
<?=nav('activity.php','কার্যকলাপ','🕒',$self)?>
<a href="../public/logout.php">🚪 লগআউট</a>
</aside>
<div class="main">
<div class="topbar">
<button class="hamburger" onclick="document.getElementById('sb').classList.toggle('open')">☰</button>
<div><b>Admin: <?=e($A['name'])?></b></div>
<div><a href="../user/dashboard.php" style="font-size:13px">User view →</a></div>
</div>
