<!DOCTYPE html>
<html lang="FA-IR" dir="rtl">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <?php
        $docSiteName = $siteName ?? \App\Models\Setting::get('site_name', config('app.name', 'فروشگاه'));
        $pagePart = request()->routeIs('home')
            ? trim((string) ($siteHomeTitleDesc ?? \App\Models\Setting::get('site_home_title_desc', '')))
            : trim($__env->yieldContent('title'));
        $documentTitle = $pagePart !== '' ? $docSiteName . ' - ' . $pagePart : $docSiteName;
        $faviconHref = $siteFavicon ?? null;
        if (!$faviconHref) {
            $faviconFile = \App\Models\Setting::get('site_favicon', '');
            $faviconHref = $faviconFile ? asset('uploads/site/' . $faviconFile) : null;
        }
    ?>
    <title><?php echo e($documentTitle); ?></title>
    <?php if($faviconHref): ?>
    <link rel="icon" href="<?php echo e($faviconHref); ?>">
    <?php endif; ?>
    <?php echo $__env->make('site.partials.seo-head', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/css/bootstrap.rtl.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/font/bootstrap-icon/bootstrap-icons.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/font/tabler-icons/tabler-icons.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/plugin/waves/waves.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/plugin/swiper/swiper-bundle.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/plugin/timer/timer.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/plugin/bootstrap-touchspin/jquery.bootstrap-touchspin.min.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/css/style.css')); ?>?v=<?php echo e(@filemtime(public_path('theme/assets/css/style.css')) ?: '1'); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/css/responsive.css')); ?>?v=<?php echo e(@filemtime(public_path('theme/assets/css/responsive.css')) ?: '1'); ?>">
    <?php echo $__env->yieldContent('styles'); ?>
</head>

