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

<?php
$confId = (int)($conference['id'] ?? 0);
$confSlug = (string)($conference['slug'] ?? '');
?>

<?php if (!empty($slides)): ?>
<div id="confHeroSlider" class="carousel slide mb-4" data-bs-ride="carousel">
    <div class="carousel-inner rounded-4 shadow-sm overflow-hidden">
        <?php foreach ($slides as $i => $slide): ?>
            <div class="carousel-item <?= $i === 0 ? 'active' : '' ?>">
                <div class="hero-section p-5"
                     style="
                     min-height:340px;
                     background-image:
                     linear-gradient(rgba(15,23,42,.72),rgba(29,78,216,.72)),
                     url('<?= e((string) ($slide['image_path'] ?? '')) ?>');
                     background-size:cover;
                     background-position:center;">

                    <h1 class="display-6 fw-bold mb-3">
                        <?= e(current_lang() === 'ar'
                            ? (string) ($slide['title_ar'] ?: $conference['title_ar'])
                            : (string) ($slide['title_en'] ?: $conference['title_en'])) ?>
                    </h1>

                    <div class="lead">
                        <?= current_lang() === 'ar'
                            ? ((string) ($slide['body_ar'] ?? ''))
                            : ((string) ($slide['body_en'] ?? '')) ?>
                    </div>

                </div>
            </div>
        <?php endforeach; ?>
    </div>
</div>
<?php else: ?>

<section class="hero-section p-5 mb-4 rounded-4 shadow-sm">

<h1 class="display-6 fw-bold mb-3">
<?= e(current_lang() === 'ar'
    ? (string) $conference['title_ar']
    : (string) $conference['title_en']) ?>
</h1>

<div class="lead">
<?= current_lang() === 'ar'
    ? ((string) ($conference['brief_ar'] ?? ''))
    : ((string) ($conference['brief_en'] ?? '')) ?>
</div>

</section>

<?php endif; ?>

<div class="row g-4 mb-4">

<div class="col-lg-8">

<div class="card border-0 shadow-sm rounded-4 mb-4">
<div class="card-body">

<h2 class="h4 fw-bold mb-3">
<?= e(trans('brief')) ?>
</h2>

<div>
<?= current_lang() === 'ar'
    ? ((string) ($conference['brief_ar'] ?? ''))
    : ((string) ($conference['brief_en'] ?? '')) ?>
</div>

</div>
</div>

<div class="card border-0 shadow-sm rounded-4 mb-4">
<div class="card-body">

<h2 class="h4 fw-bold mb-3">
<?= e(trans('theme')) ?>
</h2>

<div>
<?= current_lang() === 'ar'
    ? ((string) ($conference['theme_ar'] ?? ''))
    : ((string) ($conference['theme_en'] ?? '')) ?>
</div>

</div>
</div>

<?php if (!empty($topics)): ?>

<div class="card border-0 shadow-sm rounded-4 mb-4">
<div class="card-body">

<h2 class="h4 fw-bold mb-3">
<?= e(trans('topics')) ?>
</h2>

<div class="row g-3">

<?php foreach ($topics as $topic): ?>

<div class="col-md-6">

<div class="border rounded-4 p-3 h-100">

<h3 class="h6 fw-bold">

<?= e(current_lang() === 'ar'
    ? (string) $topic['title_ar']
    : (string) $topic['title_en']) ?>

</h3>

<div>

<?= current_lang() === 'ar'
    ? ((string) ($topic['body_ar'] ?? ''))
    : ((string) ($topic['body_en'] ?? '')) ?>

</div>

</div>

</div>

<?php endforeach; ?>

</div>

</div>
</div>

<?php endif; ?>

</div>

<div class="col-lg-4">

<div class="card border-0 shadow-sm rounded-4 mb-4">

<div class="card-body">

<h2 class="h5 fw-bold mb-3">
<?= e(trans('conference')) ?>
</h2>

<div class="small mb-2">

<strong>
<?= e(trans('call_for_papers')) ?>:
</strong>

<?= e((string) ($conference['submission_deadline'] ?? '')) ?>

</div>

<div class="small mb-2">

<strong>
Venue:
</strong>

<?= e(current_lang() === 'ar'
    ? (string) ($conference['venue_ar']
        ?? $conference['location_ar']
        ?? '')
    : (string) ($conference['venue_en']
        ?? $conference['location_en']
        ?? '')) ?>

</div>

<div class="d-flex gap-2 flex-wrap mt-3">

<a href="/easychair/author/submit?id=<?= (int)$conference['id'] ?>"
   class="btn btn-primary rounded-3">

<?= e(trans('submit_paper')) ?>

</a>

<a href="/easychair/conference/proceedings?id=<?= (int)$conference['id'] ?>"
   class="btn btn-outline-secondary rounded-3">

<?= e(trans('proceedings')) ?>

</a>

</div>
</div>

</div>

</div>

</div>

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