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

<section class="hero-section p-5 mb-4 rounded-4 shadow-sm">
    <div class="row align-items-center">
        <div class="col-lg-9">
            <h1 class="display-6 fw-bold mb-3">
                <?= e(current_lang() === 'ar' ? (string) $conference['title_ar'] : (string) $conference['title_en']) ?>
            </h1>
            <p class="lead mb-2">
                <?= e(current_lang() === 'ar' ? (string) ($conference['location_ar'] ?? '') : (string) ($conference['location_en'] ?? '')) ?>
            </p>
            <p class="mb-0">
                <?= e((string) ($conference['start_date'] ?? '')) ?> - <?= e((string) ($conference['end_date'] ?? '')) ?>
            </p>
        </div>
        <div class="col-lg-3 text-center">
            <?php if (!empty($conference['logo_path'])): ?>
                <img src="<?= e((string) $conference['logo_path']) ?>" alt="logo" class="img-fluid rounded-4 shadow-sm bg-white p-2">
            <?php endif; ?>
        </div>
    </div>
</section>

<div class="row g-4">
    <div class="col-lg-8">
        <div class="card border-0 shadow-sm rounded-4 mb-4">
            <div class="card-body">
                <h3 class="h5 fw-bold mb-3"><?= e(trans('conference_details')) ?></h3>
                <div class="mb-3">
                    <?= nl2br(e(current_lang() === 'ar' ? (string) ($conference['description_ar'] ?? '') : (string) ($conference['description_en'] ?? ''))) ?>
                </div>
            </div>
        </div>

        <div class="card border-0 shadow-sm rounded-4 mb-4">
            <div class="card-body">
                <h3 class="h5 fw-bold mb-3"><?= e(trans('call_for_papers')) ?></h3>
                <div>
                    <?= nl2br(e(current_lang() === 'ar' ? (string) ($conference['cfp_ar'] ?? '') : (string) ($conference['cfp_en'] ?? ''))) ?>
                </div>
            </div>
        </div>

        <div class="card border-0 shadow-sm rounded-4">
            <div class="card-body">
                <h3 class="h5 fw-bold mb-3"><?= e(trans('tracks')) ?></h3>

                <?php if (!empty($tracks)): ?>
                    <div class="row g-3">
                        <?php foreach ($tracks as $track): ?>
                            <div class="col-md-6">
                                <div class="border rounded-4 p-3 h-100">
                                    <h4 class="h6 fw-bold">
                                        <?= e(current_lang() === 'ar' ? (string) $track['name_ar'] : (string) $track['name_en']) ?>
                                    </h4>
                                    <p class="mb-0 text-muted">
                                        <?= e(current_lang() === 'ar' ? (string) ($track['description_ar'] ?? '') : (string) ($track['description_en'] ?? '')) ?>
                                    </p>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                <?php else: ?>
                    <div class="alert alert-info rounded-4 mb-0"><?= e(trans('no_data')) ?></div>
                <?php endif; ?>
            </div>
        </div>
    </div>

    <div class="col-lg-4">
        <div class="card border-0 shadow-sm rounded-4 mb-4">
            <div class="card-body">
                <h3 class="h5 fw-bold mb-3"><?= e(trans('conference')) ?></h3>
                <div class="small mb-2"><strong><?= e(trans('short_name')) ?>:</strong> <?= e((string) $conference['short_name']) ?></div>
                <div class="small mb-2"><strong><?= e(trans('submission_open_date')) ?>:</strong> <?= e((string) ($conference['submission_open_date'] ?? '')) ?></div>
                <div class="small mb-2"><strong><?= e(trans('submission_deadline')) ?>:</strong> <?= e((string) ($conference['submission_deadline'] ?? '')) ?></div>
                <div class="small mb-2"><strong><?= e(trans('review_deadline')) ?>:</strong> <?= e((string) ($conference['review_deadline'] ?? '')) ?></div>
                <div class="small mb-0"><strong><?= e(trans('camera_ready_deadline')) ?>:</strong> <?= e((string) ($conference['camera_ready_deadline'] ?? '')) ?></div>
            </div>
        </div>

        <?php if (!empty($conference['website_url'])): ?>
            <div class="card border-0 shadow-sm rounded-4">
                <div class="card-body">
                    <a href="<?= e((string) $conference['website_url']) ?>" target="_blank" class="btn btn-primary w-100 rounded-3"><?= e(trans('website_url')) ?></a>
                </div>
            </div>
        <?php endif; ?>
    </div>
</div>

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