<div class="d-flex justify-content-between align-items-center mb-3">
    <h5 class="fw-bold mb-0"><i class="fas fa-map-marker-alt me-2 text-primary"></i><?= e($site['name']) ?></h5>
    <div class="d-flex gap-2">
        <a class="btn btn-sm btn-outline-primary" href="<?= url('/Sites/edit/' . (int) $site['site_id']) ?>"><i class="fas fa-pen me-1"></i>Edit</a>
        <a class="btn btn-sm btn-outline-secondary" href="<?= url('/Sites') ?>"><i class="fas fa-arrow-left me-1"></i>Back</a>
    </div>
</div>

<?php if (!empty($flash)): ?>
    <div class="alert alert-info py-2 small"><?= e($flash) ?></div>
<?php endif; ?>

<div class="rs-card p-3">
    <dl class="rs-def row g-2 mb-0">
        <div class="col-md-6"><dt>Code</dt><dd><?= e($site['code'] ?? '—') ?></dd></div>
        <div class="col-md-6"><dt>Status</dt><dd><span class="badge bg-secondary text-uppercase"><?= e($site['status']) ?></span></dd></div>
        <div class="col-12"><dt>Description</dt><dd><?= e($site['description'] ?? '—') ?></dd></div>
        <div class="col-md-6"><dt>Address</dt><dd><?= e($site['address'] ?? '—') ?></dd></div>
        <div class="col-md-3"><dt>City / Region</dt><dd><?= e(trim(($site['city'] ?? '') . ' · ' . ($site['region'] ?? ''), ' ·') ?: '—') ?></dd></div>
        <div class="col-md-3"><dt>Country</dt><dd><?= e($site['country']) ?></dd></div>
        <div class="col-12"><dt>Coordinates</dt><dd>
            <?php if (!empty($site['latitude']) && !empty($site['longitude'])): ?>
                <code><?= e($site['latitude']) ?>, <?= e($site['longitude']) ?></code>
            <?php else: ?>—<?php endif; ?>
        </dd></div>
    </dl>
</div>

<p class="mt-3"><a href="<?= url('/Assets?site_id=' . (int) $site['site_id']) ?>" class="btn btn-sm btn-outline-primary"><i class="fas fa-cogs me-1"></i>View assets on this site</a></p>
