<?php use function App\Core\e; $section = 'raporlar'; $money = static fn ($v) => number_format((float) $v, 2, ',', '.') . ' TRY'; ?>
<div class="panel zpanel zpanel-app">
    <?php require BASE_PATH . '/app/Views/zpanel/_sidebar.php'; ?>
    <section class="panel-body zpanel-main">
        <div class="zpanel-head"><div><p class="eyebrow">ZPanel</p><h1>Raporlar</h1><p class="muted">MVP kart ve tablo ozetleri. Grafikler sonraki asamada TODO.</p></div></div>
        <div class="zpanel-stat-grid"><article><span>30 gun kullanici</span><strong><?= e((string) (int) ($stats['users_30d'] ?? 0)) ?></strong></article><article><span>Mod sayisi</span><strong><?= e((string) (int) ($stats['mods'] ?? 0)) ?></strong></article><article><span>Muzik sayisi</span><strong><?= e((string) (int) ($stats['music'] ?? 0)) ?></strong></article><article><span>Odeme sayisi</span><strong><?= e((string) (int) ($stats['payments'] ?? 0)) ?></strong></article><article><span>Creator net</span><strong><?= e($money($stats['creator_net'] ?? 0)) ?></strong></article></div>
        <div class="zpanel-grid three">
            <section class="zpanel-card"><h2>En cok indirilen modlar</h2><?php foreach (($topMods ?? []) as $row): ?><div class="report-row"><span><?= e($row['title'] ?? '') ?></span><strong><?= e((string) ($row['download_count'] ?? 0)) ?></strong></div><?php endforeach; ?></section>
            <section class="zpanel-card"><h2>En cok dinlenen muzikler</h2><?php foreach (($topMusic ?? []) as $row): ?><div class="report-row"><span><?= e($row['title'] ?? '') ?></span><strong><?= e((string) ($row['play_count'] ?? 0)) ?></strong></div><?php endforeach; ?></section>
            <section class="zpanel-card"><h2>Riskli security loglar</h2><?php foreach (($riskLogs ?? []) as $row): ?><div class="report-row"><span><?= e(($row['scan_type'] ?? '-') . ' #' . ($row['id'] ?? '')) ?></span><strong><?= e((string) ($row['risk_score'] ?? 0)) ?></strong></div><?php endforeach; ?></section>
        </div>
    </section>
</div>
