<x-front-layout>
    @section('title', $page . ' | ' . get_setting('site_name'))
<span class="fixed blur-[200px] w-[600px] h-[600px] rounded-full top-1/2 -translate-y-1/2 ltr:left-1/2 ltr:-translate-x-1/2 rtl:right-1/2 rtl:translate-x-1/2 bg-indigo-600/20"></span>
        <!-- Start -->
        <section class="relative overflow-hidden md:pt-44 pt-36 md:pb-24 pb-16">
            <div class="container relative">
                <div class="grid md:grid-cols-2 grid-cols-1 items-center mt-8 gap-[30px] relative">
                    <div class="ltr:md:mr-6 rtl:md:ml-6">
                        <h4 class="font-bold lg:leading-normal leading-normal text-4xl lg:text-5xl mb-5 text-black dark:text-white">{{ get_setting('site_name') }}</h4>
                        <p class="text-slate-400 text-lg max-w-xl">{{ get_setting('site_description') }}</p>
                    
                        <div class="mt-6">
                                @auth
                                <a href="/dashboard" class="btn h-[46px] w-fit bg-indigo-600 hover:bg-indigo-700 border-indigo-600 hover:border-indigo-700 text-white rounded-full flex items-center px-5">
                                    Dashboard <i data-feather="grid" class="ml-2"></i>
                                </a>
                                @else
                                <div class="flex gap-4">
                                    <a href="/login" class="btn h-[46px] w-fit bg-indigo-600 hover:bg-indigo-700 border-indigo-600 hover:border-indigo-700 text-white rounded-full flex items-center px-5">
                                        Login <i data-feather="log-in" class="ml-2"></i>
                                    </a>
                            
                                    <a href="/register" class="btn h-[46px] w-fit bg-green-600 hover:bg-green-700 border-green-600 hover:border-green-700 text-white rounded-full flex items-center px-5">
                                        Register <i data-feather="user-plus" class="ml-2"></i>
                                    </a>
                                </div>
                                @if (!empty(env('GOOGLE_CLIENT_ID')) && !empty(env('GOOGLE_CLIENT_SECRET')))
                                <!-- Divider -->
                                <div class="relative flex items-center my-2">
                                    <span class="w-full border-t border-gray-300"></span>
                                </div>
                            
                                <!-- OAuth Login Button -->
                                <a href="/oauth/google" class="btn h-[46px] w-fit bg-transparent border border-indigo-600 hover:border-indigo-600 text-gray-700 hover:text-indigo-600 rounded-full flex items-center px-5">
                                    <img class="h-9" src="/dist/images/google.png" alt="google"/> Sign in with Google
                                </a>
                                @endif
                                @endauth
                        </div>
                    </div>

                    <div class="relative">
                        <img id="themeImage1" width="295" src="/assets/home/images/ss-light-1.png" class="mx-auto" alt="">
                        <div class="overflow-hidden absolute md:h-[500px] h-[400px] md:w-[500px] w-[400px] bg-gradient-to-tl to-indigo-600/20 via-indigo-600/70 from-indigo-600 bottom-1/2 translate-y-1/2 ltr:md:left-0 ltr:left-1/2 ltr:md:translate-x-0 ltr:-translate-x-1/2 rtl:md:right-0 rtl:right-1/2 rtl:md:translate-x-0 rtl:translate-x-1/2 -z-1 shadow-md shadow-indigo-600/10 rounded-full"></div>

                        <div class="overflow-hidden after:content-[''] after:absolute after:h-10 after:w-10 after:bg-indigo-600/20 after:top-0 ltr:after:left-0 rtl:after:right-0 after:-z-1 after:rounded-lg after:animate-[spin_10s_linear_infinite]"></div>
                    
                        <div class="absolute flex justify-between items-center top-16 ltr:md:-left-10 ltr:-left-5 rtl:md:-right-10 rtl:-right-5 p-4 rounded-lg shadow-md dark:shadow-gray-800 bg-white dark:bg-slate-900 w-60 m-3">
                            <div class="flex items-center">
                                <div class="flex items-center justify-center h-[65px] min-w-[65px] bg-indigo-600/5 text-indigo-600 text-center rounded-full ltr:mr-3 rtl:ml-3">
                                    <i data-feather="dollar-sign" class="h-6 w-6"></i>
                                </div>
                                <div class="flex-1">
                                    <h6 class="text-slate-400">Earnings</h6>
                                    <p class="text-xl font-bold"><span class="counter-value" data-target="2950">2950</span></p>
                                </div>
                            </div>

                            <span class="text-green-600"><i class="uil uil-analysis"></i> 98%</span>
                        </div>

                        <div class="absolute bottom-1/2 translate-y-1/2 ltr:lg:-right-7 ltr:-right-5 rtl:lg:-left-7 rtl:-left-5 p-4 rounded-lg shadow-md dark:shadow-gray-800 bg-white dark:bg-slate-900 w-48 m-3">
                            <h5 class="text-lg font-semibold mb-3">Achievements</h5>
                            <div class="flex justify-between mt-3 mb-2">
                                <span class="text-slate-400">Progress</span>
                                <span class="text-slate-400">84%</span>
                            </div>
                            <div class="w-full bg-gray-100 dark:bg-gray-800 rounded-full h-[6px]">
                                <div class="bg-indigo-600 h-[6px] rounded-full" style="width: 84%"></div>
                            </div>
                        </div>

                        <div class="absolute flex justify-between items-center bottom-16 ltr:md:left-10 ltr:-left-2 rtl:md:right-10 rtl:-right-2 p-4 rounded-lg shadow-md dark:shadow-gray-800 bg-white dark:bg-slate-900 w-44 m-3">
                            <div class="flex items-center">
                                <img src="/dist/images/user.png" class="h-14 w-14 rounded-full shadow-md dark:shadow-gray-800 ltr:mr-3 rtl:ml-3" alt="">
                                <div class="flex-1">
                                    <h6 class="text-lg font-semibold">John Doe</h6>
                                    <p class="text-slate-400">Member</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="relative animate-[spin_30s_linear_infinite] -z-1">
                        <span class="after:absolute ltr:after:left-0 rtl:after:right-0 after:bottom-1/2 after:translate-y-1/2 after:h-2 after:w-8 after:rounded-md after:bg-indigo-600/20 relative after:z-10"></span>
                        <span class="after:absolute ltr:after:left-0 rtl:after:right-0 after:bottom-1/2 after:translate-y-1/2 after:rotate-90 after:h-2 after:w-8 after:rounded-md after:bg-indigo-600/20 relative after:z-10"></span>
                    </div>
                </div><!--end grid-->
                @if (!empty(get_setting('home_top_ad')))
                  <div align="center" class="mt-7">
                      {!! get_setting('home_top_ad') !!}
                  </div>
                @endif
            </div><!--end container-->

            <div class="container md:mt-24 mt-16">
                <div class="grid grid-cols-1 pb-4 text-center">
                    <h3 class="md:text-3xl text-2xl md:leading-normal leading-normal font-semibold">Statistics</h3>
                </div><!--end grid-->
                <div class="grid grid-cols-1 lg:grid-cols-3 md:grid-cols-2 gap-[30px] mb-6">
                    <div class="p-6 bg-indigo-600/5 rounded-xl shadow-sm dark:shadow-gray-800 flex items-center">
                        <div class="px-4">
                            <i data-feather="users" class="w-12 h-12"></i>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold">Registered Users</h3>
                            <p class="text-gray-600 text-lg">{{ number_format($registeredUsers) }}</p>
                        </div>
                    </div>
                    <div class="p-6 bg-indigo-600/5 rounded-xl shadow-sm dark:shadow-gray-800 flex items-center">
                        <div class="px-4">
                            <i data-feather="dollar-sign" class="w-12 h-12"></i>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold">Total Earned</h3>
                            <p class="text-gray-600 text-lg">${{ formatUSD($totalEarned) }}</p>
                        </div>
                    </div>
                    <div class="p-6 bg-indigo-600/5 rounded-xl shadow-sm dark:shadow-gray-800 flex items-center">
                        <div class="px-4">
                            <i data-feather="credit-card" class="w-12 h-12"></i>
                        </div>
                        <div>
                            <h3 class="text-xl font-semibold">Total Payout</h3>
                            <p class="text-gray-600 text-lg">${{ formatUSD($totalPayout) }}</p>
                        </div>
                    </div>
                </div>
            </div><!--end container-->
        
            <div class="container md:mt-24 mt-16">
                <div class="grid grid-cols-1 pb-8 text-center mt-7">
                    <h3 class="mt-4 mb-6 md:text-3xl text-2xl md:leading-normal leading-normal font-semibold">Our Features</h3>

                    <p class="text-slate-400 max-w-xl mx-auto">You know what we do best?</p>
                </div><!--end grid-->
                <div class="grid grid-cols-1 lg:grid-cols-3 md:grid-cols-2 gap-[30px]">
                    <!-- Faucet System -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-water"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Faucet Rewards</a>
                            <p class="text-slate-400 mt-3">Earn free crypto through our faucet system with high reward and daily reset.</p>
                        </div>
                    </div>
                
                    <!-- PTC Ads -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-bill"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">PTC Ads</a>
                            <p class="text-slate-400 mt-3">Get paid to view advertisements. Earn crypto by simply watching short ads.</p>
                        </div>
                    </div>
                
                    <!-- Shortlink Earnings -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-link"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Shortlink Rewards</a>
                            <p class="text-slate-400 mt-3">Earn by visiting shortlinks. Get rewarded for every successful visit.</p>
                        </div>
                    </div>
                
                    <!-- Offerwall Rewards -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-gift"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Offerwall Earnings</a>
                            <p class="text-slate-400 mt-3">Complete surveys, watch videos, and engage with offers to earn even more rewards.</p>
                        </div>
                    </div>
                
                    <!-- Fast -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-bolt"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Lightning-Fast Performance</a>
                            <p class="text-slate-400 mt-3">Our platform is optimized for speed, ensuring smooth navigation, quick page loads, and a seamless experience across all devices.</p>
                        </div>
                    </div>
                
                    <!-- Secure & Reliable -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-lock"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Secure Platform</a>
                            <p class="text-slate-400 mt-3">Your funds and personal information are safe with our advanced security measures.</p>
                        </div>
                    </div>
                    
                    <!-- Advertising -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-dollar-sign"></i>
                        </div>
                    
                        <div class="content mt-7">
                            <a href="page-services.html" class="title h5 text-lg font-medium hover:text-indigo-600">Flexible Advertising Pricing</a>
                            <p class="text-slate-400 mt-3">Customize your advertising budget with a flexible pricing system that fits your needs and goals.</p>
                        </div>
                    </div>

                    <!-- Geo target -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-globe"></i>
                        </div>
                    
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">Advanced Geo Targeting</a>
                            <p class="text-slate-400 mt-3">Reach the right audience with precision by targeting users based on their location and demographics.</p>
                        </div>
                    </div>

                    <!-- 24/7 Customer Support -->
                    <div class="p-6 hover:shadow-xl hover:shadow-gray-100 dark:hover:shadow-gray-800 transition duration-500 rounded-2xl mt-6 text-center">
                        <div class="w-20 h-20 bg-indigo-600/5 text-indigo-600 rounded-xl text-3xl flex align-middle justify-center items-center shadow-sm dark:shadow-gray-800 mx-auto">
                            <i class="uil uil-headphones-alt"></i>
                        </div>
                        <div class="content mt-7">
                            <a href="#" class="title h5 text-lg font-medium hover:text-indigo-600">24/7 Support</a>
                            <p class="text-slate-400 mt-3">We are always here to help you with any issues or questions you may have.</p>
                        </div>
                    </div>
                </div>
            </div><!--end container-->

            <div class="container md:mt-24 mt-16">
                <div class="grid md:grid-cols-2 grid-cols-1 items-center gap-[30px]">
                    <div class="relative">
                        <img id="themeImage2" width="295" src="/assets/home/images/ss-light-2.png" class="mx-auto" alt="">
                        <div class="overflow-hidden absolute lg:h-[400px] h-[320px] lg:w-[400px] w-[320px] bg-slate-200/40 dark:bg-slate-800/40 bottom-2/4 translate-y-2/4 ltr:left-0 rtl:right-0 rotate-45 -z-1 rounded-[100px]"></div>
                    </div>
            
                    <div class="ltr:lg:ml-4 rtl:lg:mr-4">
                        <h4 class="mb-4 md:text-3xl text-2xl lg:leading-normal leading-normal font-semibold">
                            Experience Lightning-Fast Performance with Top-Notch Security
                        </h4>
                        <p class="text-slate-400">
                            Our platform is built with cutting-edge technology to ensure the fastest loading times and the highest level of security. Whether you're browsing or making transactions, we guarantee a seamless and safe experience.
                        </p>
                        <ul class="list-none text-slate-400 mt-4">
                            <li class="mb-1 flex"><i class="uil uil-check-circle text-indigo-600 text-xl ltr:mr-2 rtl:ml-2"></i> Optimized for Speed & Low Latency</li>
                            <li class="mb-1 flex"><i class="uil uil-check-circle text-indigo-600 text-xl ltr:mr-2 rtl:ml-2"></i> Advanced Encryption & Secure Transactions</li>
                            <li class="mb-1 flex"><i class="uil uil-check-circle text-indigo-600 text-xl ltr:mr-2 rtl:ml-2"></i> 24/7 Protection Against Threats & Attacks</li>
                        </ul>
                    </div>
                </div><!--end grid-->
            </div><!--end container-->

            <div class="container md:mt-24 mt-16">
                <div class="grid grid-cols-1 pb-8 text-center">
                    <h3 class="mb-6 md:text-3xl text-2xl md:leading-normal leading-normal font-semibold">Payment Proof</h3>
                </div>
                <div class="overflow-x-auto">
                  <table class="w-full">
                    <thead>
                      <tr>
                        <th class="whitespace-nowrap rounded-tl-lg bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5">
                             Method </th>
                        <th class="whitespace-nowrap bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5"> Address </th>
                        <th class="whitespace-nowrap bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5"> Crypto </th>
                        <th class="whitespace-nowrap bg-slate-200 px-4 py-3 font-semibold uppercase text-slate-800 dark:bg-navy-800 dark:text-navy-100 lg:px-5">Date</th>
                      </tr>
                    </thead>
                    <tbody id="withdraw-history">
                      <tr>
                        <td colspan="9" class="text-center py-4">
                            <div class="w-full px-6 py-4"><div class="skeleton animate-wave h-3 w-full rounded bg-slate-150 dark:bg-navy-500"></div><div class="skeleton animate-wave mt-4 h-3 w-8/12 rounded bg-slate-150 dark:bg-navy-500"></div></div>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div><!--end grid-->

                <div class="grid md:grid-cols-12 grid-cols-1 mt-8">
                    <div class="md:col-span-12 text-center">
                        <nav aria-label="Page navigation" id="pagination">

                        </nav>
                    </div>
                </div><!--end grid-->
            </div><!--end container-->
        </section><!--end section-->
        <!-- End -->
