<?php 
include 'includes/header.php'; 
include 'includes/sidebar.php';
$users = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(*) as total FROM users"))['total'];
$paid = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(*) as total FROM users WHERE payment_status=1"))['total'];
$pendingBills = mysqli_fetch_assoc(mysqli_query($conn,"SELECT COUNT(*) as total FROM billings WHERE status='pending'"))['total'];
?>

<!-- Main -->
<div class="main">

    <h4 class="mb-4 text-primary fw-bold">Dashboard</h4>

    <!-- Stats -->
    <div class="row g-4">

        <div class="col-md-4">
            <div class="card">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <p class="text-secondary mb-1">Total Users</p>
                        <h3><?php echo $users; ?></h3>
                    </div>
                    <div class="stat-icon bg-blue">
                        <i class="bi bi-people"></i>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <p class="text-secondary mb-1">Paid Users</p>
                        <h3><?php echo $paid; ?></h3>
                    </div>
                    <div class="stat-icon bg-green">
                        <i class="bi bi-check-circle"></i>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card">
                <div class="d-flex justify-content-between align-items-center">
                    <div>
                        <p class="text-secondary mb-1">Pending Bills</p>
                        <h3><?php echo $pendingBills; ?></h3>
                    </div>
                    <div class="stat-icon bg-yellow">
                        <i class="bi bi-receipt"></i>
                    </div>
                </div>
            </div>
        </div>

    </div>




<!-- content -->
<div align="center">




</div>

<!-- content -->
</div>

<?php include 'includes/footer.php'; ?>