<?php require __DIR__ . '/../../layouts/header.php'; ?>

<div class="ec-card   mb-4">
    <div class="ec-card-body p-4">
        <div class="badge-soft mb-2"><i class="fa-solid fa-file-lines"></i> <?= e(trans('paper_page')) ?></div>
        <h1 class="fw-bold mb-2"><?= e((string)($paper['title'] ?? '')) ?></h1>
        <div class="text-muted mb-3"><?= e((string)($paper['submission_no'] ?? '')) ?> — <?= e(current_lang()==='ar' ? (string)($paper['conference_title_ar']??'') : (string)($paper['conference_title_en']??'')) ?></div>

        <div class="soft-panel mb-3">
            <div class="fw-bold mb-2"><?= e(trans('abstract')) ?></div>
            <div><?= nl2br(e((string)($paper['abstract'] ?? ''))) ?></div>
        </div>

        <?php if (!empty($doi)): ?>
            <div class="soft-panel mb-3">
                <div class="fw-bold mb-2"><?= e(trans('doi_metadata')) ?></div>
                <div class="small"><b>DOI:</b> <?= e((string)($doi['doi'] ?? '')) ?></div>
                <div class="small"><b>URL:</b> <?= e((string)($doi['landing_url'] ?? '')) ?></div>
            </div>
        <?php endif; ?>

        <div class="soft-panel">
            <div class="fw-bold mb-2"><?= e(trans('galleys')) ?></div>
            <?php foreach ($galleys as $g): ?>
                <div class="d-flex justify-content-between align-items-center border rounded-4 p-3 mb-2 bg-white">
                    <div>
                        <div class="fw-bold"><?= e((string)$g['label']) ?></div>
                        <div class="small text-muted"><?= e((string)$g['file_type']) ?> • <?= e((string)$g['lang_code']) ?></div>
                    </div>
                    <a class="btn ec-btn btn-success rounded-3" href="<?= e(base_path('galley/download?galley_id='.(int)$g['id'])) ?>">
                        <i class="fa-solid fa-download"></i><?= e(trans('download')) ?>
                    </a>
                </div>
            <?php endforeach; ?>
            <?php if (empty($galleys)): ?><div class="text-muted"><?= e(trans('no_data')) ?></div><?php endif; ?>
        </div>
    </div>
</div>

<a href="<?= e(base_path('proceedings')) ?>" class="btn ec-btn btn-outline-secondary rounded-3"><?= e(trans('back')) ?></a>

<?php require __DIR__ . '/../../layouts/footer.php'; ?>
