<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ดาวน์โหลด - SERET-SEVEN-STORE</title>
    <link rel="shortcut icon" href="./assets/img/icon.ico" type="image/x-icon">

    <!-- [CDN-TailwindCSS] -->
    <script src="https://cdn.tailwindcss.com"></script>

    <!-- [FONTS] -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,400;0,800&display=swap" rel="stylesheet">

    <style>
        body {
            background-color: #101117;
            font-family: 'Kanit', serif;
        }
    </style>
</head>
<body data-spy="scroll" data-target=".site-navbar-target" data-offset="300" oncontextmenu="return false">
    <div id="root" class="flex justify-center h-screen px-4 py-6">
        <div class="p-8 md:p-16 w-full h-full flex flex-col items-center">
            <div class="bg-gray-900 shadow-xl rounded-xl p-8 md:p-12 max-w-4xl w-full">
                <h1 class="text-4xl font-extrabold text-gray-100 text-center mb-6">
                    ดาวน์โหลด Launcher <br /> Seret Seven Store
                </h1>
                <p class="text-gray-400 text-center text-md md:text-lg mb-9">
                    เริ่มต้นใช้งานโปรแกรม Launcher เพื่อจัดการบริการของ Seret Seven Store
                    ได้ง่ายดาย เพียงคลิกปุ่มดาวน์โหลดด้านล่าง
                </p>
                <div class="flex flex-col justify-center items-center gap-4">
                    <button id="download-button" 
                        class="bg-gradient-to-r from-blue-500 to-blue-700 text-white text-lg font-bold py-3 px-8 rounded-full shadow-lg hover:shadow-xl hover:scale-105 transition-all duration-300">
                        ดาวน์โหลด Launcher
                    </button>
                    <div id="progress-bar-container" class="relative w-full max-w-md bg-gray-800 rounded-full h-4 overflow-hidden shadow-inner hidden">
                        <div id="progress-bar" class="bg-gradient-to-r from-blue-500 via-blue-600 to-blue-700 h-full rounded-full transition-all duration-150 ease-out" style="width: 0%;"></div>
                        <span id="progress-text" class="absolute inset-0 flex items-center justify-center text-white font-bold text-xs"></span>
                    </div>
                </div>
                <div class="mt-10 text-center text-sm text-gray-400">
                    <p><span class="font-medium">OS ที่รองรับ:</span> Windows 10-11</p>
                    <p><span class="font-medium">ขนาดไฟล์:</span> 4.62 MB</p>
                    <p><span class="font-medium">เวอร์ชัน:</span> 1.2.0</p>
                    <p><span class="font-medium">อัปเดตล่าสุด:</span> 1 มกราคม 2025</p>
                </div>
            </div>
            <div class="mt-12 py-10 w-full flex flex-col items-center gap-6">
                <div class="w-full md:w-2/3 bg-gray-900 shadow-lg p-6 rounded-lg text-center">
                    <h2 class="text-2xl font-bold text-gray-100 mb-4">สอนใช้งาน Launcher เเละติดตั้งโปรเเกรม</h2>
                    <p class="text-gray-400 leading-relaxed mb-4">
                        เรียนรู้วิธีการใช้งาน Launcher ของเราในคลิปวิดีโอด้านล่าง เพื่อช่วยให้คุณเข้าถึงบริการ
                        และฟีเจอร์ที่ทันสมัยได้อย่างง่ายดาย
                    </p>
                    <div class="relative w-full h-0 pb-[56.25%]">
                        <iframe 
                            class="absolute top-0 left-0 w-full h-full rounded-lg" 
                            src="https://www.youtube.com/embed/RV-sPkYVL-A?si=XxUnG-f99ySl4JDs" 
                            title="วิธีการใช้งาน Launcher" 
                            frameBorder="0" 
                            allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
                            allowFullScreen>
                        </iframe>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        const downloadButton = document.getElementById('download-button');
        const progressBarContainer = document.getElementById('progress-bar-container');
        const progressBar = document.getElementById('progress-bar');
        const progressText = document.getElementById('progress-text');
        let progress = 0;

        const handleDownload = () => {
            downloadButton.disabled = true;
            downloadButton.textContent = 'กำลังดาวน์โหลด...';
            progressBarContainer.classList.remove('hidden');

            const encodedURL = btoa('./filesdownload/setup-launcher-seret-seven-store.exe');
            const interval = setInterval(() => {
                progress += 5;
                progressBar.style.width = `${progress}%`;
                progressText.textContent = `${progress}%`;

                if (progress >= 100) {
                    clearInterval(interval);
                    setTimeout(() => {
                        const decodedURL = atob(encodedURL);
                        window.location.href = decodedURL;
                        downloadButton.disabled = false;
                        downloadButton.textContent = 'ดาวน์โหลด Launcher';
                        progressBarContainer.classList.add('hidden');
                        progress = 0;
                        progressBar.style.width = '0%';
                    }, 500);
                }
            }, 350);
        };

        downloadButton.addEventListener('click', handleDownload);
    </script>
</body>
</html>