<?php
/** @var \BotGuard\Core\View $this */
$this->layout('layouts.app');
?>
<?= $this->partial('partials.announcements', ['announcements' => $announcements ?? []]) ?>

<div class="d-flex justify-content-between align-items-center mb-3">
    <h1 class="h4 mb-0">Dashboard</h1>
    <div class="dropdown">
        <button class="btn btn-outline-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown" type="button">
            <i class="bi bi-download"></i> Export
        </button>
        <ul class="dropdown-menu dropdown-menu-end">
            <li><a class="dropdown-item" href="/dashboard/export/csv"><i class="bi bi-filetype-csv"></i> CSV</a></li>
            <li><a class="dropdown-item" href="/dashboard/export/xlsx"><i class="bi bi-file-earmark-excel"></i> Excel (.xlsx)</a></li>
            <li><a class="dropdown-item" href="/dashboard/export/pdf"><i class="bi bi-file-earmark-pdf"></i> PDF</a></li>
        </ul>
    </div>
</div>

<?= $this->partial('partials.stat_cards', ['summary' => $summary]) ?>

<?= $this->partial('partials.trend_chart', ['trend' => $trend, 'chartId' => 'dashTrend']) ?>

<div class="row g-3 mb-4">
    <div class="col-lg-4"><?= $this->partial('partials.top_list', ['title' => 'Top Browsers', 'rows' => $browsers]) ?></div>
    <div class="col-lg-4"><?= $this->partial('partials.top_list', ['title' => 'Devices', 'rows' => $devices]) ?></div>
    <div class="col-lg-4"><?= $this->partial('partials.top_list', ['title' => 'Top Countries', 'rows' => $countries]) ?></div>
</div>

<div class="card border-0 shadow-sm">
    <div class="card-body">
        <div class="d-flex justify-content-between align-items-center mb-3">
            <h6 class="mb-0">Recent Verifications</h6>
            <a href="/dashboard/logs" class="small">View all</a>
        </div>
        <?= $this->partial('partials.results_table', ['results' => $recent]) ?>
    </div>
</div>
