<!Doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="msapplication-TileColor" content="#07030c">
    <meta name="theme-color" content="#07030c">
    <title> {{ $page_title }} | {{ site('name') }}</title>

    <link rel="shortcut icon" href="{{ asset('assets/images/' . site('favicon')) }}" type="image/x-icon">
    <link rel="apple-touch-icon" href="{{ asset('assets/images/' . site('favicon')) }}" type="image/x-icon">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.min.css">

    <link rel="stylesheet" href="{{ asset('/assets/templates/gopie/css/output.css') }}">

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>

    <!-- chart js  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.1/chart.umd.js"></script>

    <!-- swiper  -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.min.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.min.css" />

    <!-- font  -->
    <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=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet" />

    <!-- fontawesome  -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
        integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />

    <style>
        .button-spinner {
            border: 4px solid #08A6A5;
            /* Light grey background */
            border-top: 4px solid #000;
            /* Blue color for the spinner */
            border-radius: 50%;
            width: 25px;
            height: 25px;
            animation: spin 1s linear infinite;
            /* Spinning animation */
            position: absolute;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }

        .not-allowed-cursor {
            cursor: not-allowed;
        }

        .disabled-button {
            background-color: #1d1c1c !important;
            cursor: not-allowed !important;
            color: #fff !important;
            font-weight: bold;
            pointer-events: none !important;
            cursor: not-allowed;
            padding: 15px;
        }

        @layer base {

            input[type="number"]::-webkit-inner-spin-button,
            input[type="number"]::-webkit-outer-spin-button {
                -webkit-appearance: none;
                margin: 0;
            }
        }

        .primaryBtn {
            background-color: #12b7b6;
        }
    </style>

    <style>
        .backdrop-custom {
            inset: 0;
            background-color: rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            transition: backdrop-filter 0.3s ease-in-out;
        }

        /* .backdrop-custom:hover {
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
        } */
    </style>

    <style>
        /* Logout Button */
        .side-logout,
        .logoutBtn {

            background: #dc2626;
            cursor: pointer;
        }

        .side-logout:hover {
            background: darkred;
        }


        @media (max-width: 1023px) {
            #customSideDropdown {
                top: 5rem;
            }
        }

        @media (min-width: 1024px) {
            #customSideDropdown {
                top: 0px;
            }
        }
    </style>


    @yield('css')

</head>


