<?php /** @var array $user; @var array $appointments; @var array $forms */ ?>
<div class="p-8 max-w-4xl">
  <a href="<?= url('/admin/users') ?>" class="text-xs text-bone/50 hover:text-bone">← <?= e(t('admin.users.back')) ?></a>
  <h1 class="mt-2 text-3xl font-display"><?= e(trim(($user['first_name'] ?? '') . ' ' . ($user['last_name'] ?? ''))) ?></h1>
  <div class="text-sm text-bone/60 mt-1"><?= e($user['email'] ?? '') ?> · <?= e($user['phone'] ?? '') ?></div>
  <div class="mt-10 grid md:grid-cols-2 gap-6">
    <div>
      <h2 class="text-xs uppercase tracking-widest text-gold mb-3"><?= e(t('admin.user.appointments', ['count' => count($appointments)])) ?></h2>
      <div class="bg-ink/40 border border-white/10 rounded-xl divide-y divide-white/5">
        <?php foreach ($appointments as $a): ?>
          <div class="p-3 text-sm flex items-center justify-between">
            <span><?= !empty($a['start_at']) ? e((new DateTimeImmutable($a['start_at']))->format('M j, Y')) : '—' ?></span>
            <span class="pill pill-<?= e(strtolower($a['status'] ?? 'pending')) ?>"><?= e($a['status'] ?? '') ?></span>
          </div>
        <?php endforeach; ?>
        <?php if (empty($appointments)): ?><div class="p-6 text-center text-bone/40 text-xs"><?= e(t('hub.customer.no_appointments')) ?></div><?php endif; ?>
      </div>
    </div>
    <div>
      <h2 class="text-xs uppercase tracking-widest text-gold mb-3"><?= e(t('admin.user.forms', ['count' => count($forms)])) ?></h2>
      <div class="bg-ink/40 border border-white/10 rounded-xl divide-y divide-white/5">
        <?php foreach ($forms as $f): ?>
          <div class="p-3 text-sm flex items-center justify-between">
            <span class="text-bone/60"><?= e(substr($f['updated_at'] ?? '', 0, 10)) ?></span>
            <span class="pill pill-<?= e(strtolower($f['status'] ?? 'draft')) ?>"><?= e($f['status'] ?? '') ?></span>
          </div>
        <?php endforeach; ?>
        <?php if (empty($forms)): ?><div class="p-6 text-center text-bone/40 text-xs"><?= e(t('hub.customer.no_forms')) ?></div><?php endif; ?>
      </div>
    </div>
  </div>
</div>
