<div class="container-fluid">

<div class="mb-4">
    <h2 class="fw-bold">
        Reviewer Intelligence Center
    </h2>
</div>

<div class="row g-3 mb-4">

<div class="col-md-3">
<div class="card shadow-sm border-0">
<div class="card-body text-center">
<div class="text-muted">Reviewers</div>
<h2><?= (int)$stats['reviewers'] ?></h2>
</div>
</div>
</div>

<div class="col-md-3">
<div class="card shadow-sm border-0">
<div class="card-body text-center">
<div class="text-muted">Open Reviews</div>
<h2><?= (int)$stats['open_reviews'] ?></h2>
</div>
</div>
</div>

<div class="col-md-3">
<div class="card shadow-sm border-0">
<div class="card-body text-center">
<div class="text-muted">Completed</div>
<h2><?= (int)$stats['completed_reviews'] ?></h2>
</div>
</div>
</div>

<div class="col-md-3">
<div class="card shadow-sm border-0">
<div class="card-body text-center">
<div class="text-muted">Overdue</div>
<h2><?= (int)$stats['overdue_reviews'] ?></h2>
</div>
</div>
</div>

</div>

<div class="card border-0 shadow-sm">

<div class="card-header fw-bold">
Reviewer Load Analysis
</div>

<div class="table-responsive">

<table class="table table-striped align-middle">

<thead>
<tr>
<th>ID</th>
<th>Reviewer</th>
<th>Total</th>
<th>Completed</th>
<th>Open</th>
<th>Overdue</th>
</tr>
</thead>

<tbody>

<?php foreach($rows as $r): ?>

<tr>

<td><?= (int)$r['id'] ?></td>

<td>
<?= htmlspecialchars($r['reviewer_name']) ?>
</td>

<td><?= (int)$r['total_reviews'] ?></td>

<td><?= (int)$r['completed_reviews'] ?></td>

<td>
<span class="badge bg-warning">
<?= (int)$r['open_reviews'] ?>
</span>
</td>

<td>

<?php if((int)$r['overdue_reviews'] > 0): ?>

<span class="badge bg-danger">
<?= (int)$r['overdue_reviews'] ?>
</span>

<?php else: ?>

<span class="badge bg-success">
0
</span>

<?php endif; ?>

</td>

</tr>

<?php endforeach; ?>

</tbody>

</table>

</div>

</div>

</div>
