<?php

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Statistics;

/** @var Statistics $stats */

?>

<h4 class="border-bottom p-2 mb-4">
    <?= I18N::translate('Total families') ?>
    <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalFamilies() ?></span>
</h4>

<div class="row mb-3 row-cols-1 row-cols-lg-2 g-3">
    <div class="col">
        <div class="d-grid gap-3">
            <div class="card">
                <h5 class="card-header border-bottom-0">
                    <?= I18N::translate('Total marriages') ?>
                    <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalMarriages() ?></span>
                </h5>
            </div>

            <div class="card">
                <h5 class="card-header">
                    <?= I18N::translate('Marriages by century') ?>
                </h5>
                <div class="card-body">
                    <?= $stats->statsMarr() ?>
                </div>
            </div>

            <div class="row row-cols-1 row-cols-md-2 row-cols-lg-1 g-3">
                <div class="col">
                    <div class="card">
                        <h5 class="card-header">
                            <?= I18N::translate('Earliest marriage') ?>
                        </h5>
                        <div class="card-body">
                            <?= $stats->firstMarriage() ?>
                        </div>
                    </div>
                </div>

                <div class="col">
                    <div class="card">
                        <h5 class="card-header">
                            <?= I18N::translate('Latest marriage') ?>
                        </h5>
                        <div class="card-body">
                            <?= $stats->lastMarriage() ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col">
        <div class="d-grid gap-3">
            <div class="card m-0">
                <h5 class="card-header border-bottom-0">
                    <?= I18N::translate('Total divorces') ?>
                    <span class="badge bg-secondary rounded-pill float-end"><?= $stats->totalDivorces() ?></span>
                </h5>
            </div>

            <div class="card m-0">
                <h5 class="card-header">
                    <?= I18N::translate('Divorces by century') ?>
                </h5>
                <div class="card-body">
                    <?= $stats->statsDiv() ?>
                </div>
            </div>

            <div class="row row-cols-1 row-cols-md-2 row-cols-lg-1 g-3">
                <div class="col">
                    <div class="card">
                        <h5 class="card-header">
                            <?= I18N::translate('Earliest divorce') ?>
                        </h5>
                        <div class="card-body">
                            <?= $stats->firstDivorce() ?>
                        </div>
                    </div>
                </div>
    
                <div class="col">
                    <div class="card">
                        <h5 class="card-header">
                            <?= I18N::translate('Latest divorce') ?>
                        </h5>
                        <div class="card-body">
                            <?= $stats->lastDivorce() ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
