<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Pustaka Nawasena Bakorwil III Malang</title>
    <link rel="icon" href="{{ asset('images/pustaka.jpeg') }}" type="image/png">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <style>
        :root {
            --primary-orange: #f97316;
            --light-orange: #fff4e6;
            --dark-navy: #002d50;
            --bg-body: #f4f7f9;
        }

        /* Base Reset */
        body {
            font-family: 'Poppins', sans-serif;
            background-color: var(--bg-body);
            color: #374151;
            margin: 0;
            padding: 0;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* 1. Header Profesional */
        .dashboard-header {
            background-color: #ffffff;
            border-bottom: 3px solid var(--primary-orange);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            padding: 0.8rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .dashboard-header .title {
            font-size: 1.3rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            color: var(--dark-navy);
            text-decoration: none;
        }

        .dashboard-header .title img {
            width: 42px;
            height: 42px;
            margin-right: 12px;
            border-radius: 8px;
            object-fit: cover;
        }

        /* 2. Menu Navigation */
        .menu { display: flex; align-items: center; }
        .menu a {
            color: #4b5563;
            text-decoration: none;
            font-weight: 600;
            font-size: 0.95rem;
            margin-left: 15px;
            padding: 8px 16px;
            border-radius: 10px;
            transition: all 0.3s ease;
        }

        .menu a:hover {
            color: var(--primary-orange);
            background-color: var(--light-orange);
        }

        .menu a.active {
            color: white;
            background-color: var(--primary-orange);
        }

        .menu-toggle {
            display: none;
            font-size: 1.8rem;
            color: var(--dark-navy);
            background: none;
            border: none;
        }

        /* 3. Main Content Area */
        .content-area {
            flex: 1;
            padding: 2rem;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
        }

        .main-content {
            width: 100%;
            max-width: 1400px;
            margin: 0 auto;
            flex: 1;
        }

        /* 4. Footer */
        footer {
            text-align: center;
            font-size: 0.85rem;
            color: #9ca3af;
            background-color: #ffffff;
            border-top: 1px solid #e5e7eb;
            padding: 1.2rem;
            margin-top: auto;
        }

        /* 5. Utility: Hide Scrollbar (jika diminta halaman anak) */
        .no-scroll {
            overflow: hidden !important;
        }

        /* Responsivitas Mobile */
        @media (max-width: 768px) {
            .menu-toggle { display: block; }
            .menu {
                display: none;
                flex-direction: column;
                width: 100%;
                position: absolute;
                top: 75px;
                left: 0;
                background: white;
                padding: 1rem;
                box-shadow: 0 10px 15px rgba(0,0,0,0.1);
            }
            .menu.show { display: flex; }
            .menu a { margin: 5px 0; width: 100%; }
            .content-area { padding: 1rem; }
        }
    </style>

    @yield('styles')
</head>
<body class="@yield('body-class')">

    <header class="dashboard-header" id="main-header">
        <a href="/" class="title">
            <img src="{{ asset('images/kartu.png') }}" alt="Logo">
            <span>Pustaka Nawasena</span>
        </a>

        <button class="menu-toggle" id="menu-toggle">
            <i class="bi bi-list"></i>
        </button>

        <nav class="menu" id="menu">
            <a href="{{ route('user.koleksi') }}" class="{{ request()->routeIs('user.koleksi') ? 'active' : '' }}">
                <i class="bi bi-grid-fill me-2"></i>Koleksi
            </a>
            </nav>
    </header>

    <main class="content-area" id="main-area">
        <div class="main-content">
            @yield('content')
        </div>
    </main>

    <footer id="main-footer">
        <p class="m-0">&copy; {{ date('Y') }} <strong>Pustaka Nawasena</strong> Bakorwil III Malang. Hak Cipta Dilindungi.</p>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        const toggleButton = document.getElementById('menu-toggle');
        const menu = document.getElementById('menu');

        toggleButton.addEventListener('click', () => {
            menu.classList.toggle('show');
        });
    </script>

    @yield('scripts')
</body>

</html>

