<!DOCTYPE html>
<html lang="id">

<head>
    <link rel="icon" type="image/svg+xml" href="<?php echo e(asset('favicon.svg')); ?>">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">

    
    


    <meta http-equiv="Content-Security-Policy"
        content="
        script-src 'self' 'unsafe-inline' 'unsafe-eval' http://127.0.0.1:5173 http://127.0.0.1:5174 https://app.sandbox.midtrans.com https://api.sandbox.midtrans.com https://snap-assets.al-pc-id-b.cdn.gtflabs.io https://cdnjs.cloudflare.com; 
        style-src 'self' 'unsafe-inline' http://127.0.0.1:5173 http://127.0.0.1:5174 https://cdnjs.cloudflare.com https://fonts.googleapis.com;
        font-src 'self' https://cdnjs.cloudflare.com https://fonts.gstatic.com;
        connect-src 'self' http://127.0.0.1:5173 ws://127.0.0.1:5173 http://127.0.0.1:5174 ws://127.0.0.1:5174 https://app.sandbox.midtrans.com https://api.sandbox.midtrans.com;">

    <title><?php echo e($title ?? 'Libris | Toko Buku Online'); ?></title>

    
    <style>
        [x-cloak] {
            display: none !important;
        }
    </style>

    <?php echo app('Illuminate\Foundation\Vite')(['resources/css/app.css', 'resources/js/app.js']); ?>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <!-- NProgress loading bar -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" />
</head>

<body class="bg-gray-50 font-sans text-gray-900">

    <?php echo $__env->make('layouts.navigation', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

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

    <footer class="bg-gray-900 text-white pt-16 pb-8 mt-20">
        <div class="max-w-7xl mx-auto px-8 grid grid-cols-1 md:grid-cols-3 gap-12 mb-10">
            <div class="space-y-4">
                <h2 class="text-2xl font-bold italic">Libris.</h2>
                <p class="text-gray-400">Jendela dunia dalam genggaman Anda. Kami menyediakan koleksi literatur terbaik
                    untuk setiap pembaca.</p>
            </div>
            <div>
                <h4 class="font-bold mb-6">Tautan</h4>
                <ul class="space-y-4 text-gray-400">
                    <li><a href="#" class="hover:text-white">Kategori Buku</a></li>
                    <li><a href="#" class="hover:text-white">Syarat & Ketentuan</a></li>
                </ul>
            </div>
            <div>
                <h4 class="font-bold mb-6">Kontak</h4>
                <p class="text-gray-400">support@libris.com</p>
                <div class="flex space-x-4 mt-4 text-xl">
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fa-brands fa-instagram"></i></a>
                    <a href="#" class="text-gray-400 hover:text-white"><i class="fa-brands fa-twitter"></i></a>
                </div>
            </div>
        </div>
        <p class="text-center text-gray-500 text-sm border-t border-gray-800 pt-8">© 2026 Libris E-commerce.</p>
    </footer>

    <script>
        function toggleFavorite(button, bookId) {
            const csrfTokenElement = document.querySelector('meta[name="csrf-token"]');

            if (!csrfTokenElement) {
                console.error('CSRF token not found. Make sure <meta name="csrf-token"> is in the head.');
                return;
            }

            fetch('/wishlist/toggle', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Accept': 'application/json', // Tambahkan ini agar Laravel kirim JSON meskipun error
                    'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
                },
                body: JSON.stringify({ item_id: bookId })
            })
                .then(response => {
                    if (response.status === 401) {
                        window.location.href = '/login'; // Arahkan ke login jika belum auth
                        return;
                    }
                    return response.json();
                })
                .then(data => {
                    const icon = button.querySelector('i');
                    if (data.status === 'added') {
                        icon.classList.replace('fa-regular', 'fa-solid');
                        button.classList.add('text-red-500');
                        button.classList.remove('text-gray-500');
                    } else if (data.status === 'removed') {
                        icon.classList.replace('fa-solid', 'fa-regular');
                        button.classList.remove('text-red-500');
                        button.classList.add('text-gray-500');
                    }
                });
        }
    </script>

    <!-- NProgress and basic page load handlers -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            NProgress.configure({ showSpinner: false, trickleSpeed: 200 });

            // start loading when navigating away
            document.querySelectorAll('a').forEach(link => {
                link.addEventListener('click', function (e) {
                    const href = this.getAttribute('href');
                    if (!href || href.startsWith('#') || href.startsWith('javascript:') || this.target === '_blank') {
                        return;
                    }
                    NProgress.start();
                });
            });

            document.querySelectorAll('form').forEach(form => {
                form.addEventListener('submit', function () {
                    NProgress.start();
                });
            });

            window.addEventListener('beforeunload', function () {
                NProgress.start();
            });

            // Stop loading when page is fully loaded
            window.addEventListener('load', function () {
                NProgress.done();
            });
        });
    </script>

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

</body>

</html><?php /**PATH C:\laragon\www\ecommerc-buku\resources\views/customer/layouts/app.blade.php ENDPATH**/ ?>