<?php
require __DIR__ . '/_bootstrap.php';
$id = (int)($_GET['id'] ?? 0);
$stmt = $pdo->prepare("SELECT * FROM admins WHERE id=?");
$stmt->execute([$id]);
$a = $stmt->fetch();
if(!$a){ http_response_code(404); echo "Not found"; exit; }
include __DIR__ . '/_header.php';
?>
<div class="page-header"><h1>Admin Details</h1></div>

<div class="card">
  <div class="kv">
    <div class="k">Name</div>    <div class="v"><?php echo htmlspecialchars($a['full_name']); ?></div>
    <div class="k">Email</div>   <div class="v"><?php echo htmlspecialchars($a['email']); ?></div>
    <div class="k">Created</div> <div class="v"><?php echo htmlspecialchars($a['created_at']); ?></div>
  </div>

  <div class="actions-bar">
    <a class="btn" href="<?php echo url_for('/admin/admins.php'); ?>">Back</a>
    <a class="btn btn-primary" href="<?php echo url_for('/admin/admin_edit.php?id=' . $a['id']); ?>">Edit</a>
  </div>
</div>
<?php include __DIR__ . '/_footer.php'; ?>
