<?php
session_start();
include('../includes/config.php');

// Get all pending counts
$deposit_sql = "SELECT COUNT(*) as count FROM deposits WHERE status = 'pending'";
$deposit_result = mysqli_query($conn, $deposit_sql);
$deposit_row = mysqli_fetch_assoc($deposit_result);

$withdrawal_sql = "SELECT COUNT(*) as count FROM withdrawals WHERE status = 'pending'";
$withdrawal_result = mysqli_query($conn, $withdrawal_sql);
$withdrawal_row = mysqli_fetch_assoc($withdrawal_result);

$kyc_sql = "SELECT COUNT(*) as count FROM kyc_documents WHERE verification_status = 'pending'";
$kyc_result = mysqli_query($conn, $kyc_sql);
$kyc_row = mysqli_fetch_assoc($kyc_result);

$ticket_sql = "SELECT COUNT(*) as count FROM support_tickets WHERE status IN ('open', 'in_progress')";
$ticket_result = mysqli_query($conn, $ticket_sql);
$ticket_row = mysqli_fetch_assoc($ticket_result);

$total = $deposit_row['count'] + $withdrawal_row['count'] + $kyc_row['count'] + $ticket_row['count'];

echo $total;
?>