<?php
/**
 * apk_download_popup.php
 * ✅ Website Visit করলে একবার (Per Session) এই Popup দেখাবে —
 * User-কে App Download করতে বলবে। "Maybe Later" চাপলে সেই
 * Session-এ আর দেখাবে না।
 */
?>
<div id="apkPopOverlay" style="display:none; position:fixed; inset:0; background:rgba(0,0,0,.85); z-index:9999; align-items:center; justify-content:center; padding:16px;">
    <div style="max-width:340px; width:100%; background:linear-gradient(160deg, #1D1533 0%, #120D24 100%); border:1px solid rgba(155,93,229,.35); border-radius:20px; padding:28px 24px; text-align:center; position:relative;">
        <button onclick="closeApkPopup()" style="position:absolute; top:12px; right:12px; background:transparent; border:none; color:#9691B0; font-size:18px; cursor:pointer;">✕</button>

        <div style="width:64px; height:64px; margin:0 auto 16px; border-radius:16px; background:linear-gradient(135deg,#6C3FC5,#9B5DE5); display:flex; align-items:center; justify-content:center; font-size:28px;">
            📲
        </div>

        <div style="font-size:17px; font-weight:800; color:#fff; margin-bottom:6px;">CV111 App Download করুন</div>
        <div style="font-size:12.5px; color:#9691B0; line-height:1.6; margin-bottom:20px;">
            App দিয়ে আরও দ্রুত খেলুন, দ্রুত Deposit/Withdraw করুন — Play Store ছাড়াই সরাসরি Install করা যায়।
        </div>

        <a href="/downloads/CV111.apk" download
           style="display:block; background:linear-gradient(135deg,#F5C542,#E0A926); color:#1A1400; font-weight:800; font-size:13.5px; padding:12px; border-radius:12px; text-decoration:none; margin-bottom:10px;">
            ⬇️ এখনই Download করুন
        </a>
        <button onclick="closeApkPopup()" style="background:transparent; border:none; color:#9691B0; font-size:12px; padding:6px; cursor:pointer;">
            পরে করবো
        </button>
    </div>
</div>

<script>
(function() {
    if (sessionStorage.getItem('apkPopupSeen')) return;

    const overlay = document.getElementById('apkPopOverlay');

    setTimeout(function() {
        overlay.style.display = 'flex';
        sessionStorage.setItem('apkPopupSeen', '1');
    }, 1500); // Website Load হওয়ার ১.৫ সেকেন্ড পর দেখাবে
})();

function closeApkPopup() {
    document.getElementById('apkPopOverlay').style.display = 'none';
}
</script>
