<?php require __DIR__ . '/../../layouts/header.php'; $lang=current_lang(); ?>
<?php
$t=fn($ar,$en)=>($lang==='ar'?$ar:$en);
$row=$row??null; $assignments=$assignments??[];
?>
<div class="container py-3">
  <div class="d-flex justify-content-between align-items-center mb-3">
    <h4 class="mb-0"><i class="fa-solid fa-file-lines"></i> <?= e($t('تفاصيل البحث','Submission Details')) ?> #<?= e((string)$row['id']) ?></h4>
    <a class="btn btn-outline-secondary" href="<?= e(base_path('admin/submissions')) ?>"><i class="fa-solid fa-arrow-right"></i> <?= e($t('عودة','Back')) ?></a>
  </div>

  <div class="card border-0 shadow-sm mb-3">
    <div class="card-body">
      <div class="row g-2">
        <div class="col-md-6"><div class="text-muted small"><?= e($t('العنوان','Title')) ?></div><div class="fw-bold"><?= e((string)($row['title_ar'] ?? $row['title_en'] ?? '—')) ?></div></div>
        <div class="col-md-6"><div class="text-muted small"><?= e($t('المؤتمر','Conference')) ?></div><div><?= e((string)($lang==='ar'?($row['conf_title_ar']??''):($row['conf_title_en']??''))) ?></div></div>
        <div class="col-12"><div class="text-muted small"><?= e($t('الملخص','Abstract')) ?></div><div><?= nl2br(e((string)($row['abstract_ar'] ?? $row['abstract_en'] ?? ''))) ?></div></div>
      </div>
    </div>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-header bg-white fw-bold"><i class="fa-solid fa-people-arrows"></i> <?= e($t('توزيعات المحكمين','Review Assignments')) ?></div>
    <div class="table-responsive">
      <table class="table table-hover mb-0">
        <thead class="table-light"><tr><th>#</th><th><?=e($t('المحكم','Reviewer'))?></th><th><?=e($t('الحالة','Status'))?></th><th><?=e($t('الجولة','Round'))?></th></tr></thead>
        <tbody>
          <?php foreach($assignments as $a): ?>
            <tr>
              <td class="text-muted"><?= e((string)$a['id']) ?></td>
              <td><?= e(trim((string)($a['first_name'].' '.$a['last_name']))) ?> <span class="text-muted small">(<?= e((string)$a['email']) ?>)</span></td>
              <td><span class="badge bg-secondary"><?= e((string)$a['status']) ?></span></td>
              <td><?= e((string)($a['round_no'] ?? 1)) ?></td>
            </tr>
          <?php endforeach; ?>
          <?php if(empty($assignments)): ?><tr><td colspan="4" class="text-center text-muted py-4">—</td></tr><?php endif; ?>
        </tbody>
      </table>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../../layouts/footer.php'; ?>
