<?php
require_once __DIR__ . '/mj_v304_bootstrap.php';
if (mjv304_is_admin()):
$pendingReviews = (int)mjv304_fetch_value("SELECT COUNT(*) FROM mj_admin_review_queue WHERE status='pending'");
$newLeadsToday = (int)mjv304_fetch_value("SELECT COUNT(*) FROM seller_leads WHERE DATE(created_at)=CURDATE()");
$unreadAdmin = (int)mjv304_fetch_value("SELECT COUNT(*) FROM mj_notifications WHERE user_type='admin' AND is_read=0");
$pendingManual = mjv304_table_exists('payments') && mjv304_column_exists('payments','status') ? (int)mjv304_fetch_value("SELECT COUNT(*) FROM payments WHERE status IN ('pending','proof_uploaded','waiting_admin')") : 0;
$assetPrefix = (strpos($_SERVER['SCRIPT_NAME'] ?? '', '/admin/') !== false) ? '../' : '';
?>
<link rel="stylesheet" href="<?php echo $assetPrefix; ?>assets/css/mj-v304.css?v=304">
<div class="mj-v304-wrap" style="padding-left:0;padding-right:0;">
  <div class="mj-grid mj-grid-4">
    <div class="mj-card"><h3>Pending Reviews</h3><div class="num"><?php echo $pendingReviews; ?></div><a class="mj-btn mj-btn-sm" href="review-queue.php?status=pending">Review Now</a></div>
    <div class="mj-card"><h3>New Leads Today</h3><div class="num"><?php echo $newLeadsToday; ?></div><a class="mj-btn mj-btn-sm" href="leads.php">Open Leads</a></div>
    <div class="mj-card"><h3>Pending Payments</h3><div class="num"><?php echo $pendingManual; ?></div><span class="mj-muted">Manual proof / admin approval</span></div>
    <div class="mj-card"><h3>Admin Alerts</h3><div class="num"><?php echo $unreadAdmin; ?></div><span class="mj-muted">Unread notifications</span></div>
  </div>
</div>
<?php endif; ?>