<body>
    <?php if(!empty($seoGlobal['gtm_id'])): ?>
    <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?php echo e($seoGlobal['gtm_id']); ?>"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <?php endif; ?>

    <header>
        <div class="container-fluid">
            <div class="row align-items-center">

                <!-- logo -->
                <div class="col-lg-2 col-6 order-lg-1 order-1">
                    <div class="d-flex align-items-center">
                        <div class="responsive-menu d-lg-none d-block">
                            <button class="btn border-0 p-0 btn-responsive-menu" type="button"
                                data-bs-toggle="offcanvas" data-bs-target="#responsiveMenu"
                                aria-controls="responsive menu">
                                <i class="bi bi-list font-30"></i>
                            </button>
                            <div class="offcanvas offcanvas-start" tabindex="-1" id="responsiveMenu"
                                aria-labelledby="responsive menu">
                                <div class="offcanvas-header">
                                    <button type="button" class="btn-close" data-bs-dismiss="offcanvas"
                                        aria-label="Close"></button>
                                </div>
                                <div class="offcanvas-body">
                                    <a href="<?php echo e(route('home')); ?>" class="text-center d-block mb-3">
                                        <img src="<?php echo e($siteLogo); ?>" alt="" class="img-fluid" width="200">
                                    </a>
                                    <div class="header-bottom-form mb-4 w-100">
                                        <div class="search-form live-search-wrap" id="liveSearchMobile">
                                            <div class="search-filed">
                                                <input type="text" placeholder="جستجوی محصولات ..."
                                                    class="form-control search-input live-search-input"
                                                    autocomplete="off">
                                                <button type="button" class="btn search-btn main-color-one-bg rounded-pill">
                                                    <i class="bi bi-search"></i>
                                                </button>
                                            </div>
                                            <div class="live-search-dropdown d-none"></div>
                                        </div>
                                    </div>

                                    <?php if($headerPhoneText): ?>
                                    <div class="header-cart ms-3 text-center mb-4">
                                        <a class="btn header-cart-toggle rounded-pill btn-white border-0 shadow-sm main-color-one-bg d-inline-flex align-items-center"
                                           <?php if($headerPhoneLink): ?> href="<?php echo e($headerPhoneLink); ?>" <?php endif; ?>>
                                            <span class="text-white header-phone-text"><?php echo e(\App\Support\PersianDigits::toPersian($headerPhoneText)); ?></span>
                                            <i class="ti ti-phone-call text-white fs-4 ms-2"></i>
                                        </a>
                                    </div>
                                    <?php endif; ?>

                                    <ul class="rm-item-menu navbar-nav">
                                        <li class="nav-item bg-ul-f7">
                                            <a href="<?php echo e(route('home')); ?>" class="nav-link">صفحه اصلی</a>
                                        </li>

                                        <?php $__empty_1 = true; $__currentLoopData = $megaMenuCategories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parentCat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                            <li class="nav-item bg-ul-f7 rm-cat-item rm-cat-depth-0">
                                                <a href="<?php echo e(route('shop.category', $parentCat->slug)); ?>" class="nav-link">
                                                    <?php if($parentCat->icon): ?>
                                                        <i class="bi bi-<?php echo e($parentCat->icon); ?>"></i>
                                                    <?php endif; ?>
                                                    <?php echo e($parentCat->name); ?>

                                                </a>
                                                <?php if($parentCat->allChildren->isNotEmpty()): ?>
                                                    <span class="showSubMenu"><i class="bi bi-chevron-left"></i></span>
                                                    <ul class="navbar-nav h-0 rm-submenu">
                                                        <?php echo $__env->make('site.partials._mobile-menu-cat', [
                                                            'items' => $parentCat->allChildren,
                                                            'depth' => 1,
                                                        ], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                                    </ul>
                                                <?php endif; ?>
                                            </li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                            <li class="nav-item bg-ul-f7">
                                                <a href="<?php echo e(route('categories.index')); ?>" class="nav-link">دسته‌بندی محصولات</a>
                                            </li>
                                        <?php endif; ?>

                                        <?php $__currentLoopData = $headerNavLinks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $navItem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $navTitle = trim($navItem['title'] ?? '');
                                                $navUrl   = trim($navItem['url'] ?? '');
                                                $isHomeNav = in_array($navTitle, ['خانه', 'صفحه اصلی'], true)
                                                    || in_array(rtrim($navUrl, '/'), ['', '/', rtrim(url('/'), '/'), rtrim(route('home'), '/')], true);
                                            ?>
                                            <?php if($isHomeNav) continue; ?>
                                            <li class="nav-item bg-ul-f7">
                                                <a href="<?php echo e($navUrl !== '' ? $navUrl : '#'); ?>" class="nav-link">
                                                    <?php if(!empty($navItem['icon'])): ?>
                                                        <i class="ti ti-<?php echo e($navItem['icon']); ?>"></i>
                                                    <?php endif; ?>
                                                    <?php echo e($navTitle); ?>

                                                </a>
                                            </li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <a href="<?php echo e(route('home')); ?>">
                            <div class="logo">
                                <img src="<?php echo e($siteLogo); ?>" alt="" class="img-fluid">
                            </div>
                        </a>
                    </div>
                </div>
                <!-- end logo -->

                <!-- action -->
                <div class="d-lg-none d-block col-6 order-lg-5 order-2">
                    <div class="d-flex align-items-center justify-content-end">
                        <?php $cartCount = collect(session('cart', []))->sum('qty'); ?>
                        <a class="btn btn-light no-highlight btn-lg btn-action-cart shadow-sm"
                            href="<?php echo e(route('cart.index')); ?>">
                            <i class="bi bi-basket font-30"></i>
                            <span class="header-cart-counter main-color-one-bg d-inline-block rounded-pill <?php echo e($cartCount > 0 ? '' : 'd-none'); ?>"><?php echo e($cartCount ?: ''); ?></span>
                        </a>
                        <?php echo $__env->make('site.partials._header-account', ['mode' => 'mobile-header'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                    </div>
                </div>
                <!-- end action -->

                <!-- form search -->
                <div class="col-lg-6 order-lg-2 d-lg-block d-none">
                    <div class="search-form live-search-wrap" id="liveSearchDesktop">
                        <div class="search-filed">
                            <input type="text" placeholder="جستجوی محصولات ..."
                                class="form-control search-input live-search-input"
                                autocomplete="off">
                            <button type="button" class="btn search-btn main-color-one-bg rounded-pill">
                                <i class="bi bi-search"></i>
                            </button>
                        </div>
                        <div class="live-search-dropdown d-none"></div>
                    </div>
                </div>
                <!-- end form search -->

                <!-- auth -->
                <div class="col-lg-4 order-lg-3 d-lg-block d-none">
                    <div class="d-flex align-items-center justify-content-end">
                        <div class="btn-group header-btn-group shadow-sm rounded-pill">
                            <?php echo $__env->make('site.partials._header-account', ['mode' => 'desktop'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                        </div>
                        <div class="header-cart ms-1">
                            <?php $cartCount = collect(session('cart', []))->sum('qty'); ?>
                            <a class="btn header-cart-toggle rounded-pill btn-white border-0 shadow-sm d-inline-flex align-items-center"
                               href="<?php echo e(route('cart.index')); ?>">
                                <i class="ti ti-shopping-cart font-25 text-muted me-1"></i>
                                <span class="header-cart-counter main-color-one-bg d-inline-flex align-items-center justify-content-center rounded-pill <?php echo e($cartCount > 0 ? '' : 'd-none'); ?>"><?php echo e($cartCount ?: ''); ?></span>
                            </a>
                        </div>
                        <?php if($headerPhoneText): ?>
                        <div class="header-cart ms-3">
                            <a class="btn header-cart-toggle rounded-pill btn-white border-0 shadow-sm main-color-one-bg d-inline-flex align-items-center"
                               <?php if($headerPhoneLink): ?> href="<?php echo e($headerPhoneLink); ?>" <?php endif; ?>>
                                <span class="text-white header-phone-text"><?php echo e(\App\Support\PersianDigits::toPersian($headerPhoneText)); ?></span>
                                <i class="ti ti-phone-call text-white fs-4 ms-2"></i>
                            </a>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
                <!-- end auth -->

            </div>
        </div>
    </header>

    <!-- start mega menu -->

    <div class="mega-menu d-lg-block d-none">
        <div class="container-fluid">
            <div class="top-menu-parent">
                <div class="row align-items-center">
                    <div class="col-lg-9">
                        <div class="top-menu-menu">
                            <ul class="navbar-nav align-items-center mb-1">
                                <li class="position-relative m-0"></li>
                                <li class="nav-item main-menu-head"><a href=""
                                        class="nav-link border-animate main-color-one-bg fromCenter btn nav-active fw-bold"><i
                                            class="bi bi-list"></i>
                                        دسته بندی محصولات
                                    </a>
                                    <ul class="main-menu mega-container">
                                        <?php $__currentLoopData = $megaMenuCategories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parentCat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <li class="<?php echo e($loop->first ? 'main-menu-sub-active-li' : ''); ?>">
                                            <a href="<?php echo e(route('shop.category', $parentCat->slug)); ?>">
                                                <?php if($parentCat->icon): ?><i class="bi bi-<?php echo e($parentCat->icon); ?>"></i> <?php endif; ?>
                                                <?php echo e($parentCat->name); ?>

                                            </a>
                                            <ul class="main-menu-sub back-menu"
                                                <?php if($parentCat->mega_menu_image): ?>
                                                    style="background: #fff url('<?php echo e(url('uploads/categories/' . $parentCat->mega_menu_image)); ?>') no-repeat;"
                                                <?php else: ?>
                                                    style="background: #fff;"
                                                <?php endif; ?>
                                            >
                                                <?php echo $__env->make('site.partials._mega-sub', ['items' => $parentCat->allChildren], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                            </ul>
                                        </li>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        <?php if($megaMenuCategories->isEmpty()): ?>
                                        <li><a href="#" class="text-muted">دسته‌بندی‌ای تعریف نشده</a></li>
                                        <?php endif; ?>
                                    </ul>
                                </li>
                                <?php $__currentLoopData = $headerNavLinks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $navItem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="nav-item">
                                    <a href="<?php echo e($navItem['url'] ?: '#'); ?>" class="nav-link border-animate fromCenter">
                                        <?php if(!empty($navItem['icon'])): ?>
                                        <i class="ti ti-<?php echo e($navItem['icon']); ?>"></i>
                                        <?php endif; ?>
                                        <?php echo e($navItem['title']); ?>

                                    </a>
                                </li>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- end mega menu -->

    <?php echo $__env->yieldContent('content'); ?>

    <!-- start footer -->
    <footer class="sf">
        
        <div class="sf-body">
            <div class="container-fluid">
                <div class="row gy-5">

                    
                    <div class="col-lg-4">
                        <a href="<?php echo e(route('home')); ?>" class="sf-logo-link">
                            <img src="<?php echo e($siteLogo); ?>" alt="logo" class="sf-logo">
                        </a>
                        <?php if($footerAbout): ?>
                        <p class="sf-about mt-3"><?php echo e($footerAbout); ?></p>
                        <?php endif; ?>
                        <?php
                            $socialItems = [
                                'instagram' => ['اینستاگرام', 'bi bi-instagram'],
                                'telegram'  => ['تلگرام',      'bi bi-telegram'],
                                'whatsapp'  => ['واتساپ',      'bi bi-whatsapp'],
                                'youtube'   => ['یوتیوب',      'bi bi-youtube'],
                                'twitter'   => ['ایکس',        'bi bi-twitter-x'],
                            ];
                        ?>
                        <?php if(array_filter($footerSocials)): ?>
                        <div class="sf-socials mt-4">
                            <?php $__currentLoopData = $socialItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => [$label, $icon]): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if(!empty($footerSocials[$key])): ?>
                                <a href="<?php echo e($footerSocials[$key]); ?>" class="sf-social-btn" aria-label="<?php echo e($label); ?>" target="_blank" rel="noopener">
                                    <i class="<?php echo e($icon); ?>"></i>
                                </a>
                                <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                        <?php endif; ?>
                        <?php if($footerEnamadCode || $footerSamanCode): ?>
                        <div class="sf-namads mt-4">
                            <?php echo $footerEnamadCode; ?>

                            <?php echo $footerSamanCode; ?>

                        </div>
                        <?php endif; ?>
                    </div>

                    
                    <?php if(!empty($footerQuickLinks)): ?>
                    <div class="col-lg-2 col-6">
                        <h6 class="sf-col-title">دسترسی سریع</h6>
                        <ul class="sf-links">
                            <?php $__currentLoopData = $footerQuickLinks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li><a href="<?php echo e($item['url'] ?: '#'); ?>"><?php echo e($item['title']); ?></a></li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                    <?php endif; ?>

                    
                    <?php if(!empty($footerServices)): ?>
                    <div class="col-lg-2 col-6">
                        <h6 class="sf-col-title">خدمات مشتریان</h6>
                        <ul class="sf-links">
                            <?php $__currentLoopData = $footerServices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li><a href="<?php echo e($item['url'] ?: '#'); ?>"><?php echo e($item['title']); ?></a></li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                    <?php endif; ?>

                    
                    <?php if($footerContact['phones'] || $footerContact['email'] || $footerContact['address'] || $footerContact['hours']): ?>
                    <div class="col-lg-4">
                        <h6 class="sf-col-title">اطلاعات تماس</h6>
                        <ul class="sf-contact-list">
                            <?php if($footerContact['phones']): ?>
                            <?php
                                $phoneList = array_values(array_filter(array_map('trim',
                                    preg_split('/[\r\n,،]+/', $footerContact['phones'])
                                )));
                            ?>
                            <?php if(!empty($phoneList)): ?>
                            <li>
                                <i class="bi bi-telephone-fill"></i>
                                <div>
                                    <span class="sf-contact-label">تلفن پشتیبانی</span>
                                    <span class="sf-contact-phones">
                                        <?php $__currentLoopData = $phoneList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $phone): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <a href="tel:<?php echo e(preg_replace('/\s+/', '', \App\Support\PersianDigits::toEnglish($phone) ?? $phone)); ?>"><?php echo e(\App\Support\PersianDigits::toPersian($phone)); ?></a><?php if(!$loop->last): ?> <span class="sf-phone-sep">|</span> <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </span>
                                </div>
                            </li>
                            <?php endif; ?>
                            <?php endif; ?>
                            <?php if($footerContact['email']): ?>
                            <li>
                                <i class="bi bi-envelope-fill"></i>
                                <div>
                                    <span class="sf-contact-label">ایمیل</span>
                                    <a href="mailto:<?php echo e($footerContact['email']); ?>"><?php echo e($footerContact['email']); ?></a>
                                </div>
                            </li>
                            <?php endif; ?>
                            <?php if($footerContact['address']): ?>
                            <li>
                                <i class="bi bi-geo-alt-fill"></i>
                                <div>
                                    <span class="sf-contact-label">آدرس</span>
                                    <span><?php echo e($footerContact['address']); ?></span>
                                </div>
                            </li>
                            <?php endif; ?>
                            <?php if($footerContact['hours']): ?>
                            <li>
                                <i class="bi bi-clock-fill"></i>
                                <div>
                                    <span class="sf-contact-label">ساعات کاری</span>
                                    <span><?php echo e($footerContact['hours']); ?></span>
                                </div>
                            </li>
                            <?php endif; ?>
                        </ul>
                    </div>
                    <?php endif; ?>

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

        
        <div class="sf-copy">
            <div class="container-fluid">
                <div class="d-flex flex-wrap align-items-center justify-content-between gap-2">
                    <p class="mb-0 text-white-50 fw-bolder">
                        <?php echo e($footerCopyright ?: 'تمامی حقوق این وب‌سایت متعلق به فروشگاه می‌باشد.'); ?>

                    </p>
                    <div class="d-flex gap-3">
                        <a href="<?php echo e(route('terms')); ?>">قوانین و مقررات</a>
                        <a href="<?php echo e(route('contact')); ?>">تماس با ما</a>
                    </div>
                </div>
            </div>
        </div>

    </footer>

    <!-- end footer -->

    <!-- mobile menu -->

    <div class="mobile-footer d-lg-none d-flex">
        <div class="parent">
            
            <div class="item mf-item-chat">
                <?php if(!empty($biataBotEnabled)): ?>
                    <button type="button" class="mf-icon-btn mf-biata-btn" id="mfBiataToggle" aria-label="چت با بیاتو بات">
                        <i class="bi bi-chat-dots-fill"></i>
                        <span class="mf-biata-dot" aria-hidden="true"></span>
                    </button>
                <?php else: ?>
                    <button type="button" class="mf-icon-btn" onclick="topFunction()" aria-label="بازگشت به بالا">
                        <i class="bi bi-chevron-up font-20"></i>
                    </button>
                <?php endif; ?>
            </div>

            
            <div class="item mf-item-home">
                <a href="<?php echo e(route('home')); ?>" class="mf-icon-btn" aria-label="صفحه اصلی">
                    <i class="bi bi-house font-20"></i>
                </a>
            </div>

            
            <div class="item item-float">
                <a href="<?php echo e(route('cart.index')); ?>" aria-label="سبد خرید">
                    <i class="bi bi-bag font-20"></i>
                </a>
            </div>

            
            <div class="item mf-item-menu">
                <button type="button" class="mf-icon-btn" id="mfMenuToggle" aria-label="منو">
                    <i class="bi bi-list font-20"></i>
                </button>
            </div>

            
            <div class="item mf-item-user">
                <button type="button" class="mf-icon-btn" id="mfAccountToggle" aria-label="حساب کاربری">
                    <i class="bi bi-person font-20"></i>
                </button>
            </div>
        </div>
    </div>

    <!-- end mobile menu -->

    <div class="float-btn">
        <div class="container-fluid">
            <!-- go top top -->
            <div class="progress-wrap d-lg-block d-none">
                <svg class="progress-circle svg-content" width="100%" height="100%" viewBox="-1 -1 102 102">
                    <path d="M50,1 a49,49 0 0,1 0,98 a49,49 0 0,1 0,-98" />
                </svg>
            </div>
            <!-- end go top top -->
        </div>
    </div>

    <script src="<?php echo e(asset('theme/assets/js/jquery.min.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/js/bootstrap.bundle.min.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/plugin/waves/waves.min.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/plugin/swiper/swiper-bundle.min.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/plugin/timer/timer.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/plugin/bootstrap-touchspin/jquery.bootstrap-touchspin.min.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/js/app.js')); ?>?v=<?php echo e(@filemtime(public_path('theme/assets/js/app.js')) ?: '1'); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/js/jquery-app.js')); ?>"></script>
    <script src="<?php echo e(asset('theme/assets/js/persian-numbers.js')); ?>"></script>

    <!-- ===== start new update -->
    <script src="<?php echo e(asset('theme/assets/plugin/go-to-top/script.js')); ?>"></script>

    <link rel="stylesheet" href="<?php echo e(asset('theme/assets/plugin/go-to-top/style.css')); ?>">

    <?php if(auth()->guard()->check()): ?>
    <form id="header-logout-form" action="<?php echo e(route('logout')); ?>" method="POST" class="d-none"><?php echo csrf_field(); ?></form>
    <?php endif; ?>

    <?php if($biataBotEnabled): ?>
        <?php echo $__env->make('site.partials.biata-bot', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php endif; ?>

    <?php echo $__env->yieldContent('scripts'); ?>

<script>
(function ($) {
    var searchUrl = '<?php echo e(route('search.ajax')); ?>';

    function initLiveSearch(wrap) {
        var $wrap     = $(wrap);
        var $input    = $wrap.find('.live-search-input');
        var $dropdown = $wrap.find('.live-search-dropdown');
        if (!$input.length || !$dropdown.length) return;

        var timer = null;
        var xhr   = null;

        function hide() {
            $dropdown.addClass('d-none').empty();
        }

        function showLoading() {
            $dropdown.removeClass('d-none').html(
                '<div class="ls-loading"><span class="spinner-border spinner-border-sm text-secondary"></span></div>'
            );
        }

        function render(items) {
            if (!items || !items.length) {
                $dropdown.removeClass('d-none').html('<div class="ls-no-result">نتیجه‌ای یافت نشد</div>');
                return;
            }
            var html = '';
            $.each(items, function (i, item) {
                var oos = item.in_stock === false;
                var imgClass = 'ls-item-img' + (oos ? ' ls-item-img-oos' : '');
                var img = item.image
                    ? '<img class="' + imgClass + '" src="' + item.image + '" alt="">'
                    : '<div class="ls-item-img-placeholder' + (oos ? ' ls-item-img-oos' : '') + '"><i class="bi bi-image"></i></div>';
                var price = '';
                if (oos) {
                    price = '<div class="ls-item-price"><div class="final text-muted">ناموجود</div></div>';
                } else if (item.final_price) {
                    price = item.has_discount
                        ? '<div class="ls-item-price"><div class="old">' + item.price + ' تومان</div><div class="final">' + item.final_price + ' تومان</div></div>'
                        : '<div class="ls-item-price"><div class="final">' + item.final_price + ' تومان</div></div>';
                }
                html += '<a href="' + item.url + '" class="ls-item' + (oos ? ' ls-item-oos' : '') + '">' + img
                      + '<span class="ls-item-title">' + item.title + '</span>' + price + '</a>';
            });
            $dropdown.removeClass('d-none').html(html);
        }

        $input.on('input', function () {
            clearTimeout(timer);
            if (xhr) { xhr.abort(); xhr = null; }
            var q = $.trim($(this).val());
            if (q.length < 2) { hide(); return; }
            showLoading();
            timer = setTimeout(function () {
                xhr = $.getJSON(searchUrl, { q: q })
                    .done(render)
                    .fail(function (jqXHR, status) {
                        if (status !== 'abort') {
                            $dropdown.removeClass('d-none').html('<div class="ls-no-result">خطا در جستجو</div>');
                        }
                    });
            }, 280);
        });

        $input.on('keydown', function (e) {
            if (e.key === 'Escape') hide();
        });

        $(document).on('click.ls_' + $wrap.attr('id'), function (e) {
            if (!$(e.target).closest($wrap).length) hide();
        });
    }

    $('.live-search-wrap').each(function () { initLiveSearch(this); });
}(jQuery));
</script>


<script>
(function ($) {
    var toggleUrl = "<?php echo e(route('wishes.toggle')); ?>";
    var loginUrl  = "<?php echo e(route('login')); ?>";
    var isAuth    = <?php echo e(auth()->check() ? 'true' : 'false'); ?>;
    var csrf      = $('meta[name="csrf-token"]').attr('content');

    $(document).on('click', '.wish-toggle', function (e) {
        e.preventDefault();
        var $btn = $(this);

        if (!isAuth) {
            window.location.href = loginUrl;
            return;
        }

        var productId = $btn.data('product');
        if (!productId || $btn.data('loading')) return;
        $btn.data('loading', true);

        $.ajax({
            url: toggleUrl,
            method: 'POST',
            data: { product_id: productId },
            headers: { 'X-CSRF-TOKEN': csrf },
            dataType: 'json'
        }).done(function (res) {
            var $icon = $btn.find('i');
            if (res.status === 'added') {
                $icon.removeClass('bi-heart').addClass('bi-heart-fill');
            } else {
                $icon.removeClass('bi-heart-fill').addClass('bi-heart');
            }
        }).fail(function (xhr) {
            if (xhr.status === 401 || xhr.status === 419) {
                window.location.href = loginUrl;
            }
        }).always(function () {
            $btn.data('loading', false);
        });
    });
}(jQuery));
</script>

<script>
(function () {
    // Mobile footer wiring (chat / menu / account)
    var mfBiata = document.getElementById('mfBiataToggle');
    if (mfBiata) {
        mfBiata.addEventListener('click', function () {
            var btn = document.getElementById('biataBotToggle');
            if (btn) btn.click();
        });
    }

    var mfMenu = document.getElementById('mfMenuToggle');
    if (mfMenu) {
        mfMenu.addEventListener('click', function () {
            var targets = ['panelSideCanvas', 'offcanvasShopFilter', 'offcanvasAmazingFilter', 'responsiveMenu'];
            for (var i = 0; i < targets.length; i++) {
                var el = document.getElementById(targets[i]);
                if (!el || typeof bootstrap === 'undefined') continue;
                bootstrap.Offcanvas.getOrCreateInstance(el).show();
                return;
            }
        });
    }

    var mfAccount = document.getElementById('mfAccountToggle');
    if (mfAccount) {
        mfAccount.addEventListener('click', function (e) {
            e.preventDefault();
            e.stopPropagation();
            e.stopImmediatePropagation();

            var headerToggle = document.getElementById('headerAccountToggleMobile');
            if (!headerToggle || typeof bootstrap === 'undefined') return;

            var existing = bootstrap.Dropdown.getInstance(headerToggle);
            if (existing) {
                existing.show();
                return;
            }

            var dropdown = bootstrap.Dropdown.getOrCreateInstance(headerToggle);
            // Avoid this same tap being treated as an outside click that closes it
            setTimeout(function () {
                dropdown.show();
            }, 10);
        }, true);
    }
})();
</script>

<?php if(!empty($seoGlobal['body_scripts'])): ?>
<?php echo $seoGlobal['body_scripts']; ?>

<?php endif; ?>

</body>

</html>
<?php /**PATH C:\xampp\htdocs2\engine\resources\views/site/layouts/site-layout.blade.php ENDPATH**/ ?>