@extends('Layout.usergame')
@section('content')
<div class="main-container" style=" background-color: #111;">
<div class="container text-center">
    <div class="px-3 mt-4 pb-2 text-center">
        <h4 class="mb-2">
    @if (!session()->has('userlogin'))
        <button class="btn demon-btns auth-btn" data-bs-toggle="modal" data-bs-target="#register-modal">
            Register
        </button>
        <button class="btn demon-btns auth-btn" data-bs-toggle="modal" data-bs-target="#login-modal" id="login">
            Login
        </button>
    @else
        <a href="/crash" class="btn demon-btns play-now-btn">
            PLAY NOW
        </a>
    @endif
</h4>

    </div>
</div>    
</div>
<style>
    body {
        font-family: Arial, sans-serif;
        background-color: #f0f0f0;
        /* Light background color */
        padding: 20px;
        /* Add padding for spacing */
    }

    .withdrawals {
        max-width: 100%;
        /* Max width to fit any screen */
        margin: 20px auto;
        /* Center align and add margin */
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 8px;
        background-color: #f9f9f9;
        display: flex;
        flex-direction: column;
        /* Display withdrawals in a column */
        align-items: center;
        /* Center items horizontally */
    }

    .withdrawal {
        width: 100%;
        /* Occupy full width */
        display: flex;
        flex-direction: column;
        /* Display each withdrawal in a column */
        align-items: center;
        /* Center items horizontally */
        margin-bottom: 10px;
        padding: 10px;
        border-bottom: 1px solid #eee;
        text-align: center;
        /* Center text */
    }

    .user {
        font-weight: bold;
        margin-bottom: 5px;
        /* Add margin below user name */
    }

    .label {
        font-weight: bold;
        margin-bottom: 5px;
        /* Add margin below label */
    }

    .amount {
        color: green;
        font-weight: bold;
        /* Make amount bold */
    }

    @media (max-width: 600px) {
        .withdrawal {
            width: 100%;
            /* Ensure full width */
            text-align: center;
            /* Center text */
        }
    }
</style>

<div class="withdrawals" id="withdrawals">
    <!-- Withdrawals will be displayed here -->
</div>