<body class="bg-[#f3f3f3]">

    {{-- preloader --}}
    @if (site('preloader') == 1)
        @include('templates.' . site('template') . '.loaders.preloader')
    @endif



    <div x-data="{
        isSidebarOpen: false,
        isDropdownOpen: false,
        hasActiveItem: false,
        sidebarHovered: false,
        dropdownPosition: { top: 0, left: 0 },
        items: [
            { name: 'Dashboard', icon: '{{ asset('/assets/templates/gopie/images/dashboard-icon.svg') }}', hasDropdown: false, link: '{{ route('user.dashboard') }}', @if (request()->routeIs('user.dashboard')) active: true, @endif },
            { name: 'Deposit', icon: '{{ asset('/assets/templates/gopie/images/deposit-icon.svg') }}', hasDropdown: false, link: '{{ route('user.deposits.index') }}', @if (request()->routeIs('user.deposits.index')) active: true, @endif },
            { name: 'AI Bots', icon: '{{ asset('/assets/templates/gopie/images/bots-icon.svg') }}', hasDropdown: false, link: '{{ route('user.bots.index') }}', @if (request()->routeIs('user.bots.index')) active: true, @endif },
            { name: 'Withdraw', icon: '{{ asset('/assets/templates/gopie/images/withdraw-dash-icon.svg') }}', hasDropdown: false, link: '{{ route('user.withdrawals.index') }}', @if (request()->routeIs('user.withdrawals.index')) active: true, @endif },
            { name: 'P2p', icon: '{{ asset('/assets/templates/gopie/images/p2p-icon.svg') }}', hasDropdown: false, link: '{{ route('user.transfers.index') }}', @if (request()->routeIs('user.transfers.index')) active: true, @endif },
            { name: 'My Referrals', icon: '{{ asset('/assets/templates/gopie/images/referrals-icon.svg') }}', hasDropdown: false, link: '{{ route('user.referrals') }}', @if (request()->routeIs('user.referrals')) active: true, @endif },
            { name: 'My Transactions', icon: '{{ asset('/assets/templates/gopie/images/transactions-icon.svg') }}', hasDropdown: false, link: '{{ route('user.transactions.index') }}', @if (request()->routeIs('user.transactions.index')) active: true, @endif }
        ]
    }" x-init="hasActiveItem = items.some(item => item.active)" @click.away="isDropdownOpen = false">
        <!-- Mobile Nav Bar -->
        <div
            class="lg:hidden flex items-center justify-between p-4 bg-[#f3f3f3] shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
            <div class="flex items-center">
                <img src="{{ asset('assets/images/' . site('logo_square')) }}" alt="Logo" class="w-12" />
            </div>

            <div class="flex">
                <a href="{{ route('user.profile.index') }}">
                    <!-- Profile  mobile and tablet -->

                    <div
                        class="rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 mr-1 bg-[#f3f3f3] hover:bg-gray-600">
                        <img src="{{ asset('storage/profile/' . user()->photo) }}" alt="Profile"
                            class="h-8 w-8 rounded-full" />
                    </div>
                </a>

                <button @click="isSidebarOpen = !isSidebarOpen" class="text-gray-300">
                    <!-- Hamburger to X Transition -->
                    <svg x-show="!isSidebarOpen" xmlns="http://www.w3.org/2000/svg"
                        class="h-6 w-6 transition-transform duration-300 text-[#12b7b6]" fill="none"
                        viewBox="0 0 24 24" stroke="currentColor">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                            d="M4 6h16M4 12h16M4 18h16" />
                    </svg>
                    <svg x-show="isSidebarOpen" xmlns="http://www.w3.org/2000/svg"
                        class="h-6 w-6 transition-transform duration-300 text-[#12b7b6]" fill="none"
                        viewBox="0 0 24 24" stroke="currentColor">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                            d="M6 18L18 6M6 6l12 12" />
                    </svg>
                </button>
            </div>
        </div>

        <!-- Desktop Top Navigation -->
        <div
            class="hidden lg:block fixed top-0 right-0 left-0 bg-[#f3f3f3] z-10 py-3 shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
            <div class="flex items-center justify-end h-16 px-6 relative">
                <!-- Profile Icon with Dropdown -->
                <div class="flex items-center">
                    <div class="relative">
                        <!-- Profile  Desktop -->

                        <div x-on:click="isDropdownOpen = !isDropdownOpen"
                            class="rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 flex items-center gap-2 cursor-pointer bg-[#f3f3f3] hover:bg-gray-600 hover:text-white pr-2">
                            <img src="{{ asset('storage/profile/' . user()->photo) }}" alt="Profile Icon"
                                class="h-8 w-8 rounded-full" />
                            <span class="text-sm font-medium">{{ user()->username }}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Sidebar -->
        <div class="fixed top-0 left-0 h-full bg-[#f3f3f3] transform transition-all duration-300 ease-in-out z-20 overflow-y-auto shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]"
            :class="{
                'w-60': sidebarHovered || isSidebarOpen,
                'w-20': !sidebarHovered && !isSidebarOpen,
                'translate-x-0 lg:translate-x-0': isSidebarOpen,
                '-translate-x-full lg:translate-x-0': !isSidebarOpen
            }"
            @mouseenter="sidebarHovered = true" @mouseleave="sidebarHovered = false">
            <!-- Logo Section -->
            <div class="flex items-center p-4"
                :class="{ 'px-6': sidebarHovered || isSidebarOpen, 'justify-center': !sidebarHovered && !isSidebarOpen }">
                <img src="{{ asset('assets/images/' . site('logo_square')) }}" alt="Logo" class="w-12" />
            </div>

            <!-- Navigation Links -->
            <nav class="mt-8">
                <div class="space-y-2 px-4">
                    <template x-for="(item, index) in items" :key="index">
                        <div class="relative flex w-full">
                            <a :href="item.link"
                                class="flex items-center w-full transition-all duration-300 rounded-lg"
                                :class="{
                                    'px-4': sidebarHovered || isSidebarOpen,
                                    'justify-center px-2': !sidebarHovered && !isSidebarOpen
                                }">
                                <div class="flex items-center gap-3 py-1 w-full rounded-lg transition-all duration-300"
                                    :class="[
                                        { 'justify-center': !sidebarHovered && !isSidebarOpen },
                                        { 'hover:bg-[#12b7b6] hover:bg-opacity-10': item.active }
                                    ]">
                                    <div class="min-w-[2.5rem] w-10 h-10 flex items-center justify-center rounded-xl transition-all duration-300"
                                        :class="[
                                            'shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]',
                                            item.active ? 'bg-[#12b7b6] p-2.5' :
                                            'bg-transparent p-2 hover:shadow-[inset_0px_5px_15px_-3px_rgba(0,_0,_0,_0.2)]'
                                        ]">
                                        <img :src="item.icon" class="w-full h-full object-contain"
                                            :class="item.active ? 'filter brightness-0 invert' : ''" alt="" />
                                    </div>
                                    <span x-text="item.name" class="whitespace-nowrap transition-all duration-300"
                                        :class="{
                                            'w-0 opacity-0': !sidebarHovered && !isSidebarOpen,
                                            'w-auto opacity-100': sidebarHovered || isSidebarOpen,
                                            'text-[#12b7b6]': item.active
                                        }"></span>
                                </div>
                            </a>
                        </div>
                    </template>
                </div>

                <!-- sidebar profile trigger -->
                <div class="mt-20 px-4">
                    <button
                        @click="
                            isDropdownOpen = !isDropdownOpen;
                            if (!isDropdownOpen) return;
                            $nextTick(() => {
                            const rect = $el.getBoundingClientRect();
                            const isMobile = window.innerWidth < 1024;
                            dropdownPosition = isMobile ? {
                                top: rect.top - (rect.height + 330),
                                left: 16
                            } : {
                                top: Math.max(rect.top - 200, 10),
                                left: rect.right + 16
                            };
                            });
                        "
                        class="flex items-center w-full transition-all duration-300 hover:bg-opacity-10 rounded-lg"
                        :class="{
                            'px-4': sidebarHovered || isSidebarOpen,
                            'justify-center px-2': !sidebarHovered && !isSidebarOpen
                        }">
                        <div class="flex items-center gap-3 py-1 w-full"
                            :class="{ 'justify-center': !sidebarHovered && !isSidebarOpen }">
                            <div
                                class="min-w-[2.5rem] w-10 h-10 flex items-center justify-center rounded-xl shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)] transition-all duration-300 hover:shadow-[inset_0px_5px_15px_-3px_rgba(0,_0,_0,_0.2)]">
                                <img src="{{ asset('/assets/templates/gopie/images/sidebar-dd.svg') }}"
                                    alt="" class="h-5 w-5" />
                            </div>
                            <span class="whitespace-nowrap transition-all duration-300"
                                :class="{
                                    'w-0 opacity-0': !sidebarHovered && !
                                        isSidebarOpen,
                                    'w-auto opacity-100': sidebarHovered || isSidebarOpen
                                }">Profile</span>
                        </div>
                    </button>
                </div>
            </nav>
        </div>

        <!-- Teleported Dropdown Menu -->
        <template x-teleport="body">
            <div x-show="isDropdownOpen" x-transition:enter="transition ease-out duration-200"
                x-transition:enter-start="opacity-0 translate-y-4" x-transition:enter-end="opacity-100 translate-y-0"
                x-transition:leave="transition ease-in duration-150"
                x-transition:leave-start="opacity-100 translate-y-0" x-transition:leave-end="opacity-0 translate-y-4"
                class="fixed rounded-xl bg-[#f3f3f3] shadow-[5px_5px_15px_0px_rgba(0,0,0,0.15),-5px_-5px_15px_0px_rgba(255,255,255,0.9)]"
                :class="{
                    'w-[calc(100%-2rem)] z-[1000]': window.innerWidth < 768,
                    'w-56 z-[100]': window.innerWidth >= 768
                }"
                :style="`top: ${dropdownPosition.top}px; left: ${dropdownPosition.left}px;`"
                @click.away="isDropdownOpen = false">
                <div class="py-2 px-1">
                    <a href="{{ route('user.profile.index') }}"
                        class="block px-4 py-3 text-sm text-gray-700 hover:bg-[#12b7b6] hover:bg-opacity-10 rounded-lg transition-all duration-200 mb-1">
                        <div class="flex items-center gap-3">
                            <div
                                class="w-8 h-8 flex items-center justify-center rounded-lg shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
                                <img src="{{ asset('/assets/templates/gopie/images/my-profile-icon.svg') }}"
                                    alt="" class="w-5 h-5" />
                            </div>
                            <span>My Profile</span>
                        </div>
                    </a>
                    <a href="{{ route('user.profile.edit') }}"
                        class="block px-4 py-3 text-sm text-gray-700 hover:bg-[#12b7b6] hover:bg-opacity-10 rounded-lg transition-all duration-200 mb-1">
                        <div class="flex items-center gap-3">
                            <div
                                class="w-8 h-8 flex items-center justify-center rounded-lg shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
                                <img src="{{ asset('/assets/templates/gopie/images/edit-profile-icon.svg') }}"
                                    alt="" class="w-5 h-5" />
                            </div>
                            <span>Edit Profile</span>
                        </div>
                    </a>
                    <a href="{{ route('user.kyc.index') }}"
                        class="block px-4 py-3 text-sm text-gray-700 hover:bg-[#12b7b6] hover:bg-opacity-10 rounded-lg transition-all duration-200">
                        <div class="flex items-center gap-3">
                            <div
                                class="w-8 h-8 flex items-center justify-center rounded-lg shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
                                <img src="{{ asset('/assets/templates/gopie/images/kyc-icon.svg') }}" alt=""
                                    class="w-5 h-5" />
                            </div>
                            <span>KYC</span>
                        </div>
                    </a>
                    <a role="button"
                        class="side-logout logout block px-4 py-3 text-sm text-white hover:bg-[#12b7b6] hover:text-white hover:bg-opacity-10 rounded-lg transition-all duration-200">
                        <div class="flex items-center gap-3">
                            <div
                                class="w-8 h-8 flex items-center justify-center rounded-lg shadow-[0px_10px_20px_0px_rgba(0,_0,_0,_0.15)]">
                                <img src="{{ asset('/assets/templates/gopie/images/logout-icon.svg') }}"
                                    alt="" class="w-5 h-5 invert" />
                            </div>
                            <span>Logout</span>
                        </div>
                    </a>
                </div>
            </div>
        </template>

        <!-- Main Content Area -->
        <div class="transition-all duration-300 ease-in-out"
            :class="{
                'lg:ml-64': hasActiveItem,
                'lg:ml-20': !hasActiveItem
            }">

            <main id="main">
                @yield('contents')


                {{-- modal for logout --}}
                <div id="logOutModal"
                    class="fixed inset-0 bg-[#f3f3f3] backdrop-custom z-50 flex items-center justify-center hidden">
                    <div class="bg-white p-6 rounded-3xl w-[90%] max-w-md">
                        <div class="flex justify-between items-center mb-6">
                            <h3 class="text-xl font-semibold text-red-500">Logout</h3>

                            <button id="closeLogOutModal" class="text-black hover:text-red-500">
                                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20"
                                    fill="currentColor">
                                    <path fill-rule="evenodd"
                                        d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
                                        clip-rule="evenodd" />
                                </svg>
                            </button>

                        </div>

                        <!-- logout -->
                        <div class="text-center mb-4 -800 pb-2">
                            <span class="text-lg text-black">Do you really want to Logout?</span>

                            <form action="{{ route('user.logout') }}" method="post" class="mt-5 gen-form"
                                data-action="redirect" data-url="{{ url('/') }}">
                                @csrf

                                <div class="w-full py-12">
                                    <div class="flex justify-center text-center">
                                        <button type="submit"
                                            class="logoutBtn rounded-full px-10 py-2 lg:w-52 w-full transition delay-100 duration-200 ease-in-out ">
                                            <span class="px-2">Log Out</span>
                                        </button>
                                    </div>
                                </div>

                            </form>

                        </div>

                    </div>
                </div>
            </main>

            <footer>
                <div class="mt-8 text-center text-sm text-gray-400 mb-4">
                    All Rights Operational
                </div>
            </footer>
        </div>
    </div>


    {{-- qrcode --}}
    <script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>

    {{-- Include SweetAlert2 JavaScript file --}}
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10.16.6/dist/sweetalert2.all.min.js"></script>

    <script src="{{ asset('/assets/templates/cavit/scripts/dash.js') }}"></script>

    @yield('scripts')
    @stack('scripts')

    {{-- toggle for sideDropdownBtn --}}
    <script>
        $(document).ready(function() {
            // Dropdown Toggle
            $(".sideDropdownBtn").click(function(event) {


                event.stopPropagation(); // Prevent click event from bubbling up
                $("#customSideDropdown").toggleClass("hidden custom-sidebar");
            });

            // Close dropdown on click outside
            $(document).click(function(event) {
                if (!$(event.target).closest("#customSideDropdown, .sideDropdownBtn").length) {
                    $("#customSideDropdown").addClass("hidden").removeClass("custom-sidebar");
                }
            });
        });

        // log out
        $(document).on("click", ".logout", function() {
            $("#logOutModal").removeClass("hidden");
        });

        // Close Logout Modal  
        $(document).on("click", "#closeLogOutModal", function() {
            $("#logOutModal").addClass("hidden");
        });
    </script>




    {{-- livechat --}}
    {!! json_decode(site('livechat')) !!}



</body>

</html>
