<div class="container-fluid">

<div class="mb-4">
    <h2 class="fw-bold">
        Publication KPI Dashboard
    </h2>
</div>

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

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

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

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

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

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

</div>

<div class="card border-0 shadow-sm">
    <div class="card-header fw-bold">
        Recent Publication Activity
    </div>

    <div class="table-responsive">
        <table class="table table-striped align-middle mb-0">

            <thead>
            <tr>
                <th>ID</th>
                <th>Submission</th>
                <th>Title</th>
                <th>Status</th>
                <th>Production</th>
                <th>Updated</th>
            </tr>
            </thead>

            <tbody>

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

                <tr>
                    <td><?= (int)$r['id'] ?></td>
                    <td><?= htmlspecialchars($r['submission_no']) ?></td>
                    <td><?= htmlspecialchars($r['title']) ?></td>
                    <td><?= htmlspecialchars($r['status']) ?></td>
                    <td><?= htmlspecialchars($r['production_status']) ?></td>
                    <td><?= htmlspecialchars($r['updated_at']) ?></td>
                </tr>

            <?php endforeach; ?>

            </tbody>

        </table>
    </div>
</div>

</div>