<script>
    const users = [
        "Abhishek",
        "Aman",
        "Harsh",
        "Ayush",
        "Aditi",
        "Anjali",
        "Shubham",
        "Anushka",
        "Rohit",
        "Saurabh",
        "Muskan",
        "Rahul",
        "Utkarsh",
        "Vaibhav",
        "Amit",
        "Saumya",
        "Rishabh",
        "Shruti",
        "Himanshu",
        "Kajal",
        "Ankit",
        "Gaurav",
        "Nikhil",
        "Siddharth",
        "Prashant",
        "Priya",
        "Harshit",
        "Shashank",
        "Akash",
        "Varun",
        "Yash",
        "Shreya",
        "Harshita",
        "Anurag",
        "Vivek",
        "Swati",
        "Vishal",
        "Aditya",
        "Nidhi",
        "Ayushi",
        "Krishna",
        "Anshika",
        "Sakshi",
        "Shivani",
        "Prakhar",
        "Mansi",
        "Tushar",
        "Abhinav",
        "Shivangi",
        "Ashutosh",
        "Adarsh",
        "Divya",
        "Piyush",
        "Pragya",
        "Ajay",
        "Akanksha",
        "Neeraj",
        "Ritika",
        "Tanya",
        "Nisha",
        "Arun",
        "Pallavi",
        "Aniket",
        "Nikita",
        "Vijay",
        "Ananya",
        "Priyanshi",
        "Suraj",
        "Akshat",
        "Ishika",
        "Mohit",
        "Palak",
        "Ankur",
        "Richa",
        "Ravi",
        "Arpit",
        "Ankita",
        "Shraddha",
        "Deepak",
        "Priyanka",
        "Khushi",
        "Shweta",
        "Kavya",
        "Kunal",
        "Dheeraj",
        "Akshita",
        "Riya",
        "Sneha",
        "Pranjal",
        "Isha",
        "Sumit",
        "Kishan",
        "Pawan",
        "Soumya",
        "Neelesh",
        "Sarthak",
        "Alok",
        "Raghav",
        "Rishi",
        "Pragati",
        "Shivam",
        "Lakshya",
        "Ashish",
        "Sandeep",
        "Ishita",
        "Shaurya",
        "Kashish",
        "Vineet",
        "Mayank",
        "Jyoti",
        "Parul",
        "Shambhavi",
        "Anshu",
        "Keshav",
        "Prince",
        "Prakash",
        "Pratibha",
        "Praveen",
        "Priyanshu",
        "Kshitij",
        "Arushi",
        "Ishan",
        "Garima",
        "Manish",
        "Vaishnavi",
        "Shreyansh",
        "Atul",
        "Sarvesh",
        "Vidya",
        "Shubhangi",
        "Mohsin",
        "Saran",
        "Vikash",
        "Aayush",
        "Akhilesh",
        "Nitin",
        "Himani",
        "Sushil",
        "Vartika",
        "Aviral",
        "Abdul",
        "Sumeet",
        "Prerna",
        "Nupur",
        "Neha",
        "Vikas",
        "Vanshika",
        "Rohan",
        "Shivansh",
        "Sunil",
        "Juhi",
        "Nitesh",
        "Ganesh",
        "Naveen",
        "Shikhar",
        "Jitendra",
        "Chirag",
        "Abhay",
        "Lucky",
        "Smriti",
        "Manu",
        "Deependra",
        "Anoop",
        "Devendra",
        "Diksha",
        "Muskaan",
        "Divyansh",
        "Kushal",
        "Nitish",
        "Preeti",
        "Anand",
        "Hemant",
        "Amol",
        "Sonal",
        "Rishab",
        "Shashwat",
        "Shatakshi",
        "Supriya",
        "Anchal",
        "Simran",
        "Srijan",
        "Ashwani",
        "Stuti",
        "Abhijeet",
        "Harshvardhan",
        "Ajit",
        "Poornima",
        "Anil",
        "Mahendra",
        "Ahmad",
        "Shalini",
        "Abhijit",
        "Suyash",
        "Sanskriti",
        "Danish",
        "Tamanna",
        "Unnati",
        "Sachin",
        "Anupam",
        "Shailesh",
        "Shoaib",
        "Vishnu",
        "Surya",
        "Pankaj",
        "Kaif",
        "Pooja",
        "Gayathri",
        "Pradeep",
        "Ritu",
        "Dinesh",
        "Shriya",
        "Tharun",
        "Karan",
        "Kiran",
        "Tarun",
        "Samarth",
        "Ruchi",
        "Udit",
        "Rashi",
        "Shailendra",
        "Sameer",
        "Shubhi",
        "Siddhant",
        "Mahi",
        "Kanika",
        "Aishwarya",
        "Rajat",
        "Rituraj",
        "Naman",
        "Mukesh",
        "Roshan",
        "Nandini",
        "Rashmi",
        "Vigneshwaran",
        "Kriti",
        "Arpita",
        "Divyanshi",
        "Yogesh",
        "Deepika",
        "Astha",
        "Sanjay",
        "Mahek",
        "Narendra",
        "Ekta",
        "Adil",
        "Ritesh",
        "Bhumika",
        "Samriddhi",
        "Anmol",
        "Aayushi",
        "Akshay",
        "Shekhar",
        "Amisha",
        "Amrita",
        "Sekhar",
        "Kundalik",
        "Durga",
        "Apurva",
        "Alka",
        "Indora",
        "Aqsa",
        "Anwar",
        "Apratim",
        "Hasni",
        "Dalia",
        "Aadharsh",
        "Amarnath",
        "Bramoni",
        "Nethaji",
        "Chetna",
        "Aastha",
        "Aakriti",
        "Abhyuday",
        "Akarsh",
        "Navneet",
        "Om",
        "Swapnil",
        "Akhil",
        "Madhav",
        "Divyam",
        "Kirti",
        "Annanya",
        "Arunima",
        "Niteesh",
        "Nithisha",
        "Sandhya",
        "Uttam",
        "Vatsalya",
        "Aparna",
        "Disha",
        "Seema",
        "Suryansh",
        "Yashaswi",
        "Avinash",
        "Smita",
        "Subhra",
        "Tuhin",
        "Arti",
        "Aakash",
        "Ayan",
        "Aryan",
        "Vertika",
        "Umme",
        "Yukti",
        "Vishesh",
        "Ayushman",
        "Geeta",
        "Divyanshu",
        "Jaswant",
        "Hemanshu",
        "Bhoopendra",
        "Bhawana",
        "Divakar",
        "Dimpal",
        "Shrestha",
        "Shivanshi",
        "Shubh",
        "Shreyash",
        "Satyarth",
        "Satyam",
        "Shilpa",
        "Shikha",
        "Soniya",
        "Tanay",
        "Sushant",
        "Ujjwal",
        "Tanu",
        "Subham",
        "Srishti",
        "Suryakant",
        "Sudhanshu",
        "Shivang",
        "Shilpi",
        "Sourabh",
        "Sonu",
        "Shakti",
        "Satendra",
        "Shaqib",
        "Shalu",
        "Sudheer",
        "Vipul",
        "Vipin",
        "Yashika",
        "Virat",
        "Varsha",
        "Sunny",
        "Vineeta",
        "Vibhanshu",
        "Monti",
        "Minakshi",
        "Nitikarsh",
        "Mugdha",
        "Madhu",
        "Khanak",
        "Megha",
        "Manya",
        "Pakhi",
        "Ranu",
        "Purvi",
        "Sapna",
        "Saloni",
        "Prachi",
        "Poonam",
        "Purnima",
        "Prajjwal",
        "Satya",
        "Vandana",
        "Tanishq",
        "Amaan",
        "Yuvraj",
        "Saurav",
        "Sanjeev",
        "Simaran",
        "Shrishti",
        "Amrit",
        "Arman",
        "Archana",
        "Avanish",
        "Yusuf",
        "Anubhav",
        "Anita",
        "Anupriya",
        "Anukriti",
        "Kritika",
        "Hariom",
        "Gargi",
        "Janvi",
        "Jai",
        "Naziya",
        "Ragini",
        "Priyam",
        "Sania",
        "Sangeeta",
        "Nimish",
        "Nimesh",
        "Prabhakar",
        "Nivedita",
        "Neetika",
        "Monu",
        "Pankhuri",
        "Nilesh",
        "Mallika",
        "Mahima",
        "Mehak",
        "Manshi",
        "Prakhyat",
        "Saket",
        "Rishika",
        "Satvik",
        "Sanskar",
        "Prateek",
        "Prarthana",
        "Rekha",
        "Pratham",
        "Devanshu",
        "Devansh",
        "Dolly",
        "Dhruv",
        "Deeksha",
        "Bhavya",
        "Dev",
        "Deepali",
        "Faizan",
        "Khushboo",
        "Karishma",
        "Madhuri",
        "Meenu",
        "Manju",
        "Kavita",
        "Jyotsna",
        "Gulshan",
        "Gurdeep",
        "Krati",
        "Navya",
        "Nalini",
        "Nandita",
        "Parth",
        "Pramod",
        "Nehal",
        "Omprakash",
        "Pushpa",
        "Rupali",
        "Radha",
        "Ratna",
        "Rashi",
        "Rachna",
        "Ritvi",
        "Raunak",
        "Saroj",
        "Samaira",
        "Samiksha",
        "Shiv",
        "Shankar",
        "Sapna",
        "Sanya",
        "Taniya",
        "Sarita",
        "Shabnam",
        "Shaheen",
        "Shikhar",
        "Sheetal",
        "Sangeet",
        "Soham",
        "Sulochana",
        "Suman",
        "Suresh",
        "Tanvi",
        "Swati",
        "Shweta",
        "Surbhi",
        "Sunita",
        "Seema",
        "Srishti",
        "Tannu",
        "Usha",
        "Veena",
        "Vidhi",
        "Vartika",
        "Yashika",
        "Vandana",
        "Vedika",
        "Vikas",
        "Vinod",
        "Vipin",
        "Vinay",
        "Vishal",
        "Vikram",
        "Vivek",
        "Vishnu",
        "Yash",
        "Yogesh",
        "Utkarsh",
        "Udit",
        "Uday",
        "Vijay",
        "Yuvraj",
        "Jatin",
        "Jai",
        "Jaya",
        "Jyoti",

    ];

    let startTime = new Date('2024-07-05T00:00:00'); // Initial start time (Set this to the desired initial time)
    let currentTime = new Date();
    let elapsedSeconds = Math.floor((currentTime - startTime) / 1000);
    let currentIndex = Math.floor(elapsedSeconds / 1) % users.length; // Update index based on elapsed time

    function getRandomAmount() {
        return Math.floor(Math.random() * (200000 - 1200) + 1200); // Random amount between ₹1,200 and ₹200,000 without decimals
    }

    function displayWithdrawals() {
        const withdrawalsContainer = document.getElementById('withdrawals');
        withdrawalsContainer.innerHTML = '';

        // Display up to 1 withdrawals or until end of users array
        for (let i = 0; i < 1 && currentIndex < users.length; i++, currentIndex++) {
            const user = users[currentIndex];
            const amount = getRandomAmount();
            const withdrawalDiv = document.createElement('div');
            withdrawalDiv.classList.add('withdrawal');

            // Remove double quotes from user name
            const formattedUser = user.replace(/"/g, '');

            const userDiv = document.createElement('div');
            userDiv.classList.add('user');
            userDiv.innerText = formattedUser;

            const labelDiv = document.createElement('div');
            labelDiv.classList.add('label');
            labelDiv.innerText = "Approved Withdrawal:";

            const amountDiv = document.createElement('div');
            amountDiv.classList.add('amount');
            amountDiv.innerText = `₹${amount}`;

            withdrawalDiv.appendChild(userDiv);
            withdrawalDiv.appendChild(labelDiv);
            withdrawalDiv.appendChild(amountDiv);

            withdrawalsContainer.appendChild(withdrawalDiv);
        }

        // Reset currentIndex to start over if end of array is reached
        if (currentIndex >= users.length) {
            currentIndex = 0;
        }
    }

    displayWithdrawals();

    // To refresh the list every 0.4 seconds
    setInterval(displayWithdrawals, 1000);
</script>
<!-- CSS -->
<style>
    /* Body */
    body { 
        font-family: 'Lora', serif; 
        background-color: #111; 
        color: #fff; 
        padding: 20px; 
    }

    /* Main Container */
    .main-container {
        color: #eee;
        max-width: 1200px;
        margin: 0 auto;
    }

    /* Carousel */
    .owl-carousel .item {
        position: relative;
    }

    .carousel-image {
        border-radius: 15px;
        box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.6);
        transition: transform 0.3s ease-in-out;
    }

    .carousel-image:hover {
        transform: scale(1.05);
    }

    /* Game List Section */
    .container h4 {
        font-size: 1.8rem;
        font-weight: 700;
        color: #ffc107;
        letter-spacing: 2px;
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    }

    /* Buttons */
    .btn {
        font-size: 1.1rem;
        font-weight: 600;
        padding: 12px 20px;
        margin: 0 10px;
        border-radius: 5px;
        transition: all 0.3s ease-in-out;
    }

    .play-now-btn {
        background: linear-gradient(45deg, #28a745, #218838);
        color: #fff;
    }

    .auth-btn {
        background: linear-gradient(263.87deg, rgb(148, 78, 245) 0%, rgb(92, 36, 252) 100%);
        color: rgb(250, 250, 250);
    text-shadow: rgb(138, 138, 138) 0px 0px 20px;
    }

    .play-now-btn:hover, .auth-btn:hover {
        transform: scale(1.1);
        box-shadow: 0 8px 20px rgba(255, 193, 7, 0.6);
    }

    /* Withdrawal Container */
    .withdrawals {
        max-width: 80%;
        margin: 40px auto;
        padding: 20px;
        background: #222;
        border-radius: 12px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    }

    .withdrawal {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px;
        border-bottom: 1px solid #444;
    }

    .user, .label {
        font-weight: bold;
        font-size: 1.1rem;
    }

    .amount {
        color: #ffc107;
        font-weight: bold;
        font-size: 1.2rem;
    }

    /* Mobile Responsiveness */
    @media (max-width: 600px) {
        .withdrawal { 
            flex-direction: column; 
            text-align: center; 
        }
    }

    /* Animations */
    .btn, .carousel-image {
        animation: fadeIn 1s ease-in-out;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
</style>

<!-- JavaScript -->
<script>
    // Initialize the Owl Carousel
    $(document).ready(function(){
        $(".owl-carousel").owlCarousel({
            items: 1,
            loop: true,
            autoplay: true,
            autoplayTimeout: 5000,
            autoplayHoverPause: true,
            dots: true,
        });
    });
</script> 
    <style>
        /* General Reset */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: Arial, sans-serif;
        }

        body {
            background-color: #121212;
            color: #fff;
        }

        .container {
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
        }

        /* Header */
        header {
            text-align: center;
            padding: 40px 20px;
        }

        header h1 {
            font-size: 3em;
            color: #fbb034;
        }

        header p {
            font-size: 1.2em;
            color: #aaa;
        }

        /* Call-to-Action Button */
        .cta-btn {
            display: inline-block;
            background-color: #765dcd;
            color: #ffffff;
            padding: 15px 30px;
            font-size: 1.3em;
            text-decoration: none;
            border-radius: 8px;
            margin-top: 20px;
            transition: background-color 0.3s;
        }

        .cta-btn:hover {
            background-color: #ffa500;
        }

        /* Main Content */
        .content {
            margin-top: 40px;
        }

        .section {
            padding: 20px 0;
        }

        .section h2 {
            color: #fbb034;
            font-size: 2em;
            margin-bottom: 10px;
        }

        .section p {
            color: #aaa;
            line-height: 1.6em;
        }

        /* Footer */
        footer {
            text-align: center;
            padding: 20px 0;
            font-size: 0.9em;
            color: #777;
            border-top: 1px solid #333;
            margin-top: 40px;
        }
    </style>
<body>

    <!-- Header -->
    <header>
        <h1>Welcome to Aviator Game</h1>
        <p>The ultimate online game where you control the flight!</p>
        <a href="/app.apk" class="cta-btn">DOWNLOAD APK</a>
    </header>

    <!-- Main Content -->
    <div class="container">
        <div class="content">
            <!-- Game Description Section -->
            <div class="section" id="about">
                <h2>About the Game</h2>
                <p>Aviator is a fun and exciting game where players can experience the thrill of flying. Your mission is to control your flight, gain points, and avoid obstacles.</p>
            </div>

            <!-- How to Play Section -->
            <div class="section" id="how-to-play">
                <h2>How to Play</h2>
                <p>Simply click to launch your plane, then control it to soar as high as you can while avoiding obstacles. The longer you stay in flight, the more points you earn!</p>
            </div>

            <!-- Game Rules Section -->
            <div class="section" id="rules">
                <h2>Game Rules</h2>
                <p>1. Press start to begin the game. <br>
                2. Use your controls to navigate your plane. <br>
                3. Avoid all obstacles. <br>
                4. The game ends when you collide with an obstacle.</p>
            </div>
        </div>
    </div>
@endsection