<?php 
session_start();
        
if(!isset($_SESSION['admin_login'])) 
    header('location:adminlogin.php');   
?>
  <?php include 'admin_header.php' ?>
 <?php include 'admin_navbar.php'?>


<?php
                include '_inc/dbconn.php';
                $sql="SELECT COUNT(*) FROM users";
                $result=  mysqli_query($con, $sql) or die(mysqli_error($con));
                while($rws=  mysqli_fetch_array($result))
                {
                $lengthofUsers=$rws[0];
                }            




?>

<div class="main-wrapper">
    <header>
        <div class="menu-toggle" id="menuBtn">
            <i class="mdi mdi-menu"></i>
        </div>
        <div class="user-info">
            <span>Welcome, Admin</span>
            <i class="mdi mdi-account-circle" style="font-size: 2rem; color: var(--primary-red);"></i>
        </div>
    </header>

    <main class="content">
        <div class="welcome-banner">
            <h2>Control Panel</h2>
            <p>Monitor transactions and manage user accounts efficiently.</p>
        </div>

        <div class="stats-grid">
            <div class="stat-card">
                <div class="icon-circle"><i class="mdi mdi-account-group"></i></div>
                <div>
                    <h3 style="font-size: 1.5rem;"><?php echo $lengthofUsers; ?></h3>
                    <p style="color: #666; font-size: 0.9rem;">Total Users</p>
                </div>
            </div>

            <a href="credit.php" class="stat-card">
                <div class="icon-circle"><i class="mdi mdi-cash-plus"></i></div>
                <div>
                    <h3 style="font-size: 1.1rem;">Credit User</h3>
                    <p style="color: #666; font-size: 0.8rem;">Fund an account</p>
                </div>
            </a>

            <a href="debit.php" class="stat-card">
                <div class="icon-circle"><i class="mdi mdi-cash-minus"></i></div>
                <div>
                    <h3 style="font-size: 1.1rem;">Debit User</h3>
                    <p style="color: #666; font-size: 0.8rem;">Remove funds</p>
                </div>
            </a>

            <a href="addcustomer.php" class="stat-card">
                <div class="icon-circle"><i class="mdi mdi-plus-circle"></i></div>
                <div>
                    <h3 style="font-size: 1.1rem;">New User</h3>
                    <p style="color: #666; font-size: 0.8rem;">Create profile</p>
                </div>
            </a>
        </div>
    </main>
</div>

<?php include 'admin_footer.php'?>
