.<?php

require_once BASE_PATH . '/app/helpers/easychair_translate.php';

require_once BASE_PATH . '/app/views/partials/_content_pipeline.php';

require_once BASE_PATH . '/app/views/partials/_cms_helpers.php';

require_once BASE_PATH . '/app/helpers/media_helper.php';

use App\Core\TenantContext;

use App\Services\ConferenceStatusService;

$themes =
    ec_load_tracks();

$dynamicSpeakers =
    ec_load_speakers();

$conferenceLiveStatus =
    ConferenceStatusService::build(
        $conference
    );

if (!function_exists('ec_safe_array')) {

    function ec_safe_array($value): array
    {
        return is_array($value)
            ? $value
            : [];
    }
}

if (!function_exists('ec_safe_string')) {

    function ec_safe_string($value): string
    {
        return is_string($value)
            ? trim($value)
            : '';
    }
}

function pcb_h($v)
{
    return htmlspecialchars((string)$v, ENT_QUOTES, 'UTF-8');
}

$lang  = ec_lang();
$isRtl = ec_is_rtl();

$title = $lang === 'ar'
    ? (($conference['homepage_title'] ?? '') ?: ($conference['title_ar'] ?? '') ?: ($conference['title_en'] ?? 'Conference'))
    : (($conference['homepage_title'] ?? '') ?: ($conference['title_en'] ?? '') ?: ($conference['title_ar'] ?? 'Conference'));

$brief = $lang === 'ar'
    ? (($conference['homepage_description'] ?? '') ?: ($conference['brief_ar'] ?? '') ?: ($conference['description_ar'] ?? ''))
    : (($conference['homepage_description'] ?? '') ?: ($conference['brief_en'] ?? '') ?: ($conference['description_en'] ?? ''));

$banner = $conference['homepage_banner']
    ?? $conference['banner_path']
    ?? $conference['featured_image']
    ?? '';

$totalPapers = array_sum(array_map(
    fn($s) => (int)($s['papers_count'] ?? 0),
    $sessions ?? []
));

$groupedCommittees = [];


foreach (($committees ?? []) as $m) {
    $type = $m['committee_type'] ?? 'committee';
    $groupedCommittees[$type][] = $m;
}

$currentPath = strtok($_SERVER['REQUEST_URI'] ?? '', '?');
$qs = $_GET ?? [];

function pcb_lang_url(string $lang): string
{
    $path = strtok($_SERVER['REQUEST_URI'] ?? '', '?');
    $qs = $_GET ?? [];
    $qs['lang'] = $lang;
    return $path . '?' . http_build_query($qs);
}
?>

<link
rel="stylesheet"
href="/easychair/assets/css/conference-business.css?v=<?= time() ?>">

<?php
/* =========================================================
   PACK 572 — HOMEPAGE BUILDER FOUNDATION
========================================================= */

/* =========================================================
   PACK 591R — LIVE DB HOMEPAGE ORCHESTRATION
========================================================= */

$db = \App\Core\Database::getInstance();

$homepageContent = [];

