<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dashboard Admin – Disnaker Prov. Kalimantan Barat</title>
    
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/lucide@latest"></script>
    <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
    
    <style>
        * { box-sizing: border-box; }
        body { 
            font-family: 'Outfit', sans-serif; 
            background: #F2F5FB; 
            color: #334155; 
            margin: 0;
            padding: 0;
        }
        main {
            min-height: 100vh;
        }
        ::-webkit-scrollbar { width: 5px; }
        ::-webkit-scrollbar-track { background: #f1f5f9; }
        ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
    </style>
</head>
<body>

    @include('admin.layouts.navbar')

    <main class="pt-10 px-4">
        {{-- Yield inilah panggung untuk konten kamu --}}
        @yield('content')
    </main>

    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script>
        lucide.createIcons();

        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('[onclick^="return confirm"]').forEach(function(btn) {
                const match = btn.getAttribute('onclick').match(/confirm\('([^']+)'\)/);
                if (match) {
                    const message = match[1];
                    btn.removeAttribute('onclick');
                    
                    btn.addEventListener('click', function(e) {
                        e.preventDefault();
                        const form = btn.closest('form');
                        
                        Swal.fire({
                            title: 'Konfirmasi',
                            text: message,
                            icon: 'question',
                            showCancelButton: true,
                            confirmButtonColor: '#3b82f6',
                            cancelButtonColor: '#64748b',
                            confirmButtonText: 'Ya, Lanjutkan',
                            cancelButtonText: 'Batal',
                            reverseButtons: true,
                            customClass: {
                                confirmButton: 'rounded-xl',
                                cancelButton: 'rounded-xl mr-2'
                            }
                        }).then((result) => {
                            if (result.isConfirmed) {
                                if (form) {
                                    form.submit();
                                } else if(btn.getAttribute('href')) {
                                    window.location.href = btn.getAttribute('href');
                                }
                            }
                        });
                    });
                }
            });
        });
    </script>
</body>
</html>