<!DOCTYPE html>
<html lang="<?php echo e(str_replace('_', '-', app()->getLocale())); ?>" class="scroll-smooth">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>" />

    
    <link rel="manifest" href="/manifest.json" />
    <meta name="theme-color" content="#FF6A00" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="application-name" content="<?php echo e(config('app.name', 'Titipin Ba Be')); ?>" />

    
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="Titipin" />
    <link rel="apple-touch-icon" href="/icons/icon-192.png" />
    <link rel="apple-touch-icon" sizes="192x192" href="/icons/icon-192.png" />
    <link rel="apple-touch-icon" sizes="512x512" href="/icons/icon-512.png" />

    
    <meta name="description" content="Layanan titip beli hyperlocal — pesan dari mitra terpercaya di sekitar Anda." />
    <meta name="robots" content="index, follow" />
    <meta property="og:title" content="<?php echo e(config('app.name', 'Titipin Ba Be')); ?>" />
    <meta property="og:description" content="Layanan titip beli hyperlocal." />
    <meta property="og:type" content="website" />
    <meta property="og:image" content="/icons/icon-512.png" />

    
    <link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png" />
    <link rel="shortcut icon" href="/icons/icon-192.png" />

    <title><?php echo e(config('app.name')); ?> — <?php echo $__env->yieldContent('title', 'Belanja Mudah'); ?></title>
    <?php echo app('Illuminate\Foundation\Vite')(['resources/css/app.css', 'resources/js/app.js']); ?>
    <?php echo \Livewire\Mechanisms\FrontendAssets\FrontendAssets::styles(); ?>

    <style>
        /* ── Design System v2 ─────────────────────────────── */
        :root {
            /* Colors */
            --c-primary:   #FF6A00;
            --c-secondary: #64748B;
            --c-success:   #22C55E;
            --c-danger:    #EF4444;
            --c-warning:   #F59E0B;
            --c-info:      #3B82F6;

            /* Radius */
            --r-card:  12px;
            --r-input: 12px;
            --r-btn:   12px;
            --r-modal: 16px;

            /* Heights */
            --h-header: 60px;
            --h-nav:    68px;
            --h-btn:    48px;
        }
        .scrollbar-hide::-webkit-scrollbar { display: none; }
        .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
        .safe-pb { padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px); }

        /* Line clamp polyfill compat */
        .line-clamp-2 {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
    </style>
</head>
<body class="bg-[#F5F6FA] text-slate-800 antialiased">

    
    <header class="sticky top-0 z-40 bg-white shadow-sm" style="height:var(--h-header)">
        <div class="h-full px-4 flex items-center gap-3 max-w-2xl mx-auto">

            <?php
                // Halaman yang menampilkan header judul (bukan search)
                $isDetailPage = request()->routeIs(
                    'store.cart', 'store.checkout',
                    'store.orders', 'store.orders.show',
                    'store.account', 'store.info.*',
                    'store.partners', 'store.partners.show',
                    'store.products.show'
                );

                $pageTitle = match(true) {
                    request()->routeIs('store.cart')          => 'Keranjang',
                    request()->routeIs('store.checkout')      => 'Checkout',
                    request()->routeIs('store.orders.show')   => 'Detail Pesanan',
                    request()->routeIs('store.orders')        => 'Pesanan Saya',
                    request()->routeIs('store.account')       => 'Akun Saya',
                    request()->routeIs('store.info.about')    => 'Tentang Kami',
                    request()->routeIs('store.info.contact')  => 'Hubungi Kami',
                    request()->routeIs('store.info.faq')      => 'FAQ',
                    request()->routeIs('store.info.privacy')  => 'Kebijakan Privasi',
                    request()->routeIs('store.info.terms')    => 'Syarat & Ketentuan',
                    request()->routeIs('store.partners')      => 'Daftar Mitra',
                    request()->routeIs('store.partners.show') => 'Detail Mitra',
                    request()->routeIs('store.products.show') => 'Detail Produk',
                    default                                   => null,
                };

                $backRoute = match(true) {
                    request()->routeIs('store.checkout')      => route('store.cart'),
                    request()->routeIs('store.orders.show')   => route('store.orders'),
                    request()->routeIs('store.cart')          => route('store.home'),
                    request()->routeIs('store.orders')        => route('store.home'),
                    request()->routeIs('store.info.*')        => route('store.account'),
                    request()->routeIs('store.partners')      => route('store.home'),
                    request()->routeIs('store.partners.show') => route('store.partners'),
                    request()->routeIs('store.products.show') => route('store.products'),
                    default                                   => null,
                };
            ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($isDetailPage): ?>
                
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($backRoute): ?>
                    <a href="<?php echo e($backRoute); ?>"
                       class="shrink-0 w-9 h-9 flex items-center justify-center text-slate-500
                              hover:text-orange-500 transition-colors">
                        <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"/>
                        </svg>
                    </a>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                <span class="flex-1 text-base font-bold text-slate-800 truncate"><?php echo e($pageTitle); ?></span>

                
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(request()->routeIs('store.products.show')): ?>
                    <a href="<?php echo e(route('store.cart')); ?>"
                       class="shrink-0 relative w-9 h-9 flex items-center justify-center text-slate-600
                              hover:text-orange-500 transition-colors">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.8">
                            <path stroke-linecap="round" stroke-linejoin="round"
                                  d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"/>
                        </svg>
                        <?php
$__split = function ($name, $params = []) {
    return [$name, $params];
};
[$__name, $__params] = $__split('store.cart-badge');

$__key = 'header-cart-badge-ps';

$__key ??= \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::generateKey('lw-2972827761-0', $__key);

$__html = app('livewire')->mount($__name, $__params, $__key);

echo $__html;

unset($__html);
unset($__key);
unset($__name);
unset($__params);
unset($__split);
if (isset($__slots)) unset($__slots);
?>
                    </a>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php else: ?>
                
                <a href="<?php echo e(route('store.home')); ?>"
                   class="shrink-0 w-9 h-9 rounded-full bg-orange-500 flex items-center justify-center
                          text-white font-black text-sm shadow-sm shadow-orange-200">
                    T
                </a>

                <form action="<?php echo e(route('store.home')); ?>" method="GET" class="flex-1">
                    <div class="relative">
                        <svg class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400 pointer-events-none"
                             fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                  d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
                        </svg>
                        <input type="text" name="q" value="<?php echo e(request('q')); ?>"
                               placeholder="Cari produk..."
                               class="w-full h-10 pl-9 pr-4 bg-slate-100 rounded-xl text-sm border border-transparent
                                      focus:outline-none focus:bg-white focus:border-orange-400 transition-colors
                                      placeholder:text-slate-400" />
                    </div>
                </form>

                <a href="<?php echo e(route('store.cart')); ?>"
                   class="shrink-0 relative w-9 h-9 flex items-center justify-center text-slate-600
                          hover:text-orange-500 transition-colors">
                    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.8">
                        <path stroke-linecap="round" stroke-linejoin="round"
                              d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"/>
                    </svg>
                    <?php
$__split = function ($name, $params = []) {
    return [$name, $params];
};
[$__name, $__params] = $__split('store.cart-badge');

$__key = 'header-cart-badge';

$__key ??= \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::generateKey('lw-2972827761-1', $__key);

$__html = app('livewire')->mount($__name, $__params, $__key);

echo $__html;

unset($__html);
unset($__key);
unset($__name);
unset($__params);
unset($__split);
if (isset($__slots)) unset($__slots);
?>
                </a>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

        </div>
    </header>

    
    
    <main class="max-w-2xl mx-auto pb-28">
        <?php echo e($slot); ?>

    </main>

    
    <nav class="fixed bottom-0 inset-x-0 z-50 bg-white border-t border-slate-100"
         style="height:68px; padding-bottom:env(safe-area-inset-bottom,0px); box-shadow:0 -1px 8px rgba(0,0,0,.06)">
        <div class="grid grid-cols-5 h-full w-full">
            <?php
            $navItems = [
                ['route'=>'store.home',    'match'=>'store.home',    'label'=>'Beranda',
                 'icon'=>'M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25'],
                ['route'=>'store.products','match'=>'store.products*','label'=>'Produk',
                 'icon'=>'M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0H3'],
                ['route'=>'store.cart',   'match'=>'store.cart',    'label'=>'Keranjang',
                 'icon'=>'M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 00-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 00-16.536-1.84M7.5 14.25L5.106 5.272M6 20.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm12.75 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z'],
                ['route'=>'store.orders', 'match'=>'store.orders*', 'label'=>'Pesanan',
                 'icon'=>'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2'],
                ['route'=>'store.account','match'=>'store.account*','label'=>'Akun',
                 'icon'=>'M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z'],
            ];
            ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $navItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php $active = request()->routeIs($item['match']); ?>
                <a href="<?php echo e(route($item['route'])); ?>"
                   class="flex flex-col items-center justify-center gap-1 transition-colors duration-150
                          <?php echo e($active ? 'text-orange-500' : 'text-slate-400'); ?>">
                    <div class="relative">
                        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                             stroke-width="<?php echo e($active ? '2.2' : '1.7'); ?>">
                            <path stroke-linecap="round" stroke-linejoin="round" d="<?php echo e($item['icon']); ?>"/>
                        </svg>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($item['label'] === 'Keranjang'): ?>
                            <?php
$__split = function ($name, $params = []) {
    return [$name, $params];
};
[$__name, $__params] = $__split('store.cart-badge');

$__key = 'nav-cart-badge';

$__key ??= \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::generateKey('lw-2972827761-2', $__key);

$__html = app('livewire')->mount($__name, $__params, $__key);

echo $__html;

unset($__html);
unset($__key);
unset($__name);
unset($__params);
unset($__split);
if (isset($__slots)) unset($__slots);
?>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>
                    <span class="text-[10px] leading-none font-<?php echo e($active ? 'semibold' : 'normal'); ?>">
                        <?php echo e($item['label']); ?>

                    </span>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($active): ?>
                        <span class="w-1 h-1 rounded-full bg-orange-500 mt-0.5"></span>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        </div>
    </nav>

    <script>
        window._cartAddUrl = '<?php echo e(url('/store/keranjang/tambah')); ?>';

        function addToCart(btn, productId, onSuccess) {
            if (btn.disabled) return;
            const csrf = document.querySelector('meta[name="csrf-token"]');
            if (!csrf) return;

            btn.disabled = true;

            fetch(window._cartAddUrl, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'X-CSRF-TOKEN': csrf.content,
                    'Accept': 'application/json'
                },
                body: JSON.stringify({ product_id: productId, qty: 1 })
            })
            .then(r => r.json())
            .then(data => {
                btn.disabled = false;
                if (data.ok) {
                    // Refresh kedua CartBadge (header + nav) via Livewire event
                    if (window.Livewire) {
                        window.Livewire.dispatch('cart-updated');
                    }
                    if (onSuccess) onSuccess(data);
                } else {
                    alert(data.message || 'Gagal menambahkan produk.');
                }
            })
            .catch(() => { btn.disabled = false; });
        }
        // ── GuestProfile localStorage bridge ──────────────────────────────
        // Menghubungkan Livewire event dengan GuestProfileManager (localStorage).
        // Dipanggil saat halaman Checkout atau Akun dibuka.
        document.addEventListener('livewire:initialized', () => {

            // Saat komponen Livewire siap: kirim data localStorage ke server
            const profile = window.GuestProfile ? window.GuestProfile.load() : {};
            if (Object.keys(profile).length > 0) {
                Livewire.dispatch('guest-profile:loaded', { data: profile });
            }

            // Simpan ke localStorage saat Livewire dispatch event ini
            Livewire.on('guest-profile:save', ({ data }) => {
                if (window.GuestProfile) window.GuestProfile.save(data);
            });

            // Hapus localStorage saat Livewire dispatch event ini
            Livewire.on('guest-profile:clear', () => {
                if (window.GuestProfile) window.GuestProfile.clear();
            });
        });
    </script>
    
    
    <div id="pwa-install-banner"
         style="display:none; transform:translateY(100%); opacity:0;
                transition: transform 0.3s ease, opacity 0.3s ease;"
         class="fixed bottom-[68px] left-0 right-0 z-40 mx-4 mb-2">
        <div class="bg-white rounded-2xl shadow-xl border border-slate-100 p-4 flex items-center gap-3">
            <div class="w-12 h-12 rounded-xl bg-orange-500 flex items-center justify-center shrink-0 shadow-sm">
                <span class="text-white font-black text-xl leading-none">T</span>
            </div>
            <div class="flex-1 min-w-0">
                <p class="text-sm font-semibold text-slate-800">Pasang Titipin Ba Be</p>
                <p class="text-xs text-slate-400 mt-0.5">Akses lebih cepat dari layar utama</p>
            </div>
            <div class="flex gap-2 shrink-0">
                <button type="button" onclick="pwaDismiss()"
                    class="text-xs text-slate-400 hover:text-slate-600 px-2 py-1">
                    Nanti
                </button>
                <button type="button" onclick="pwaInstall()"
                    class="text-xs font-semibold text-white bg-orange-500 hover:bg-orange-600
                           px-3 py-1.5 rounded-lg active:scale-95 transition-all">
                    Pasang
                </button>
            </div>
        </div>
    </div>

    
    
    <div id="pwa-update-toast"
         style="display:none; transform:translateY(-100%); opacity:0;
                transition: transform 0.3s ease, opacity 0.3s ease;"
         class="fixed top-[68px] left-0 right-0 z-40 mx-4 mt-2">
        <div class="bg-slate-800 rounded-xl shadow-lg p-3 flex items-center gap-3">
            <svg class="w-4 h-4 text-orange-400 shrink-0" fill="none" stroke="currentColor"
                 viewBox="0 0 24 24" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round"
                      d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"/>
            </svg>
            <p class="flex-1 text-xs text-slate-200">Versi baru tersedia</p>
            <button type="button" onclick="pwaUpdate()"
                class="text-xs font-semibold text-orange-400 hover:text-orange-300 px-2">
                Perbarui
            </button>
        </div>
    </div>

    <?php echo \Livewire\Mechanisms\FrontendAssets\FrontendAssets::scripts(); ?>

</body>
</html>
<?php /**PATH C:\laragon\www\titipin-babe\resources\views/layouts/store.blade.php ENDPATH**/ ?>