<div class="card">
    <div class="card-header"><h4 class="card-title mb-0">Search Console — Sorgular ve Sayfalar</h4></div>
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-striped mb-0"><thead><tr><th>Tip</th><th>Tarih</th><th>Değer</th><th>Tıklama</th><th>Gösterim</th><th>CTR</th><th>Pozisyon</th></tr></thead><tbody>
            @foreach($topQueries as $row)
                <tr><td>Sorgu</td><td>{{ $row->date?->format('d.m.Y') }}</td><td>{{ $row->query_text }}</td><td>{{ number_format($row->clicks, 0, ',', '.') }}</td><td>{{ number_format($row->impressions, 0, ',', '.') }}</td><td>{{ number_format((float)$row->ctr * 100, 2, ',', '.') }}%</td><td>{{ number_format((float)$row->position, 2, ',', '.') }}</td></tr>
            @endforeach
            @foreach($topPages as $row)
                <tr><td>Sayfa</td><td>{{ $row->date?->format('d.m.Y') }}</td><td>{{ \Illuminate\Support\Str::limit($row->page_url, 80) }}</td><td>{{ number_format($row->clicks, 0, ',', '.') }}</td><td>{{ number_format($row->impressions, 0, ',', '.') }}</td><td>{{ number_format((float)$row->ctr * 100, 2, ',', '.') }}%</td><td>{{ number_format((float)$row->position, 2, ',', '.') }}</td></tr>
            @endforeach
            @if($topQueries->isEmpty() && $topPages->isEmpty())
                <tr><td colspan="7" class="text-center text-muted py-4">Henüz Search Console snapshot yok.</td></tr>
            @endif
            </tbody></table>
        </div>
    </div>
</div>