try {

    $stmtContent = $db->prepare("
        SELECT *
        FROM conference_homepage_content
        WHERE conference_id = ?
        AND is_active = 1
    ");

    $stmtContent->execute([
        $conference['id']
    ]);

    foreach (
        $stmtContent->fetchAll(PDO::FETCH_ASSOC)
        as $c
    ) {

        $homepageContent[
            $c['content_key']
        ] = $c;
    }

} catch(Throwable $e) {

    error_log(
        'HOMEPAGE CONTENT ERROR: '
        . $e->getMessage()
    );
}
if (!function_exists('hc')) {

    function hc(
        array $homepageContent,
        string $key,
        string $field,
        string $fallback = ''
    ): string {

        return (string)(
            $homepageContent[$key][$field]
            ?? $fallback
        );
    }
}

$homepageSections = [];

try {

    $stmt = $db->prepare("
        SELECT section_key, enabled
        FROM conference_home_sections
        WHERE conference_id = ?
    ");

    $stmt->execute([
        (int)($conference['id'] ?? 0)
    ]);

    foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {

        $homepageSections[
            $row['section_key']
        ] = (bool)$row['enabled'];
    }

} catch (\Throwable $e) {

    /*
    |--------------------------------------------------------------------------
    | SAFE FALLBACK
    |--------------------------------------------------------------------------
    */

    $homepageSections = [

        'hero' => true,
        'stats' => true,
        'themes' => true,
        'timeline' => true,
        'committees' => true,
        'sponsors' => true,
        'media' => true,
        'venue' => true,
        'sessions' => true,
        'proceedings' => true

    ];
}


$sectionsMap = [];

foreach (($sections ?? []) as $sx) {

    $sectionsMap[
        $sx['section_key']
    ] = $sx;
}

require BASE_PATH . '/app/views/partials/hero.php'; 
$heroSlides = [];

try {

    $stmtHero = $db->prepare("
        SELECT *
        FROM conference_homepage_blocks
        WHERE conference_id = ?
        AND block_type = 'hero_slide'
        AND is_active = 1
        ORDER BY sort_order ASC
    ");

    $stmtHero->execute([
        $conference['id']
    ]);

    $heroSlides =
        $stmtHero->fetchAll(PDO::FETCH_ASSOC);

} catch(Throwable $e) {

    error_log(
        'HERO LOAD ERROR: '
        . $e->getMessage()
    );
}

function ec_section_enabled(string $key, array $sections): bool
{
    return (bool)($sections[$key] ?? false);
}

?>

<!DOCTYPE html>
<html lang="<?= pcb_h(ec_lang()) ?>" dir="<?= pcb_h(ec_dir()) ?>">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title><?= pcb_h($title) ?></title>

<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap<?= $isRtl ? '.rtl' : '' ?>.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">

</head>

<body>

<div class="ec-blur-orb orb-1"></div>
<div class="ec-blur-orb orb-2"></div>
<div class="ec-noise"></div>
<!-- ===================================================== -->
<!-- PACK 605 — ENTERPRISE FLOATING NAVIGATION -->
<!-- ===================================================== -->

<div class="ec-floating-nav">

<section class="ec-live-announcements ec-reveal ec-hover-lift ec-glow-hover">

    <div class="ec-live-header">

        <div class="ec-live-badge">

            <span class="ec-live-dot"></span>

            <?= $lang === 'ar'
                ? 'تحديثات مباشرة'
                : 'Live Updates' ?>

        </div>

        <div class="ec-live-title">

            <?= $lang === 'ar'
                ? 'إعلانات المؤتمر والتنبيهات الأكاديمية'
                : 'Conference Announcements & Academic Alerts' ?>

        </div>

    </div>

    <div class="ec-live-ticker">

        <div class="ec-live-track">

            <?php
            $liveItems = [

                [
                    'icon' => 'fa-paper-plane',
                    'title' => $lang === 'ar'
                        ? 'فتح باب استقبال الأبحاث'
                        : 'Paper Submission Portal Open',
                    'desc' => $lang === 'ar'
                        ? 'يمكن الآن إرسال الأبحاث العلمية عبر منصة المؤتمر.'
                        : 'Research papers can now be submitted through the conference portal.'
                ],

                [
                    'icon' => 'fa-calendar-days',
                    'title' => $lang === 'ar'
                        ? 'الإعلان عن الجدول العلمي'
                        : 'Scientific Program Published',
                    'desc' => $lang === 'ar'
                        ? 'تم نشر البرنامج الزمني للجلسات العلمية.'
                        : 'The official conference schedule has been published.'
                ],

                [
                    'icon' => 'fa-award',
                    'title' => $lang === 'ar'
                        ? 'تحكيم علمي احترافي'
                        : 'Professional Peer Review',
                    'desc' => $lang === 'ar'
                        ? 'جميع الأبحاث تخضع لتحكيم أكاديمي متخصص.'
                        : 'All papers undergo professional academic peer review.'
                ],

                [
                    'icon' => 'fa-database',
                    'title' => $lang === 'ar'
                        ? 'فهرسة الأبحاث'
                        : 'Research Indexing',
                    'desc' => $lang === 'ar'
                        ? 'الأبحاث المختارة مؤهلة للفهرسة العلمية.'
                        : 'Selected papers are eligible for scientific indexing.'
                ],

                [
                    'icon' => 'fa-earth-americas',
                    'title' => $lang === 'ar'
                        ? 'مشاركة دولية'
                        : 'International Participation',
                    'desc' => $lang === 'ar'
                        ? 'مشاركون من جامعات ومؤسسات عالمية.'
                        : 'Participants from leading international universities.'
                ]

            ];

            $tickerItems =
                array_merge($liveItems, $liveItems);

            foreach ($tickerItems as $item):
            ?>

                <div class="ec-live-item">

                    <div class="ec-live-icon">

                        <i class="fa <?= pcb_h($item['icon']) ?>"></i>

                    </div>

                    <div>

                        <div class="ec-live-item-title">

                            <?= pcb_h($item['title']) ?>

                        </div>

                        <div class="ec-live-item-desc">

                            <?= pcb_h($item['desc']) ?>

                        </div>

                    </div>

                </div>

            <?php endforeach; ?>

        </div>

    </div>

</section>

    <div class="container">

        <div class="ec-floating-inner">

            <div class="fw-bold text-white d-flex align-items-center gap-2">

                <i class="fa fa-graduation-cap"></i>

                <span>
                    <?= pcb_h($conference['short_name'] ?? 'Conference') ?>
                </span>

            </div>

            <header class="ec-global-header" id="ecGlobalHeader">

    <div class="container">

        <div class="ec-global-nav">

            <a
                href="#top"
                class="ec-global-brand">

                <div class="ec-global-brand-icon">

                    <i class="fa fa-graduation-cap"></i>

                </div>

                <div>

                    <div class="ec-global-brand-title">

                        <?= pcb_h(
                            $conference['short_name']
                            ?? 'Conference'
                        ) ?>

                    </div>

                    <div class="ec-global-brand-sub">

                        IEEE STYLE CONFERENCE

                    </div>

                </div>

            </a>

            <div class="ec-global-menu">

                <a href="#themes">

                    <?= $lang === 'ar'
                        ? 'المحاور'
                        : 'Tracks' ?>

                </a>

                <a href="#program">

                    <?= $lang === 'ar'
                        ? 'البرنامج'
                        : 'Program' ?>

                </a>

                <a href="#speakers">

                    <?= $lang === 'ar'
                        ? 'المتحدثون'
                        : 'Speakers' ?>

                </a>

                <a href="#venue">

                    <?= $lang === 'ar'
                        ? 'الموقع'
                        : 'Venue' ?>

                </a>

                <a href="#cta">

                    <?= $lang === 'ar'
                        ? 'المشاركة'
                        : 'Participate' ?>

                </a>

            </div>

<div class="conf-lang-switch">

    <a
        href="<?= pcb_h(pcb_lang_url('en')) ?>"
        class="<?= ec_lang()==='en'
            ? 'active'
            : '' ?>">

        EN

    </a>

    <a
        href="<?= pcb_h(pcb_lang_url('ar')) ?>"
        class="<?= ec_lang()==='ar'
            ? 'active'
            : '' ?>">

        AR

    </a>

</div>

            <div class="ec-global-actions">

                <a
                    href="/easychair/login?conference_id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>"
                    class="ec-global-login">

                    <i class="fa fa-user"></i>

                    <?= $lang === 'ar'
                        ? 'دخول'
                        : 'Login' ?>

                </a>

                <a
                    href="/easychair/submit?id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>"
                    class="ec-global-submit">

                    <i class="fa fa-paper-plane"></i>

                    <?= $lang === 'ar'
                        ? 'إرسال بحث'
                        : 'Submit Paper' ?>

                </a>

            </div>

            <button
                class="ec-mobile-toggle"
                onclick="ecToggleMenu()">

                <i class="fa fa-bars"></i>

            </button>

        </div>

    </div>

</header>
            <a
                href="/easychair/submit?id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>"
                class="btn btn-warning rounded-pill px-4 fw-bold">

                <i class="fa fa-paper-plane"></i>

                <?= $lang === 'ar'
                    ? 'إرسال بحث'
                    : 'Submit Paper' ?>

            </a>

        </div>

    </div>

</div>
<div class="hero" id="top">
    <div class="container">

        <div class="d-flex justify-content-between align-items-center flex-wrap gap-3 mb-4 lang-switch">
            <div class="badge bg-warning text-dark px-3 py-2 rounded-pill fw-bold">
                <?= pcb_h(t('conf.international_conference', 'مؤتمر دولي')) ?>
            </div>

            <div class="d-flex gap-2">
                <a href="<?= pcb_h(pcb_lang_url('ar')) ?>"
                   class="<?= ec_lang() === 'ar' ? 'btn btn-warning text-dark' : 'btn btn-outline-light' ?>">
                    العربية
                </a>

                <a href="<?= pcb_h(pcb_lang_url('en')) ?>"
                   class="<?= ec_lang() === 'en' ? 'btn btn-warning text-dark' : 'btn btn-outline-light' ?>">
                    English
                </a>
            </div>
        </div>

        <?php if (!empty($banner)): ?>
            <div class="mb-5">
                <img src="<?= pcb_h(
ec_media_url($banner)
) ?>"
                     class="hero-banner"
                     alt="<?= pcb_h($title) ?>">
            </div>
        <?php endif; ?>

        <div class="row align-items-center">
            <div class="col-lg-9">

                <h1 class="display-3 fw-bold mb-4"
                    style="line-height:1.25;text-shadow:0 6px 18px rgba(0,0,0,.35);">
                    <?= pcb_h($title) ?>
                </h1>

                <?php if (!empty($brief)): ?>
                    <div class="lead opacity-75 mb-4">
                        <?= $brief ?>
                    </div>
                <?php else: ?>
                    <div class="lead opacity-75 mb-4">
                        <?= pcb_h($conference['short_name'] ?? '') ?>
                    </div>
                <?php endif; ?>




<div class="ec-hero-meta-bar">

    <div class="ec-hero-meta-card">
        <i class="fa fa-calendar-check"></i>

        <div>
            <small>
                <?= $lang === 'ar'
                    ? 'تاريخ المؤتمر'
                    : 'Conference Date' ?>
            </small>

            <strong>
                <?= pcb_h(
                    $conference['start_date']
                    ?? '2026'
                ) ?>
            </strong>
        </div>
    </div>

    <div class="ec-hero-meta-card">
        <i class="fa fa-location-dot"></i>

        <div>
            <small>
                <?= $lang === 'ar'
                    ? 'الموقع'
                    : 'Location' ?>
            </small>

            <strong>
                <?= pcb_h(
                    $conference['venue_name']
                    ?? 'Hybrid'
                ) ?>
            </strong>
        </div>
    </div>

    <div class="ec-hero-meta-card">
        <i class="fa fa-earth-americas"></i>

        <div>
            <small>
                <?= $lang === 'ar'
                    ? 'النمط'
                    : 'Mode' ?>
            </small>

            <strong>
                <?= $lang === 'ar'
                    ? 'دولي'
                    : 'International' ?>
            </strong>
        </div>
    </div>

</div>
                
<div class="d-flex gap-3 flex-wrap mb-4">

                    <a class="hero-btn hero-secondary" href="#committees">
                        <i class="fa fa-users"></i>
                        <?= pcb_h(t('conf.committees', 'اللجان')) ?>
                    </a>

                    <a class="hero-btn hero-secondary" href="#timetable">
                        <i class="fa fa-calendar"></i>
                        <?= pcb_h(t('conf.program', 'البرنامج')) ?>
                    </a>

                    <a class="hero-btn hero-submit"
                       href="/easychair/login?conference_id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>&lang=<?= pcb_h(ec_lang()) ?>">
                        <i class="fa fa-paper-plane"></i>
                        <?= pcb_h(t('conf.submit', 'إرسال بحث')) ?>
                    </a>

                    <a class="hero-btn hero-secondary" href="#proceedings">
                        <i class="fa fa-book"></i>
                        <?= pcb_h(t('conf.proceedings', 'وقائع المؤتمر')) ?>
                    </a>
                </div>

<?php
$eventDate =
    !empty($conference['start_date'])
    ? strtotime($conference['start_date'])
    : strtotime('+90 days');

$daysLeft =
    max(
        0,
        floor(($eventDate - time()) / 86400)
    );
?>

<div class="ec-countdown-wrap">

    <div class="ec-countdown-card">

        <div class="ec-countdown-icon">
            <i class="fa fa-hourglass-half"></i>
        </div>

        <div>

            <div class="ec-countdown-label">

                <?= $lang === 'ar'
                    ? 'الوقت المتبقي لانطلاق المؤتمر'
                    : 'Time Remaining Until Conference Starts' ?>

            </div>

            <div class="ec-countdown-number">

                <?= (int)$daysLeft ?>

                <span>
                    <?= $lang === 'ar'
                        ? 'يوم'
                        : 'Days' ?>
                </span>

            </div>

        </div>

    </div>

    <div class="ec-deadline-card">

        <div class="ec-deadline-icon">
            <i class="fa fa-paper-plane"></i>
        </div>

        <div>

            <div class="ec-deadline-label">

                <?= $lang === 'ar'
                    ? 'آخر موعد لاستقبال الأبحاث'
                    : 'Paper Submission Deadline' ?>

            </div>

            <div class="ec-deadline-date">

                <?= pcb_h(
                    $conference['submission_deadline']
                    ?? 'TBA'
                ) ?>

            </div>

        </div>

    </div>

</div>               
 <div class="glass-bar">

<div class="row g-4">

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

        <div class="ec-kpi-card">

            <div class="ec-kpi-icon bg-primary-subtle text-primary">
                <i class="fa fa-users"></i>
            </div>

            <div class="ec-kpi-value">
                <?= count($committees ?? []) ?>
            </div>

            <div class="ec-kpi-label">
                <?= pcb_h(t('conf.committees', 'اللجان')) ?>
            </div>

        </div>

    </div>

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

        <div class="ec-kpi-card">

            <div class="ec-kpi-icon bg-success-subtle text-success">
                <i class="fa fa-calendar-days"></i>
            </div>

            <div class="ec-kpi-value">
                <?= count($sessions ?? []) ?>
            </div>

            <div class="ec-kpi-label">
                <?= pcb_h(t('conf.sessions', 'الجلسات')) ?>
            </div>

        </div>

    </div>

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

        <div class="ec-kpi-card">

            <div class="ec-kpi-icon bg-warning-subtle text-warning">
                <i class="fa fa-book-open"></i>
            </div>

            <div class="ec-kpi-value">
                <?= count($issues ?? []) ?>
            </div>

            <div class="ec-kpi-label">
                <?= pcb_h(t('conf.proceedings', 'الوقائع')) ?>
            </div>

        </div>

    </div>

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

        <div class="ec-kpi-card">

            <div class="ec-kpi-icon bg-danger-subtle text-danger">
                <i class="fa fa-file-lines"></i>
            </div>

            <div class="ec-kpi-value">
                <?= (int)$totalPapers ?>
            </div>

            <div class="ec-kpi-label">
                <?= pcb_h(t('conf.papers', 'الأبحاث')) ?>
            </div>

        </div>

    </div>

</div>                    


                <?php if (empty($_SESSION['user_id'])): ?>
                    <div class="mt-4 d-flex gap-3 flex-wrap">

                        <a href="/easychair/login?conference_id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>&lang=<?= pcb_h(ec_lang()) ?>"
                           class="hero-btn hero-secondary">
                            <i class="fa fa-right-to-bracket"></i>
                            <?= pcb_h(t('auth.login', 'تسجيل الدخول')) ?>
                        </a>

                        <a href="/easychair/register?conference_id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>&lang=<?= pcb_h(ec_lang()) ?>"
                           class="hero-btn hero-secondary">
                            <i class="fa fa-user-plus"></i>
                            <?= pcb_h(t('auth.register', 'إنشاء حساب')) ?>
                        </a>

                    </div>
                <?php endif; ?>

            </div>
        </div>
    </div>
</div>

<div class="container pb-5">

<section id="committees" class="mb-5">
    <div class="proceedings-header">


    <div>




        <h2 class="section-title">
        <i class="fa fa-users text-primary"></i>
        <?= pcb_h(
    $lang === 'ar'
        ? (
            $sectionsMap['speakers']['section_title_ar']
            ?? 'المتحدثون الرئيسيون'
        )
        : (
            $sectionsMap['speakers']['section_title_en']
            ?? 'Keynote Speakers'
        )
) ?>
            </h2>

    </div>

	


    <div>




        <h2 class="section-title">

<i class="fa fa-users text-primary"></i>

<?= $lang === 'ar'
? 'اللجان وأعضاء المؤتمر'
: 'Committees & Members' ?>

</h2>

    </div>

    <div class="proceeding-meta">

        <span>
            <i class="fa fa-book-open"></i>
            <?= count($issues ?? []) ?>
            <?= $lang === 'ar' ? 'عدد الإصدارات' : 'Issues' ?>
        </span>

        <span>
            <i class="fa fa-file-lines"></i>
            <?= (int)$totalPapers ?>
            <?= $lang === 'ar' ? 'بحث' : 'Papers' ?>
        </span>

    </div>

</div>


<?php if (
    ec_section_enabled(
        'members',
        $homepageSections
    )
): ?>

    <?php require
        BASE_PATH .
        '/app/views/partials/members.php';
    ?>

<?php endif; ?>
   </section>


<?php

$timelineItems = [];

$timelineMap = [

    'submission_start' =>

        $lang === 'ar'
        ? 'بدء استقبال الأبحاث'
        : 'Submission Opening',

    'submission_end' =>

        $lang === 'ar'
        ? 'آخر موعد للتقديم'
        : 'Submission Deadline',

    'review_start' =>

        $lang === 'ar'
        ? 'بدء التحكيم'
        : 'Review Start',

    'review_end' =>

        $lang === 'ar'
        ? 'انتهاء التحكيم'
        : 'Review Deadline',

    'decision_date' =>

        $lang === 'ar'
        ? 'إشعارات القبول'
        : 'Acceptance Notification',

    'camera_ready_deadline' =>

        $lang === 'ar'
        ? 'تسليم النسخة النهائية'
        : 'Camera Ready Deadline',

    'start_date' =>

        $lang === 'ar'
        ? 'بداية المؤتمر'
        : 'Conference Start',

    'end_date' =>

        $lang === 'ar'
        ? 'نهاية المؤتمر'
        : 'Conference End',
];
foreach ($timelineMap as $field => $label) {

    if (!empty($conference[$field])) {

        $date = strtotime((string)$conference[$field]);

        $status = 'upcoming';

        if ($date < time()) {
            $status = 'closed';
        } elseif ($date <= strtotime('+10 days')) {
            $status = 'open';
        }

        $timelineItems[] = [
            'label' => $label,
            'date' => $conference[$field],
            'timestamp' => $date,
            'status' => $status
        ];
    }
}

usort($timelineItems, fn($a,$b) => $a['timestamp'] <=> $b['timestamp']);

?>


<?php
$themeIcons = [
    'ai' => 'fa-robot',
    'machine' => 'fa-brain',
    'security' => 'fa-shield-halved',
    'network' => 'fa-network-wired',
    'cloud' => 'fa-cloud',
    'data' => 'fa-database',
    'education' => 'fa-graduation-cap',
    'medical' => 'fa-heart-pulse',
    'engineering' => 'fa-gears',
    'software' => 'fa-code',
    'iot' => 'fa-microchip'
];

/* =========================================================
   PACK 650 — DYNAMIC HOMEPAGE PANELS
========================================================= */

$dynamicBlocks = [];

try {

    $stmtPanels = $db->prepare("
        SELECT *
        FROM conference_homepage_blocks
        WHERE conference_id = ?
        AND is_active = 1
	 AND block_type IN (

    'panel',
    'announcement',
    'topic',

    'travel',
    'media',
    'participation',

    'analytics',
    'ai',
    'networking',
    'virtual',
    'operations',

    'proceedings',
    'committee',
    'navigation',

    'feature',
    'cta'
        )
        ORDER BY sort_order ASC, id DESC
    ");

    $stmtPanels->execute([
        (int)$conference['id']
    ]);

    $rows =
        $stmtPanels->fetchAll(PDO::FETCH_ASSOC);

    foreach ($rows as $row) {

        $dynamicBlocks[] = [

            'icon' =>
                !empty($row['block_key'])
                ? $row['block_key']
                : 'fa-layer-group',

        
'type' =>
    $row['block_type']
    ?? 'panel',

    'title' =>
                $lang === 'ar'
                ? (
                    $row['title_ar']
                    ?? $row['title_en']
                    ?? ''
                )
                : (
                    $row['title_en']
                    ?? $row['title_ar']
                    ?? ''
                ),

            'desc' =>
                $lang === 'ar'
                ? (
                    $row['body_ar']
                    ?? $row['body_en']
                    ?? ''
                )
                : (
                    $row['body_en']
                    ?? $row['body_ar']
                    ?? ''
                ),

            'chip' =>
                $lang === 'ar'
                ? (
                    $row['button_text_ar']
                    ?? 'تفاصيل'
                )
                : (
                    $row['button_text_en']
                    ?? 'Details'
                ),

            'link' =>
                $row['button_url']
                ?? '#'

        ];

    }

} catch(Throwable $e) {

    error_log(
        'DYNAMIC BLOCKS ERROR: '
        . $e->getMessage()
    );

}

function ec_theme_icon(string $title, array $icons): string {

    $title = strtolower($title);

    foreach ($icons as $key => $icon) {

        if (str_contains($title, $key)) {
            return $icon;
        }
    }

    return 'fa-diagram-project';
}



?>


<?php

$sponsors = [
    [
        'title' => 'IEEE',
        'icon' => 'fa-microchip',
        'tier' => 'platinum',
        'desc' => $lang === 'ar'
            ? 'شراكات تقنية ومؤسسية دولية.'
            : 'Global technical and institutional partnerships.'
    ],
    [
        'title' => 'Springer',
        'icon' => 'fa-book',
        'tier' => 'gold',
        'desc' => $lang === 'ar'
            ? 'دعم النشر الأكاديمي والفهرسة.'
            : 'Academic publication and indexing support.'
    ],
    [
        'title' => 'Elsevier',
        'icon' => 'fa-graduation-cap',
        'tier' => 'silver',
        'desc' => $lang === 'ar'
            ? 'منصات بحثية وفهرسة علمية.'
            : 'Research publishing and indexing platforms.'
    ]
];

$indexes = [
    ['name'=>'Scopus','icon'=>'fa-database'],
    ['name'=>'DOI','icon'=>'fa-link'],
    ['name'=>'CrossRef','icon'=>'fa-diagram-project'],
    ['name'=>'Google Scholar','icon'=>'fa-google'],
    ['name'=>'OpenAlex','icon'=>'fa-globe'],
    ['name'=>'IEEE Xplore','icon'=>'fa-microchip']
];

?>


<?php

$statsData = [
    [
        'icon' => 'fa-file-lines',
        'label' => $lang === 'ar' ? 'الأبحاث المستلمة' : 'Submissions',
        'number' => (int)($heroMetrics['submissions'] ?? 0),
        'mini' => $lang === 'ar' ? 'إجمالي المشاركات العلمية' : 'Total scientific submissions'
    ],
    [
        'icon' => 'fa-user-check',
        'label' => $lang === 'ar' ? 'المحكمون' : 'Reviewers',
        'number' => (int)($heroMetrics['reviewers'] ?? 0),
        'mini' => $lang === 'ar' ? 'محكمون دوليون' : 'International reviewers'
    ],
    [
        'icon' => 'fa-layer-group',
        'label' => $lang === 'ar' ? 'المسارات' : 'Tracks',
        'number' => (int)($heroMetrics['tracks'] ?? 0),
        'mini' => $lang === 'ar' ? 'محاور بحثية متخصصة' : 'Research tracks'
    ],
    [
        'icon' => 'fa-earth-americas',
        'label' => $lang === 'ar' ? 'الدول' : 'Countries',
        'number' => (int)($heroMetrics['countries'] ?? 0),
        'mini' => $lang === 'ar' ? 'مشاركات دولية' : 'International participation'
    ],
    [
        'icon' => 'fa-calendar-days',
        'label' => $lang === 'ar' ? 'الجلسات' : 'Sessions',
        'number' => (int)($heroMetrics['sessions'] ?? 0),
        'mini' => $lang === 'ar' ? 'جلسات وبرامج علمية' : 'Academic sessions'
    ],
    [
        'icon' => 'fa-book-open',
        'label' => $lang === 'ar' ? 'الإصدارات' : 'Proceedings',
        'number' => (int)($heroMetrics['issues'] ?? 0),
        'mini' => $lang === 'ar' ? 'إصدارات علمية' : 'Published proceedings'
    ]
];

$acceptanceRate = 78;
$reviewCompletion = 91;

?>


<?php

$travelInfo = [
    [
        'icon' => 'fa-plane',
        'title' => $lang === 'ar' ? 'الوصول والمطار' : 'Airport & Arrival',
        'desc' => $lang === 'ar'
            ? 'تتوفر رحلات دولية ومحلية مع خيارات نقل متعددة للوصول إلى موقع المؤتمر بسهولة.'
            : 'International and domestic travel options are available with multiple transportation choices to the conference venue.'
    ],
    [
        'icon' => 'fa-passport',
        'title' => $lang === 'ar' ? 'التأشيرات والدعم' : 'Visa & Support',
        'desc' => $lang === 'ar'
            ? 'توفر إدارة المؤتمر خطابات دعوة ودعم للمشاركين الدوليين وفق الإجراءات المعتمدة.'
            : 'The conference provides invitation and support letters for international participants when applicable.'
    ],
    [
        'icon' => 'fa-bus',
        'title' => $lang === 'ar' ? 'التنقل والمواصلات' : 'Transportation',
        'desc' => $lang === 'ar'
            ? 'تتوفر خدمات النقل العام وسيارات الأجرة وخيارات التنقل الذكية بالقرب من مقر المؤتمر.'
            : 'Public transport, taxis, and smart mobility services are available near the conference venue.'
    ]
];

$hotels = [
    [
        'title' => $lang === 'ar' ? 'فندق المؤتمر الرئيسي' : 'Main Conference Hotel',
        'desc' => $lang === 'ar'
            ? 'إقامة مميزة بالقرب من مقر المؤتمر مع خدمات أكاديمية وخصومات للمشاركين.'
            : 'Premium accommodation near the venue with academic guest services and participant discounts.'
    ],
    [
        'title' => $lang === 'ar' ? 'فنادق الأعمال' : 'Business Hotels',
        'desc' => $lang === 'ar'
            ? 'خيارات متعددة لرجال الأعمال والباحثين ضمن بيئة مريحة وعملية.'
            : 'Comfortable and professional hotel options for researchers and academic delegates.'
    ],
    [
        'title' => $lang === 'ar' ? 'الإقامة الجامعية' : 'University Accommodation',
        'desc' => $lang === 'ar'
            ? 'خيارات إقامة جامعية مخصصة للباحثين والطلبة المشاركين.'
            : 'Academic accommodation solutions for researchers and student participants.'
    ]
];

?>


<?php

$mediaItems = [
    [
        'icon' => 'fa-camera-retro',
        'title' => $lang === 'ar' ? 'فعاليات المؤتمر' : 'Conference Highlights',
        'desc' => $lang === 'ar'
            ? 'تغطية مرئية متكاملة للجلسات العلمية، الأنشطة الأكاديمية، والتفاعل البحثي.'
            : 'Integrated visual coverage for scientific sessions, academic activities, and research engagement.'
    ],
    [
        'icon' => 'fa-microphone-lines',
        'title' => $lang === 'ar' ? 'الكلمات الرئيسية' : 'Keynote Moments',
        'desc' => $lang === 'ar'
            ? 'لقطات مميزة من كلمات المتحدثين الرئيسيين والخبراء الدوليين.'
            : 'Featured moments from keynote talks and distinguished international experts.'
    ],
    [
        'icon' => 'fa-photo-film',
        'title' => $lang === 'ar' ? 'المعرض الإعلامي' : 'Media Showcase',
        'desc' => $lang === 'ar'
            ? 'معرض تفاعلي للصور والوسائط والأنشطة العلمية المصاحبة للمؤتمر.'
            : 'Interactive media showcase for conference imagery, scientific activities, and event experiences.'
    ]
];

?>


<?php

$participationCards = [

    [
        'icon' => 'fa-file-circle-plus',
        'title' => $lang === 'ar' ? 'إرسال بحث علمي' : 'Submit Research Paper',
        'desc' => $lang === 'ar'
            ? 'ابدأ عملية إرسال البحث وتحكيمه ضمن بيئة أكاديمية احترافية متعددة المراحل.'
            : 'Start the submission and peer-review process within a professional multi-stage academic workflow.',
        'url' => '/easychair/submit?id=' . urlencode(
    $conference['slug']
    ?? $conference['id']
),
        'ribbon' => $lang === 'ar' ? 'مفتوح الآن' : 'Open Now'
    ],

    [
        'icon' => 'fa-user-check',
        'title' => $lang === 'ar' ? 'الانضمام كمحكم' : 'Become a Reviewer',
        'desc' => $lang === 'ar'
            ? 'ساهم في تقييم الأبحاث العلمية ضمن منظومة تحكيم دولية عالية الجودة.'
            : 'Contribute to the scientific review process through a high-quality international peer-review system.',
        'url' => '/easychair/register',
        'ribbon' => $lang === 'ar' ? 'لجان دولية' : 'International'
    ],

    [
        'icon' => 'fa-users',
        'title' => $lang === 'ar' ? 'التسجيل والمشاركة' : 'Join the Conference',
        'desc' => $lang === 'ar'
            ? 'سجل كمشارك أو باحث واستفد من الجلسات العلمية وورش العمل والتواصل الأكاديمي.'
            : 'Register as a participant or researcher and engage in scientific sessions, workshops, and networking.',
        'url' => '/easychair/register',
        'ribbon' => $lang === 'ar' ? 'تسجيل' : 'Registration'
    ]

];

?>



<?php

$sessions = [];

try {

    $stmtSessions = $db->prepare("
        SELECT *
        FROM conference_sessions
        WHERE conference_id = ?
        AND is_active = 1
        AND is_published = 1
        ORDER BY
            session_date ASC,
            start_time ASC,
            sort_order ASC
    ");

    $stmtSessions->execute([
        (int)$conference['id']
    ]);

    $sessions =
        $stmtSessions->fetchAll(PDO::FETCH_ASSOC);

} catch(Throwable $e) {

    $sessions = [];

    error_log(
        'SESSION LOAD ERROR: '
        . $e->getMessage()
    );
}

?>
<?php

$programSessions = [

    [
        'title' => $lang === 'ar'
            ? 'الجلسة الافتتاحية والذكاء الاصطناعي'
            : 'Opening Session & Artificial Intelligence',

        'badge' => $lang === 'ar'
            ? 'جلسة رئيسية'
            : 'Keynote Session',

        'time' => '09:00 AM',
        'hall' => $lang === 'ar' ? 'القاعة الكبرى' : 'Main Hall',

        'desc' => $lang === 'ar'
            ? 'جلسة افتتاحية تناقش مستقبل الذكاء الاصطناعي والبحث العلمي متعدد التخصصات.'
            : 'Opening keynote session discussing the future of AI and interdisciplinary scientific research.',

        'speakers' => [
            ['name'=>'Prof. John Smith','role'=>'Keynote Speaker'],
            ['name'=>'Dr. Lina Ahmed','role'=>'Session Chair']
        ]
    ],

    [
        'title' => $lang === 'ar'
            ? 'تحليلات البيانات والأنظمة الذكية'
            : 'Data Analytics & Intelligent Systems',

        'badge' => $lang === 'ar'
            ? 'جلسة تقنية'
            : 'Technical Session',

        'time' => '11:00 AM',
        'hall' => $lang === 'ar' ? 'قاعة الابتكار' : 'Innovation Hall',

        'desc' => $lang === 'ar'
            ? 'جلسة علمية متخصصة في البيانات الضخمة، التحليلات المتقدمة، والأنظمة الذكية.'
            : 'Technical session focused on big data, advanced analytics, and intelligent systems.',

        'speakers' => [
            ['name'=>'Dr. Omar Khaled','role'=>'Presenter'],
            ['name'=>'Prof. Sarah Lee','role'=>'Session Chair']
        ]
    ]

];

/* =========================================================
   PACK 651 — REAL PROCEEDINGS ENGINE
========================================================= */

$proceedingsPapers = [];

try {

    $stmtProceedings = $db->prepare("
        SELECT
            id,
            title,
            title_ar,
            abstract_en,
            abstract_ar,
            doi,
            author_name,
            file_path,
            avg_score,
            status,
            decision,
            published_at,
            submitted_at
        FROM submissions
        WHERE conference_id = ?
        AND (
            status IN (
                'accepted',
                'published',
                'production',
                'assigned_to_issue'
            )

            OR

            decision = 'accepted'
        )
        ORDER BY
            published_at DESC,
            submitted_at DESC,
            id DESC
        LIMIT 12
    ");

    $stmtProceedings->execute([
        (int)$conference['id']
    ]);

    $rows =
        $stmtProceedings->fetchAll(PDO::FETCH_ASSOC);

    foreach ($rows as $row) {

        $proceedingsPapers[] = [

            'id' =>
                $row['id'],

            'title' =>

                $lang === 'ar'

                ? (

                    $row['title_ar']
                    ?: $row['title']

                )

                : (

                    $row['title']
                    ?: $row['title_ar']

                ),

            'authors' =>

                $row['author_name']
                ?: 'Anonymous',

            'abstract' =>

                $lang === 'ar'

                ? (

                    $row['abstract_ar']
                    ?: $row['abstract_en']
                    ?: ''

                )

                : (

                    $row['abstract_en']
                    ?: $row['abstract_ar']
                    ?: ''

                ),

            'doi' =>

                $row['doi']
                ?: 'DOI Pending',

            'score' =>

                $row['avg_score']
                ?: null,

            'published_at' =>

                $row['published_at']
                ?: $row['submitted_at'],

            'file_path' =>

                $row['file_path']
                ?: ''

        ];

    }

} catch(Throwable $e) {

    error_log(
        'PROCEEDINGS ENGINE ERROR: '
        . $e->getMessage()
    );

}

$agendaHighlights = [

    [
        'icon' => 'fa-video',
        'title' => $lang === 'ar' ? 'جلسات هجينة' : 'Hybrid Sessions',
        'desc' => $lang === 'ar'
            ? 'إتاحة المشاركة الحضورية والافتراضية ضمن بيئة أكاديمية متكاملة.'
            : 'Integrated onsite and virtual participation experience.'
    ],

    [
        'icon' => 'fa-calendar-check',
        'title' => $lang === 'ar' ? 'برنامج تفاعلي' : 'Interactive Agenda',
        'desc' => $lang === 'ar'
            ? 'برنامج علمي احترافي مع جلسات وورش عمل متنوعة.'
            : 'Professional scientific agenda with workshops and parallel sessions.'
    ],

    [
        'icon' => 'fa-users-line',
        'title' => $lang === 'ar' ? 'شبكات أكاديمية' : 'Academic Networking',
        'desc' => $lang === 'ar'
            ? 'تعزيز التواصل والتعاون بين الباحثين والمؤسسات.'
            : 'Enhancing collaboration among researchers and institutions.'
    ]

];

?>


<?php

$keynoteSpeakers = [

    [
        'name' => 'Prof. John Anderson',
        'title' => $lang === 'ar'
            ? 'خبير الذكاء الاصطناعي والأنظمة الذكية'
            : 'Expert in Artificial Intelligence & Intelligent Systems',

        'institution' => 'MIT / USA',

        'bio' => $lang === 'ar'
            ? 'باحث دولي متخصص في الذكاء الاصطناعي والتحليلات الذكية مع مساهمات أكاديمية وصناعية واسعة.'
            : 'International researcher specializing in AI and intelligent analytics with broad academic and industrial contributions.',

        'tags' => ['AI','Machine Learning','Research']
    ],

    [
        'name' => 'Dr. Lina Al-Hassan',
        'title' => $lang === 'ar'
            ? 'متخصصة في البيانات الضخمة والتحليلات'
            : 'Specialist in Big Data & Advanced Analytics',

        'institution' => 'Oxford University',

        'bio' => $lang === 'ar'
            ? 'متحدثة دولية وباحثة في تحليلات البيانات المتقدمة والتطبيقات متعددة اللغات.'
            : 'International speaker and researcher in advanced data analytics and multilingual applications.',

        'tags' => ['Data','Analytics','NLP']
    ],

    [
        'name' => 'Prof. Sarah Mitchell',
        'title' => $lang === 'ar'
            ? 'رئيسة برامج الابتكار الأكاديمي'
            : 'Chair of Academic Innovation Programs',

        'institution' => 'Stanford University',

        'bio' => $lang === 'ar'
            ? 'تقود مشاريع أكاديمية عالمية في الابتكار الرقمي والتحول المؤسسي في التعليم العالي.'
            : 'Leading global academic initiatives in digital innovation and higher education transformation.',

        'tags' => ['Innovation','Education','Digital']
    ]

];

?>



	<?php

$speakers = [];

try {
    $stmtSpeakers = $db->prepare("
        SELECT *
        FROM conference_speakers
        WHERE conference_id = ?
        ORDER BY id DESC
    ");
    $stmtSpeakers->execute([(int)$conference['id']]);
    $speakers = $stmtSpeakers->fetchAll(PDO::FETCH_ASSOC);
} catch (Throwable $e) {
    error_log('SPEAKERS LOAD ERROR: ' . $e->getMessage());
}

$sponsors = [];

try {
    $stmtSponsors = $db->prepare("
        SELECT *
        FROM conference_sponsors
        WHERE conference_id = ?
        ORDER BY sort_order ASC, id DESC
    ");
    $stmtSponsors->execute([(int)$conference['id']]);
    $sponsors = $stmtSponsors->fetchAll(PDO::FETCH_ASSOC);
} catch (Throwable $e) {
    error_log('SPONSORS LOAD ERROR: ' . $e->getMessage());
}
?>



<?php

$sectionRegistry =
    require BASE_PATH .
    '/app/views/partials/_section_registry.php';

$homepageRenderSections = [];

try {

    $stmt = $db->prepare("

        SELECT
            section_key,
            enabled,
            sort_order
        FROM conference_home_sections
        WHERE conference_id = ?
        AND enabled = 1
        ORDER BY sort_order ASC, id ASC

    ");

    $stmt->execute([
        (int)$conference['id']
    ]);

    $homepageRenderSections =
        $stmt->fetchAll(PDO::FETCH_ASSOC);

} catch (\Throwable $e) {

    error_log(
        'RENDER ENGINE ERROR: '
        . $e->getMessage()
    );
}

?>

<?php foreach ($homepageRenderSections as $sec): ?>

    <?php

    $key =
        $sec['section_key'] ?? '';

    if (
        empty($sectionRegistry[$key])
    ) {
        continue;
    }

    $partial =
        BASE_PATH .
        '/app/views/partials/' .
        $sectionRegistry[$key];

    if (!file_exists($partial)) {
        continue;
    }

    ?>

    <?php

$currentSection =
    $sec;

$inlineStyle = '';

if (
    !empty($sec['background_image'])
) {

    $inlineStyle .=
        "background-image:url('/easychair/uploads/section_backgrounds/" .
        $sec['background_image'] .
        "');";

    $inlineStyle .=
        "background-size:cover;";

    $inlineStyle .=
        "background-position:center;";

} elseif (
    !empty($sec['background_value'])
) {

    if (
        ($sec['background_type'] ?? '')
        === 'gradient'
    ) {

        $inlineStyle .=
            'background:' .
            $sec['background_value'];

    } elseif (
        ($sec['background_type'] ?? '')
        === 'solid'
    ) {

        $inlineStyle .=
            'background:' .
            $sec['background_value'];

    }
}
?>

<div
class="ec-dynamic-section-wrapper <?= pcb_h(
    $sec['custom_css_class'] ?? ''
) ?>"
style="<?= pcb_h($inlineStyle) ?>">

    <?php require $partial; ?>

</div>

<?php endforeach; ?>

<footer class="ec-global-footer">

    <div class="container">

        <div class="ec-footer-top">

            <div class="ec-footer-brand">

                <div class="ec-footer-brand-icon">

                    <i class="fa fa-graduation-cap"></i>

                </div>

                <div>

                    <div class="ec-footer-brand-title">

                        <?= pcb_h(
                            $conference['short_name']
                            ?? 'Conference'
                        ) ?>

                    </div>

                    <div class="ec-footer-brand-sub">

                        <?= pcb_h(
    $lang === 'ar'
        ? hc(
            $homepageContent,
            'hero_title',
            'title_ar',
            'مؤتمر أكاديمي عالمي'
        )
        : hc(
            $homepageContent,
            'hero_title',
            'title_en',
            'Global Academic Conference'
        )
) ?>

                    </div>

                </div>

            </div>

            <div class="ec-footer-social">

                <a href="#">
                    <i class="fab fa-linkedin"></i>
                </a>

                <a href="#">
                    <i class="fab fa-x-twitter"></i>
                </a>

                <a href="#">
                    <i class="fab fa-facebook"></i>
                </a>

                <a href="#">
                    <i class="fab fa-youtube"></i>
                </a>

            </div>

        </div>

        <div class="ec-footer-grid">

            <div class="ec-footer-column">

                <div class="ec-footer-heading">

                    <?= $lang === 'ar'
                        ? 'عن المؤتمر'
                        : 'About Conference' ?>

                </div>

                <div class="ec-footer-text">

                    <?= $lang === 'ar'
                        ? 'منصة احترافية لإدارة المؤتمرات العلمية الدولية والأنشطة الأكاديمية والبحثية.'
                        : 'Professional platform for managing international academic conferences and scholarly activities.'
                    ?>

                </div>

                <div class="ec-footer-badges">

                    <span>IEEE STYLE</span>
                    <span>SCOPUS READY</span>
                    <span>GLOBAL EVENT</span>

                </div>

            </div>

            <div class="ec-footer-column">

                <div class="ec-footer-heading">

                    <?= $lang === 'ar'
                        ? 'روابط سريعة'
                        : 'Quick Links' ?>

                </div>

                <div class="ec-footer-links">

                    <a href="#themes">

                        <i class="fa fa-layer-group"></i>

                        <?= $lang === 'ar'
                            ? 'المحاور'
                            : 'Tracks' ?>

                    </a>

                    <a href="#program">

                        <i class="fa fa-calendar-days"></i>

                        <?= $lang === 'ar'
                            ? 'البرنامج'
                            : 'Program' ?>

                    </a>

                    <a href="#speakers">

                        <i class="fa fa-microphone"></i>

                        <?= $lang === 'ar'
                            ? 'المتحدثون'
                            : 'Speakers' ?>

                    </a>

                    <a href="#venue">

                        <i class="fa fa-location-dot"></i>

                        <?= $lang === 'ar'
                            ? 'الموقع'
                            : 'Venue' ?>

                    </a>

                </div>

            </div>

            <div class="ec-footer-column">

                <div class="ec-footer-heading">

                    <?= $lang === 'ar'
                        ? 'الخدمات الأكاديمية'
                        : 'Academic Services' ?>

                </div>

                <div class="ec-footer-links">

                    <a href="#">

                        <i class="fa fa-file-lines"></i>

                        <?= $lang === 'ar'
                            ? 'إدارة الأبحاث'
                            : 'Paper Management' ?>

                    </a>

                    <a href="#">

                        <i class="fa fa-users"></i>

                        <?= $lang === 'ar'
                            ? 'إدارة المشاركين'
                            : 'Participant Management' ?>

                    </a>

                    <a href="#">

                        <i class="fa fa-shield-halved"></i>

                        <?= $lang === 'ar'
                            ? 'التحكيم العلمي'
                            : 'Peer Review System' ?>

                    </a>

                    <a href="#">

                        <i class="fa fa-award"></i>

                        <?= $lang === 'ar'
                            ? 'الشهادات'
                            : 'Certificates' ?>

                    </a>

                </div>

            </div>

            <div class="ec-footer-column">

                <div class="ec-footer-heading">

                    <?= $lang === 'ar'
                        ? 'المشاركة'
                        : 'Participation' ?>

                </div>

                <div class="ec-footer-contact">

                    <div>

                        <i class="fa fa-envelope"></i>

                        info@conference.org

                    </div>

                    <div>

                        <i class="fa fa-globe"></i>

                        www.conference.org

                    </div>

                    <div>

                        <i class="fa fa-location-dot"></i>

                        <?= $lang === 'ar'
                            ? 'مؤتمر أكاديمي دولي'
                            : 'International Academic Event' ?>

                    </div>

                </div>

                <a
                    href="/easychair/submit?id=<?= urlencode(
    $conference['slug']
    ?? $conference['id']
) ?>"
                    class="ec-footer-submit">

                    <i class="fa fa-paper-plane"></i>

                    <?= $lang === 'ar'
                        ? 'إرسال بحث'
                        : 'Submit Paper' ?>

                </a>

            </div>

        </div>

        <div class="ec-footer-bottom">

            <div>

                © <?= date('Y') ?>

                <?= pcb_h(
                    $conference['short_name']
                    ?? 'Conference'
                ) ?>

                — All Rights Reserved

            </div>

            <div class="ec-footer-powered">

                <i class="fa fa-bolt"></i>

                EasyChair Enterprise Conference Experience

            </div>

        </div>

    </div>

</footer>

</div>

<script>

window.addEventListener('scroll', function(){

    const header =
        document.getElementById('ecGlobalHeader');

    if(window.scrollY > 40){

        header.classList.add('scrolled');

    }else{

        header.classList.remove('scrolled');

    }

});

function ecToggleMenu(){

    document
        .querySelector('.ec-global-menu')
        .classList
        .toggle('active');

}

</script>


<script>

/* =========================================================
   PACK 634 — REVEAL ENGINE
========================================================= */

const ecRevealItems =
    document.querySelectorAll(
        '.ec-reveal,.ec-reveal-left,.ec-reveal-right'
    );

const ecRevealObserver =
    new IntersectionObserver((entries)=>{

        entries.forEach(entry=>{

            if(entry.isIntersecting){

                entry.target.classList.add('active');

            }

        });

    },{
        threshold:.12
    });

ecRevealItems.forEach(item=>{

    ecRevealObserver.observe(item);

});

/* =========================================================
   COUNTER ENGINE
========================================================= */

const ecCounters =
    document.querySelectorAll(
        '.ec-ultra-metric-number,.ec-final-stat-number,.ec-enterprise-number'
    );

ecCounters.forEach(counter=>{

    const target =
        parseInt(
            counter.innerText.replace(/\D/g,'')
        );

    if(!target) return;

    let current = 0;

    const step =
        Math.ceil(target / 40);

    const timer =
        setInterval(()=>{

            current += step;

            if(current >= target){

                current = target;

                clearInterval(timer);

            }

            counter.innerText =
                current +
                (
                    counter.innerText.includes('+')
                    ? '+'
                    : ''
                );

        },35);

});

</script>

<button
    class="ec-scroll-top"
    id="ecScrollTop">

    <i class="fa fa-chevron-up"></i>

</button>

<script>

const ecScrollTop =
    document.getElementById('ecScrollTop');

window.addEventListener('scroll', () => {

    if(window.scrollY > 500){

        ecScrollTop.classList.add('show');

    }else{

        ecScrollTop.classList.remove('show');
    }

});

ecScrollTop.addEventListener('click', () => {

    window.scrollTo({
        top:0,
        behavior:'smooth'
    });

});

</script>

</body>
</html>
