<?php include_once 'header.php'; ?>
<section class="container mx-auto p-3">
    <nav class="flex mb-1 lg:mb-2">
        <ol class="flex items-center pb-1 overflow-x-scroll whitespace-nowrap opacity-scroll">
            <li class="inline-flex items-end pr-1">
                <a class="text-xs border-b border-transparent hover:lg:border-primary transition-all duration-200 ease-in-out undefined" href="/">Home</a>
            </li>
            <li class="inline-flex items-end pr-1 group">
                <div class="flex items-center">
                    <svg width="17" height="17" viewbox="0 0 24 24" fill="var(--base)" xmlns="http://www.w3.org/2000/svg" size="17">
                        <path d="m15 12 .354-.354.353.354-.353.354L15 12ZM9.354 5.646l6 6-.708.708-6-6 .708-.708Zm6 6.708-6 6-.708-.708 6-6 .708.708Z" fill="var(--base)"></path>
                    </svg><a class="text-xs pl-1 border-b border-transparent hover:lg:border-primary transition-all duration-200 ease-in-out group-last:text-primary undefined" href="/slot">Slot</a>
                </div>
            </li>
        </ol>
    </nav>
    <div class="lg:flex w-full">
        <div class="w-full lg:w-80 lg:pr-3 grid lg:inline-block grid-rows-2 grid-flow-col gap-x-2 md:gap-x-2 gap-y-3 md:gap-y-4 py-2 lg:pt-0 lg:mb-3 overflow-x-scroll lg:overflow-x-hidden overflow-y-hidden whitespace-nowrap lg:whitespace-normal opacity-scroll">
            <div id="PRAGMATIC_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group border border-primary lg:bg-background-tertiary">
                <div class="absolute h-[15px] lg:h-[20px] right-3 lg:right-0 left-3 lg:left-auto -top-2 lg:top-4 lg:bottom-4 overflow-hidden">
                    <span class="flex justify-center px-2 lg:pl-5 mb-1 text-center rounded-full lg:rounded-none transition-all duration-300 ease-in-out " style="background-color:#3ba5f4">
                        <div>
                            <span class="block uppercase text-[10px] md:text-xs font-semibold h-[15px] lg:h-[20px] lg:leading-[20px] text-black">promo</span>
                        </div>
                        <span class="lg:bg-background-tertiary hidden lg:block absolute -left-2 rotate-45 top-0 bottom-0 h-5 w-5 transition-all duration-300 ease-in-out bg-background-secondary group-hover:bg-background-tertiary"></span>
                    </span>
                </div>
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="Pragmatic Play-Pragmatic Play" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/pp2.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">Pragmatic Play</p>
            </div>
            <div id="SPADE_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <div class="absolute h-[15px] lg:h-[20px] right-3 lg:right-0 left-3 lg:left-auto -top-2 lg:top-4 lg:bottom-4 overflow-hidden">
                    <span class="flex justify-center px-2 lg:pl-5 mb-1 text-center rounded-full lg:rounded-none transition-all duration-300 ease-in-out " style="background-color:#3ba5f4">
                        <div>
                            <span class="block uppercase text-[10px] md:text-xs font-semibold h-[15px] lg:h-[20px] lg:leading-[20px] text-black">promo</span>
                        </div>
                        <span class="false hidden lg:block absolute -left-2 rotate-45 top-0 bottom-0 h-5 w-5 transition-all duration-300 ease-in-out bg-background-secondary group-hover:bg-background-tertiary"></span>
                    </span>
                </div>
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="Spadegaming-Spadegaming" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/spade.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">Spadegaming</p>
            </div>
            <div id="PG_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="PG Soft-PG Soft" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/pg.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">PG Soft</p>
            </div>
            <div id="NO_LIMIT_CITY_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="No Limit City-No Limit City" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/nlc.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">No Limit City</p>
            </div>
            <div id="MG_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <div class="absolute h-[15px] lg:h-[20px] right-3 lg:right-0 left-3 lg:left-auto -top-2 lg:top-4 lg:bottom-4 overflow-hidden">
                    <span class="flex justify-center px-2 lg:pl-5 mb-1 text-center rounded-full lg:rounded-none transition-all duration-300 ease-in-out " style="background-color:#3ba5f4">
                        <div>
                            <span class="block uppercase text-[10px] md:text-xs font-semibold h-[15px] lg:h-[20px] lg:leading-[20px] text-black">promo</span>
                        </div>
                        <span class="false hidden lg:block absolute -left-2 rotate-45 top-0 bottom-0 h-5 w-5 transition-all duration-300 ease-in-out bg-background-secondary group-hover:bg-background-tertiary"></span>
                    </span>
                </div>
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="Micro Gaming-Micro Gaming" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/micro.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">Micro Gaming</p>
            </div>
            <div id="HABANERO_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="Habanero-Habanero" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/haba.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">Habanero</p>
            </div>
            <div id="JILI_SLOT-category" class="w-20 md:w-24 lg:w-full max-h-[70px] md:max-h-28 min-w-max py-2 lg:px-3 md:py-4 lg:py-3 lg:mb-3 inline-block lg:flex lg:items-center rounded-md lg:overflow-hidden transition-all duration-300 ease-in-out bg-background-secondary lg:hover:bg-background-tertiary relative cursor-pointer group false">
                <div class="absolute h-[15px] lg:h-[20px] right-3 lg:right-0 left-3 lg:left-auto -top-2 lg:top-4 lg:bottom-4 overflow-hidden">
                    <span class="flex justify-center px-2 lg:pl-5 mb-1 text-center rounded-full lg:rounded-none transition-all duration-300 ease-in-out " style="background-color:#49d4a9">
                        <div>
                            <span class="block uppercase text-[10px] md:text-xs font-semibold h-[15px] lg:h-[20px] lg:leading-[20px] text-black">new</span>
                        </div>
                        <span class="false hidden lg:block absolute -left-2 rotate-45 top-0 bottom-0 h-5 w-5 transition-all duration-300 ease-in-out bg-background-secondary group-hover:bg-background-tertiary"></span>
                    </span>
                </div>
                <figure class="w-7 md:w-9 lg:w-auto md:h-auto lg:h-7 mx-auto lg:mx-0"><img alt="Jili-Jili" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-full h-full mt-1 lg:mt-0" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/jili.png"></figure>
                <p class="text-[10px] lg:text-sm mt-1 lg:mt-0 text-center lg:pl-2">Jili</p>
            </div>
        </div>
        <div class="w-full lg:hidden pt-3 pb-1 mb-3 overflow-x-scroll overflow-y-hidden whitespace-nowrap opacity-scroll sticky top-0 z-[70] bg-background-default">
            <a class="inline-block" href="/slot/search">
                <div class="flex items-center">
                    <figure class="w-6 md:w-8 h-6 md:h-8"><svg width="100%" height="100%" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <circle cx="11" cy="11" r="6" stroke="var(--base)"></circle>
                            <path d="M11 8a3 3 0 0 0-3 3M20 20l-3-3" stroke="var(--base)" stroke-linecap="round"></path>
                        </svg>
                    </figure>
                    <span class="text-[10px] md:text-base pl-1">Search</span>
                </div>
            </a>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="New-New" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/new.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">New</p>
                </div>
            </div>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="Promo-Promo" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/promo.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">Promo</p>
                </div>
            </div>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="Buy Free Spin-Buy Free Spin" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/freespin.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">Buy Free Spin</p>
                </div>
            </div>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="Megaways-Megaways" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/megaway.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">Megaways</p>
                </div>
            </div>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="Video Slots-Video Slots" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/video-slots.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">Video Slots</p>
                </div>
            </div>
            <div class="inline-block">
                <div class="flex items-center ml-3 md:ml-4 ">
                    <img alt="Classic Slots-Classic Slots" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-6 md:w-8 h-6 md:h-8" style="color: transparent;" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/classic-slots.png">
                    <p class="text-[10px] md:text-base text-center pl-1 ">Classic Slots</p>
                </div>
            </div>
        </div>


        <div class="lg:inline-block lg:w-full">
            <div class="hidden lg:flex justify-between pl-3 mb-4">
                <div class="flex items-center">
                    <img alt="Slot Selected Menu Image" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="rounded-lg w-7 lg:w-auto lg:h-7 mx-auto lg:mx-0 lg:mr-3" style="color:transparent" src="https://cdn.databerjalan.com/assets/images/provider/icons/pp2.png">
                    <p class="text-xs">Pragmatic Play</p>
                </div>
                <div class="relative flex items-center w-96">
                    <span class="absolute left-1 cursor-pointer bg-background-secondary px-2">
                        <svg width="20" height="20" viewbox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                            <circle cx="11" cy="11" r="6" stroke="var(--base)"></circle>
                            <path d="M11 8a3 3 0 0 0-3 3M20 20l-3-3" stroke="var(--base)" stroke-linecap="round"></path>
                        </svg>
                    </span>
                    <input type="text" placeholder="Search by Game Vendor or Name" class="bg-background-secondary w-full text-sm rounded-md py-2 pl-10 pr-2 mx-1 focus:outline-none">
                </div>
            </div>

            <div class="lg:pl-3 grid grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2 md:gap-4 lg:gap-5">
                <?php
                $games = mysqli_query($koneksi, "SELECT * FROM games WHERE provider = 'PragmaticPlay'");
                while ($data_games = mysqli_fetch_array($games)) {
                    $angka_rtp = rand($isi_1_rtp_web, $isi_2_rtp_web);
                    $gambar_games = $data_games['image'];
                    $nama_games = $data_games['gamename'];
                    $link_demo = $data_games['link_demo']; // Ambil link demo
                    if ($angka_rtp <= 30) {
                        $warna_rtp = "red";
                    } else if ($angka_rtp <= 60) {
                        $warna_rtp = "yellow";
                    } else if ($angka_rtp <= 100) {
                        $warna_rtp = "green";
                    }
                ?>
                    <div class="relative">
                        <div class="relative z-10 rounded-xl overflow-hidden cursor-pointer group">
                            <!-- HOT Badge -->
                            <div class="absolute top-1 left-1 z-10 h-8 lg:h-9 overflow-hidden">
                                <div>
                                    <span class="text-[9px] text-center px-1 mb-1 rounded-full block font-semibold text-white" style="background-color: rgb(238, 0, 0); animation-delay: -1s;">HOT</span>
                                </div>
                            </div>

                            <section class="absolute z-10 top-0 right-0 bg-black w-8 h-8 p-1 rounded-bl-2xl">
                                <img alt="Elemental Gems Megaways-slot-pragmaticplay" fetchpriority="low" loading="lazy" width="0" height="0" decoding="async" data-nimg="1" class="w-11/12 ml-auto" src="https://cdn.databerjalan.com/cdn-cgi/image/width=auto,quality=75,fit=contain,format=auto/assets/images/provider/icons/pp2.png" style="color: transparent;">
                            </section>
                            <figure class="w-full overflow-hidden">
                                <img alt="undefined-Pragmatic Play-Elemental Gems Megaways" fetchpriority="high" width="300" height="300" decoding="async" data-nimg="1" class="rounded-xl w-full group-hover:lg:scale-110 group-hover:lg:blur-sm transition-all duration-500 ease-in-out" src="<?php echo $alamat_website . 'assets/' . $gambar_games; ?>" alt="<?php echo $nama_games; ?>" style="color: transparent;">
                            </figure>
                            <div class="hidden lg:flex items-center justify-center translate-y-full group-hover:translate-y-0 absolute z-[15] left-0 right-0 top-0 bottom-0 bg-black/80 transition-all duration-500 ease-out">
                                <div>
                                    <?php
                                    if (isset($_SESSION['id_anggota'])) {
                                        // Ambil saldo dan status deposit dari session
                                        $saldo_anggota_aktif = isset($_SESSION['saldo_anggota']) ? $_SESSION['saldo_anggota'] : 0;
                                        $status_deposit = isset($_SESSION['status_deposit']) ? $_SESSION['status_deposit'] : '';

                                        if ($saldo_anggota_aktif <= 0) {
                                    ?>
                                            <a href="<?php echo $link_demo; ?>" class="w-full text-xs rounded-full py-2 px-6 justify-center bg-primary hover:brightness-90 transition-all duration-300 ease-in-out">Play Game</a>
                                            <?php
                                        } else {
                                            if ($status_deposit == 'diproses') {
                                            ?>
                                                <a href="<?php echo $link_demo; ?>" class="w-full text-xs rounded-full py-2 px-6 justify-center bg-primary hover:brightness-90 transition-all duration-300 ease-in-out">Play Game</a>
                                            <?php
                                            } else {
                                            ?>
                                                <a href="<?php echo $link_demo; ?>" class="w-full text-xs rounded-full py-2 px-6 justify-center bg-primary hover:brightness-90 transition-all duration-300 ease-in-out">Play Game</a>
                                        <?php
                                            }
                                        }
                                    } else {
                                        ?>
                                        <a href="javascript:registerPopup({ content:'<?php echo htmlspecialchars($isi_1_popup_teks_belum_login_web, ENT_QUOTES, 'UTF-8'); ?>' });" class="w-full text-xs rounded-full py-2 px-6 justify-center bg-primary hover:brightness-90 transition-all duration-300 ease-in-out">Play Game</a>
                                    <?php
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                        <p class="text-[11px] md:text-xs mt-1 lg:mt-2 truncate"><?php echo $nama_games; ?></p>
                    </div>
                <?php
                }
                ?>
            </div>

            <div class="w-full">
                <div class="flex justify-center my-5 lg:mt-8">
                    <span class="text-[10px] text-center font-medium bg-background-secondary px-3 py-2 rounded-lg">All games have been displayed</span>
                </div>
            </div>
</section>
<?php include_once 'footer.php'; ?>