<!DOCTYPE html>
<html lang="bn">
<head>
<meta charset="UTF-8">
<title>Promotions - CV111</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
    body { background: #0a0a0a; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
    .header-bg { background: linear-gradient(160deg, #1a1005 0%, #0a0a0a 80%); }
    .card-bg { background: #141414; }
</style>
</head>
<body class="pb-8">

<header class="header-bg border-b border-gray-800 sticky top-0 z-50">
    <div class="max-w-2xl mx-auto px-4 h-14 flex items-center gap-3">
        <a href="/newhome.php" class="text-gray-300 text-xl"><i class="fa-solid fa-arrow-left"></i></a>
        <div class="text-white font-bold text-base">Promotions</div>
    </div>
</header>

<main class="max-w-2xl mx-auto px-4 py-5">
    <a href="/newbonusterms.php" class="block bg-[#132238] border border-gray-800 rounded-xl p-4 mb-4 hover:border-yellow-500 transition">
        <div class="flex items-center justify-between">
            <div>
                <div class="text-yellow-400 font-bold text-sm">💰 Deposit Bonus (৫% পর্যন্ত)</div>
                <div class="text-gray-500 text-[11px] mt-0.5">Terms & Conditions দেখো</div>
            </div>
            <i class="fa-solid fa-chevron-right text-gray-600 text-xs"></i>
        </div>
    </a>
    <div id="promoList" class="space-y-3">
        <div class="text-center text-gray-500 text-xs py-10">লোড হচ্ছে...</div>
    </div>
</main>

<script>
async function loadPromotions() {
    const list = document.getElementById('promoList');
    try {
        const res = await fetch('/deepanshu/api/webapi/GetActivityList.php');
        const data = await res.json();
        const items = (data.data && data.data.list) || [];

        if (items.length === 0) {
            list.innerHTML = '<div class="text-center text-gray-500 text-xs py-10">কোনো Promotion নেই।</div>';
            return;
        }

        list.innerHTML = items.map(promo => {
            // ✅ "DailySignIn" Activity হলে, আমাদের নিজের Page-এ পাঠানো
            const isSignIn = (promo.contents || '').includes('DailySignIn');
            const link = isSignIn ? '/newsignin.php' : '#';
            return `
            <a href="${link}" class="card-bg rounded-xl overflow-hidden border border-gray-800 block hover:border-yellow-500 transition">
                <img src="${promo.bannerUrl}" alt="${promo.bannerTitle}" class="w-full aspect-[2/1] object-cover" onerror="this.style.display='none'">
                <div class="p-3">
                    <div class="text-white font-bold text-sm">${promo.bannerTitle}</div>
                </div>
            </a>`;
        }).join('');
    } catch (e) {
        list.innerHTML = '<div class="text-center text-red-400 text-xs py-10">Load ব্যর্থ হয়েছে।</div>';
    }
}

loadPromotions();
</script>

</body>
</html>
