<?php
require_once __DIR__ . '/includes/db.php';

$subs = $conn->query("SELECT COUNT(*) c FROM subscribers")->fetch_assoc()['c'];
$paid = $conn->query("SELECT COUNT(*) c FROM invoices WHERE status='مدفوع'")->fetch_assoc()['c'];
$unpaid = $conn->query("SELECT COUNT(*) c FROM invoices WHERE status='غير مدفوع'")->fetch_assoc()['c'];
?>
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<title>إحصائيات</title>
<style>
.card{
    display:inline-block;
    width:200px;
    padding:20px;
    margin:10px;
    background:#fff;
    border-radius:8px;
    box-shadow:0 0 10px rgba(0,0,0,.1);
    text-align:center;
}
</style>
</head>
<body>

<h2>لوحة الإحصائيات</h2>

<div class="card">👤 المشتركين<br><strong><?= $subs ?></strong></div>
<div class="card">✅ مدفوع<br><strong><?= $paid ?></strong></div>
<div class="card">❌ غير مدفوع<br><strong><?= $unpaid ?></strong></div>

</body>
</html>
