<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<title>اختيار المؤتمر</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.rtl.min.css" rel="stylesheet">
<style>
body{
    font-family:'Cairo',sans-serif;
    min-height:100vh;
    background:linear-gradient(135deg,#eef2ff,#f8fafc);
}
.wrap{
    max-width:1100px;
    margin:60px auto;
    padding:20px;
}
.header-card{
    background:#fff;
    border-radius:24px;
    padding:28px;
    box-shadow:0 18px 50px rgba(15,23,42,.10);
    margin-bottom:20px;
}
.conf-card{
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:22px;
    padding:22px;
    height:100%;
    box-shadow:0 12px 32px rgba(15,23,42,.07);
    transition:.2s;
}
.conf-card:hover{
    transform:translateY(-3px);
    border-color:#2563eb;
}
.btn-main{
    background:linear-gradient(135deg,#0f172a,#2563eb);
    color:#fff;
    border:0;
    border-radius:14px;
    padding:10px 18px;
    font-weight:800;
}
.badge-soft{
    background:#e0f2fe;
    color:#075985;
    border-radius:999px;
    padding:6px 12px;
    font-weight:700;
    font-size:12px;
}
</style>
</head>
<body>
<div class="wrap">
    <div class="header-card">
        <h2 class="mb-2">اختيار المؤتمر</h2>
        <div class="text-muted">يرجى اختيار المؤتمر الذي تريد العمل عليه.</div>
    </div>

    <?php if (empty($conferences)): ?>
        <div class="alert alert-warning">لا توجد مؤتمرات مرتبطة بهذا الحساب.</div>
    <?php else: ?>
        <div class="row g-3">
            <?php foreach ($conferences as $conf): ?>
                <div class="col-md-6 col-lg-4">
                    <form method="post" action="/easychair/select-conference/choose" class="h-100">
                        <input type="hidden" name="conference_id" value="<?= (int)$conf['id'] ?>">
                        <div class="conf-card">
                            <div class="d-flex justify-content-between align-items-start gap-2 mb-3">
                                <span class="badge-soft"><?= htmlspecialchars($conf['short_name'] ?? ('#'.$conf['id'])) ?></span>
                                <span class="badge-soft"><?= htmlspecialchars($conf['status'] ?? '') ?></span>
                            </div>

                            <h5 class="fw-bold mb-2">
                                <?= htmlspecialchars(($conf['title_ar'] ?? '') ?: (($conf['title_en'] ?? '') ?: 'Conference')) ?>
                            </h5>

                            <?php if (!empty($conf['title_en'])): ?>
                                <div class="text-muted small mb-3"><?= htmlspecialchars($conf['title_en']) ?></div>
                            <?php endif; ?>

                            <button class="btn-main w-100" type="submit">دخول المؤتمر</button>
                        </div>
                    </form>
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>
</div>
</body>
</html>
