<?php
$db = Database::getInstance();
$activeUsers = (int)$db->fetchColumn("SELECT COUNT(*) FROM auth_sessions WHERE is_active = 1");
$errorsToday = (int)$db->fetchColumn("SELECT COUNT(*) FROM system_error_log WHERE DATE(created_at) = CURDATE()");
$activeMembers = (int)$db->fetchColumn("SELECT COUNT(*) FROM members WHERE status = 'active' AND is_deleted = 0");
?>
<div class="card h-100">
    <div class="card-header"><h6 class="mb-0"><i class="fas fa-heartbeat me-2 text-success"></i>System Health</h6></div>
    <div class="card-body">
        <div class="row text-center">
            <div class="col-4"><h4 class="mb-0 text-primary"><?= $activeUsers ?></h4><small class="text-muted">Active Sessions</small></div>
            <div class="col-4"><h4 class="mb-0 text-<?= $errorsToday > 0 ? 'danger' : 'success' ?>"><?= $errorsToday ?></h4><small class="text-muted">Errors Today</small></div>
            <div class="col-4"><h4 class="mb-0 text-success"><?= number_format($activeMembers) ?></h4><small class="text-muted">Active Members</small></div>
        </div>
    </div>
</div>