<?php
/**
 * Reusable summary stat cards.
 *
 * @var \BotGuard\Core\View $this
 * @var array<string,int|float> $summary
 */
$cards = [
    ['label' => 'Total Requests', 'value' => (int) ($summary['total'] ?? 0), 'icon' => 'bi-people', 'cls' => 'text-primary'],
    ['label' => 'Verified Humans', 'value' => (int) ($summary['humans'] ?? 0), 'icon' => 'bi-person-check', 'cls' => 'text-success'],
    ['label' => 'Suspicious', 'value' => (int) ($summary['suspicious'] ?? 0), 'icon' => 'bi-question-circle', 'cls' => 'text-warning'],
    ['label' => 'Bots Blocked', 'value' => (int) ($summary['bots'] ?? 0), 'icon' => 'bi-robot', 'cls' => 'text-danger'],
    ['label' => 'Avg Risk Score', 'value' => (float) ($summary['avg_score'] ?? 0), 'icon' => 'bi-speedometer', 'cls' => 'text-info'],
];
?>
<div class="row g-3 mb-4">
    <?php foreach ($cards as $card): ?>
        <div class="col-6 col-lg">
            <div class="stat-card p-3 h-100 bg-body-tertiary">
                <div class="d-flex justify-content-between align-items-start">
                    <div>
                        <div class="text-secondary small text-uppercase"><?= e($card['label']) ?></div>
                        <div class="stat-value mt-1"><?= e($card['value']) ?></div>
                    </div>
                    <i class="bi <?= e($card['icon']) ?> fs-4 <?= e($card['cls']) ?>"></i>
                </div>
            </div>
        </div>
    <?php endforeach; ?>
</div>
