<?php require __DIR__ . '/../layouts/header.php'; $lang=current_lang(); ?>
<div class="container">
  <div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
    <h4 class="mb-0"><i class="fa-solid fa-folder-open me-2"></i><?= e($lang==='ar'?'تقديماتي':'My Submissions') ?></h4>
    <a class="btn btn-primary btn-rounded" href="<?= e(base_path('author/submit')) ?>"><i class="fa-solid fa-plus me-2"></i><?= e($lang==='ar'?'تقديم بحث':'Submit Paper') ?></a>
  </div>

  <div class="card border-0 shadow-sm">
    <div class="card-body">
      <div class="table-responsive">
        <table class="table align-middle">
          <thead>
            <tr>
              <th>#</th>
              <th><?= e($lang==='ar'?'العنوان':'Title') ?></th>
              <th><?= e($lang==='ar'?'المؤتمر':'Conference') ?></th>
              <th><?= e($lang==='ar'?'الحالة':'Status') ?></th>
              <th><?= e($lang==='ar'?'تاريخ':'Created') ?></th>
              <th></th>
            </tr>
          </thead>
          <tbody>
            <?php foreach (($rows??[]) as $r): ?>
              <tr>
                <td><?= e((string)$r['id']) ?></td>
                <td class="fw-bold"><?= e((string)($lang==='ar' ? ($r['title_ar']??$r['title_en']??'') : ($r['title_en']??$r['title_ar']??''))) ?></td>
                <td><?= e((string)($lang==='ar' ? ($r['conf_title_ar']??'') : ($r['conf_title_en']??''))) ?></td>
                <td><span class="badge bg-secondary"><?= e((string)($r['status'] ?? '')) ?></span></td>
                <td class="text-muted"><?= e((string)($r['created_at'] ?? '')) ?></td>
                <td><a class="btn btn-sm btn-outline-primary" href="<?= e(base_path('author/submission?id='.(int)$r['id'])) ?>"><?= e($lang==='ar'?'فتح':'Open') ?></a></td>
              </tr>
            <?php endforeach; ?>
            <?php if (empty($rows)): ?><tr><td colspan="6" class="text-center text-muted py-4">—</td></tr><?php endif; ?>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
<?php require __DIR__ . '/../layouts/footer.php'; ?>