@push('scripts')
<script>
let currentpage = 1;
$(document).ready(function() {
        function loadWdHistory(page = 1) {
          $.ajax({
            url: "/withdraw-proof",
            type: "GET",
            data: { page: page },
            dataType: "json",
            beforeSend: function () {
                $("#withdraw-history").html('<tr><td colspan="8" class="text-center py-4"><div class="w-full px-6 py-4"><div class="skeleton animate-wave h-3 w-full rounded bg-slate-150 dark:bg-navy-500"></div><div class="skeleton animate-wave mt-4 h-3 w-8/12 rounded bg-slate-150 dark:bg-navy-500"></div></div></td></tr>');
            },
            success: function (data) {
                var html = "";
                if (data.records.length > 0) {
                    data.records.forEach(function (item) {
                      html += `
                        <tr class="border-y border-transparent border-b-slate-200 dark:border-b-navy-500">
                          <td class="whitespace-nowrap px-4 py-3 sm:px-5">
                              ${item.method}
                          </td>
                          <td class="whitespace-nowrap px-4 py-3 sm:px-5">${item.address}</td>
                          <td class="whitespace-nowrap px-4 py-3 sm:px-5">${item.crypto}</td>
                          <td class="whitespace-nowrap px-4 py-3 sm:px-5">${item.date}</td>
                        </tr>`;
                    });
              } else {
                html = '<tr><td colspan="8" class="text-center py-4">No data available</td></tr>';
              }
              $("#withdraw-history").html(html);
    
            var paginationHtml = `
                <ul class="inline-flex items-center -space-x-px">
                    <li>
                        <a href="#" class="pagination-btn w-[40px] h-[40px] inline-flex justify-center items-center text-slate-400 bg-white dark:bg-slate-900 ltr:rounded-l-lg rtl:rounded-r-lg hover:text-white border border-gray-100 dark:border-gray-700 hover:border-indigo-600 dark:hover:border-indigo-600 hover:bg-indigo-600 dark:hover:bg-indigo-600"" data-page="${data.prev_page}" ${data.prev_page ? "" : "disabled"}>
                            <i class="uil uil-angle-left text-[20px] rtl:rotate-180 rtl:-mt-1"></i>
                        </a>
                    </li>`;
            
            var startPage = Math.max(1, data.current_page - 2);
            var endPage = Math.min(data.total_pages, startPage + 4);
            
            if (startPage > 1) {
                paginationHtml += `<li>
                    <a href="#" class="pagination-btn w-[40px] h-[40px] inline-flex justify-center items-center text-slate-400 hover:text-white bg-white dark:bg-slate-900 border border-gray-100 dark:border-gray-700 hover:border-indigo-600 dark:hover:border-indigo-600 hover:bg-indigo-600 dark:hover:bg-indigo-600" data-page="1">1</a>
                </li>`;
                if (startPage > 2) {
                    paginationHtml += `<li>...</li>`;
                }
            }
            
            for (var i = startPage; i <= endPage; i++) {
                paginationHtml += `<li>
                    <a href="#" class="pagination-btn ${i === data.current_page ? 'z-10 w-[40px] h-[40px] inline-flex justify-center items-center text-white bg-indigo-600 border border-indigo-600' : 'w-[40px] h-[40px] inline-flex justify-center items-center text-slate-400 hover:text-white bg-white dark:bg-slate-900 border border-gray-100 dark:border-gray-700 hover:border-indigo-600 dark:hover:border-indigo-600 hover:bg-indigo-600 dark:hover:bg-indigo-600'}" data-page="${i}">${i}</a>
                </li>`;
            }
            
            if (endPage < data.total_pages) {
                if (endPage < data.total_pages - 1) {
                    paginationHtml += `<li>...</li>`;
                }
                paginationHtml += `<li>
                    <a href="#" class="pagination-btn w-[40px] h-[40px] inline-flex justify-center items-center text-slate-400 hover:text-white bg-white dark:bg-slate-900 border border-gray-100 dark:border-gray-700 hover:border-indigo-600 dark:hover:border-indigo-600 hover:bg-indigo-600 dark:hover:bg-indigo-600" data-page="${data.total_pages}">${data.total_pages}</a>
                </li>`;
            }
            
            paginationHtml += `
                <li>
                    <a href="#" class="pagination-btn w-[40px] h-[40px] inline-flex justify-center items-center text-slate-400 bg-white dark:bg-slate-900 ltr:rounded-r-lg rtl:rounded-l-lg hover:text-white border border-gray-100 dark:border-gray-700 hover:border-indigo-600 dark:hover:border-indigo-600 hover:bg-indigo-600 dark:hover:bg-indigo-600" data-page="${data.next_page}" ${data.next_page ? "" : "disabled"}>
                        <i class="uil uil-angle-right text-[20px] rtl:rotate-180 rtl:-mt-1"></i>
                    </a>
                </li>
            </ul>`;
            
            $("#pagination").html(paginationHtml);
    
            },
          });
        }
    
        loadWdHistory();
    $(document).on("click", ".pagination-btn", function (e) {
      e.preventDefault();
      var page = $(this).data("page");
      if (page) loadWdHistory(page);
    });
});
</script>
@endpush
</x-front-layout>