<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php $t=fn($ar,$en)=>($lang==='ar'?$ar:$en); ?>
<?php $row=$row??[]; ?>
<div class="container py-3">
  <div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
    <h4 class="mb-0"><i class="fa-solid fa-eye"></i> <?= e($t('تفاصيل التدقيق','Audit Details')) ?> #<?= e((string)($row['id']??'')) ?></h4>
    <a class="btn btn-outline-secondary" href="<?= e(base_path('admin/audit')) ?>"><i class="fa-solid fa-arrow-left"></i> <?= e($t('رجوع','Back')) ?></a>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-body">
      <div class="row g-3">
        <div class="col-md-4"><div class="text-muted"><?= e($t('المستخدم','Actor')) ?></div><div class="fw-bold"><?= e((string)($row['actor_email']??'')) ?></div></div>
        <div class="col-md-4"><div class="text-muted"><?= e($t('الإجراء','Action')) ?></div><div class="fw-bold"><?= e((string)($row['action']??'')) ?></div></div>
        <div class="col-md-4"><div class="text-muted"><?= e($t('الوقت','Time')) ?></div><div class="fw-bold"><?= e((string)($row['created_at']??'')) ?></div></div>

        <div class="col-md-4"><div class="text-muted"><?= e($t('الكيان','Entity')) ?></div><div class="fw-bold"><?= e((string)($row['entity_type']??'')) ?> #<?= e((string)($row['entity_id']??'')) ?></div></div>
        <div class="col-md-4"><div class="text-muted"><?= e($t('IP','IP')) ?></div><div class="fw-bold"><?= e((string)($row['ip_address']??'')) ?></div></div>
        <div class="col-md-4"><div class="text-muted"><?= e($t('User Agent','User Agent')) ?></div><div class="fw-bold" style="word-break:break-word"><?= e((string)($row['user_agent']??'')) ?></div></div>

        <div class="col-12">
          <div class="text-muted"><?= e($t('الرسالة','Message')) ?></div>
          <div class="border rounded p-2"><?= nl2br(e((string)($row['message']??''))) ?></div>
        </div>

        <div class="col-12">
          <div class="text-muted"><?= e($t('البيانات الإضافية','Meta JSON')) ?></div>
          <pre class="border rounded p-2 mb-0" style="max-height:340px;overflow:auto"><?= e((string)($row['meta_json']??'')) ?></pre>
        </div>
      </div>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
