<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <title>@yield('title', config('app.name'))</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
    <style>
        body { background-color: #f8f9fc; }
        
        /* Sidebar Styling */
        #sidebar {
            width: 260px;
            background-color: #111425;
            position: fixed;
            top: 0;
            left: 0;
            height: 100vh;
            overflow-y: auto;
            z-index: 1000;
        }
        
        .sidebar-brand { color: #fff; padding: 1.5rem 1.25rem; font-weight: 700; }
        .sidebar-brand-icon { background: #5c4df0; padding: 0.5rem; border-radius: 8px; margin-right: 10px; }
        .sidebar-nav-item { color: #8a90a5; text-decoration: none; padding: 0.75rem 1.25rem; display: block; border-radius: 8px; margin: 0.2rem 1rem; font-size: 0.9rem; }
        .sidebar-nav-item:hover, .sidebar-nav-item.active { background-color: #5c4df0; color: #fff; }
        .sidebar-heading { color: #5a617a; font-size: 0.75rem; text-transform: uppercase; padding: 1rem 1.25rem 0.5rem; font-weight: 600; letter-spacing: 0.5px; }
        
        /* Main Content Layout */
        #main-content { margin-left: 260px; min-height: 100vh; }
        
        /* Topbar Styling */
        .topbar { background: #fff; height: 70px; border-bottom: 1px solid #eaedf1; padding: 0 1.5rem; }
        .badge-notification { position: absolute; top: -5px; right: -5px; background: #e74a3b; border-radius: 50%; padding: 3px 6px; font-size: 10px; color: white;}
        
        /* Dashboard Cards */
        .hero-banner { background-color: #181b31; color: white; border-radius: 12px; }
        .stat-card { border: 1px solid #eaedf1; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
        .stat-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 1.2rem; }
        
        .progress-slim { height: 6px; border-radius: 4px; }
    </style>
    @stack('styles')
</head>

<body>
    @include('layouts.partials.sidebar')
    <main id="main-content">
        @include('layouts.partials.topbar')
        <div class="container-fluid p-4">

            @yield('content')

        </div>

    </main>
    <!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        $(document).ready(function() {
            // Function to update the clock dynamically
            function updateClock() {
                const now = new Date();
                
                // Format Date: Thu, Jun 18, 2026
                const dateOptions = { weekday: 'short', month: 'short', day: 'numeric', year: 'numeric' };
                const formattedDate = now.toLocaleDateString('en-US', dateOptions);
                
                // Format Time: 01:37:34 PM
                const timeOptions = { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true };
                const formattedTime = now.toLocaleTimeString('en-US', timeOptions);
                
                $('#current-date').text(formattedDate);
                $('#current-time').text(formattedTime);
            }

            // Run clock update immediately and then every second
            updateClock();
            setInterval(updateClock, 1000);

            // Basic button interaction demo using jQuery
            $('#seedBtn').on('click', function() {
                const $btn = $(this);
                const originalText = $btn.html();
                $btn.html('<span class="spinner-border spinner-border-sm me-2" role="status" aria-hidden="true"></span> Seeding...');
                $btn.prop('disabled', true);
                
                // Simulate an API call
                setTimeout(() => {
                    $btn.html(originalText);
                    $btn.prop('disabled', false);
                    alert('Demo records seeded successfully!');
                }, 1500);
            });
        });
    </script>
    @stack('scripts')

</body>
</html>