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

<div class="hero-section p-5 mb-4 rounded-4 shadow-sm">
    <h1 class="display-6 fw-bold mb-3"><?= e(trans('conference_schedule')) ?></h1>
    <div class="lead"><?= e(current_lang() === 'ar' ? (string) ($conference['title_ar'] ?? '') : (string) ($conference['title_en'] ?? '')) ?></div>
</div>

<?php foreach ($days as $day): ?>
    <div class="card border-0 shadow-sm rounded-4 mb-4">
        <div class="card-body p-4">
            <h2 class="h4 fw-bold mb-3"><?= e((string) $day['day_date']) ?> — <?= e(current_lang() === 'ar' ? (string) ($day['title_ar'] ?: $day['title_en']) : (string) ($day['title_en'] ?: $day['title_ar'])) ?></h2>

            <?php foreach ($sessions as $session): ?>
                <?php if ((int) $session['conference_day_id'] !== (int) $day['id']) continue; ?>
                <div class="soft-panel mb-3">
                    <div class="d-flex justify-content-between flex-wrap gap-2 mb-2">
                        <div class="fw-bold"><?= e(current_lang() === 'ar' ? (string) ($session['title_ar'] ?: $session['title_en']) : (string) ($session['title_en'] ?: $session['title_ar'])) ?></div>
                        <div class="badge-soft"><?= e((string) ($session['start_time'] ?? '')) ?> - <?= e((string) ($session['end_time'] ?? '')) ?></div>
                    </div>
                    <div class="small text-muted mb-2">
                        <?= e(trans((string) ($session['session_type'] ?? 'other'))) ?>
                        — <?= e(current_lang() === 'ar' ? (string) ($session['hall_ar'] ?: $session['hall_en']) : (string) ($session['hall_en'] ?: $session['hall_ar'])) ?>
                    </div>

                    <?php foreach (($presentations[(int) $session['id']] ?? []) as $p): ?>
                        <div class="border rounded-3 p-3 mb-2 bg-white">
                            <div class="fw-bold"><?= e(current_lang() === 'ar' ? (string) ($p['title_ar'] ?: $p['title_en']) : (string) ($p['title_en'] ?: $p['title_ar'])) ?></div>
                            <div class="small text-muted"><?= e(current_lang() === 'ar' ? (string) ($p['presenter_name_ar'] ?: $p['presenter_name_en']) : (string) ($p['presenter_name_en'] ?: $p['presenter_name_ar'])) ?></div>
                            <div class="small text-muted"><?= e((string) ($p['start_time'] ?? '')) ?> - <?= e((string) ($p['end_time'] ?? '')) ?></div>
                        </div>
                    <?php endforeach; ?>
                </div>
            <?php endforeach; ?>
        </div>
    </div>
<?php endforeach; ?>

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