<style>
            .top-bar {
                background: var(--gray-900);
                padding: 7px 0;
                font-size: 0.78rem;
                border-bottom: 1px solid rgba(255,255,255,0.06);
            }
            .top-bar .container {
                display: flex; justify-content: space-between; align-items: center;
            }
            .top-bar-left { display: flex; gap: 14px; align-items: center; }
            .top-bar-left a {
                color: var(--gray-400);
                transition: color 0.2s;
                font-size: 0.73rem;
                font-weight: 500;
            }
            .top-bar-left a:hover { color: var(--gold); }
            .top-bar-left .divider { color: var(--gray-600); font-size: 0.7rem; }
            .top-bar-center { display: flex; align-items: center; gap: 8px; }
            .top-btn { display: inline-flex; align-items: center; gap: 5px; color: var(--gray-300); font-size: 0.75rem; font-weight: 500; text-decoration: none; transition: color 0.2s; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--gray-600); }
            .top-btn:hover { color: var(--gold); border-color: var(--gold); }
            .top-btn i { font-size: 0.65rem; }
            .top-btn-reg { background: var(--accent); border-color: var(--accent); color: white; }
            .top-btn-reg:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: white; }
            .top-bar-right { display: flex; align-items: center; gap: 6px; }
            .top-bar-right a {
                color: var(--gray-400);
                transition: all 0.2s;
            }
            .top-bar-right a:hover { color: var(--gold); }
            .top-bar-right .social-icon {
                display: inline-flex; align-items: center; justify-content: center;
                width: 28px; height: 28px;
                border-radius: 8px;
                background: rgba(255,255,255,0.05);
                color: var(--gray-400);
                font-size: 0.72rem;
            }
            .top-bar-right .social-icon:hover {
                background: rgba(245,158,11,0.15);
                color: var(--gold);
            }
            .top-bar-right .access-icon {
                display: inline-flex; align-items: center; justify-content: center;
                width: 28px; height: 28px;
                color: var(--gray-400);
                font-size: 0.9rem;
                border-radius: 8px;
                transition: all 0.2s;
            }
            .top-bar-right .access-icon:hover {
                background: rgba(245,158,11,0.15);
                color: var(--gold);
            }
            .main-header {
                background: rgba(255,255,255,0.92);
                backdrop-filter: blur(16px) saturate(180%);
                -webkit-backdrop-filter: blur(16px) saturate(180%);
                border-bottom: 1px solid var(--gray-200);
                position: sticky; top: 0; z-index: 1000;
                transition: box-shadow 0.3s;
            }
            .main-header.scrolled { box-shadow: var(--shadow-md); }
            .main-header .container {
                display: flex; align-items: center; gap: 20px;
            }
            .header-brand {
                display: flex; align-items: center; gap: 14px;
                padding: 6px 0;
            }
            .header-logo {
                width: auto; height: 42px; flex-shrink: 0;
                display: flex; align-items: center;
            }
            .header-logo img { height: 100%; width: auto; }
            .nav-wrapper {
                flex: 1; display: flex; align-items: center; gap: 0; justify-content: center;
            }
            
            
            .nav-list { display: flex; align-items: center; gap: 2px; }
            .nav-list > li { position: relative; }
            .nav-list > li > a {
                display: flex; align-items: center; gap: 6px;
                padding: 24px 14px;
                color: var(--gray-600);
                font-size: 0.82rem; font-weight: 500;
                white-space: nowrap;
                letter-spacing: -0.01em;
                border-radius: 8px;
                position: relative;
                transition: all 0.25s;
            }
            .nav-list > li > a::after {
                content: '';
                position: absolute;
                bottom: 8px; left: 50%;
                transform: translateX(-50%);
                width: 0; height: 2.5px;
                background: var(--accent);
                border-radius: 4px;
                transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            }
            .nav-list > li > a:hover::after,
            .nav-list > li > a.active::after { width: 20px; }
            .nav-list > li > a i:first-child {
                font-size: 0.6rem; color: var(--accent);
                opacity: 0; transform: translateX(-4px);
                transition: all 0.25s;
            }
            .nav-list > li > a:hover i:first-child,
            .nav-list > li > a.active i:first-child { opacity: 1; transform: translateX(0); }
            .nav-list > li > a:hover { color: var(--accent); }
            .nav-list > li > a.active { color: var(--accent); font-weight: 600; }
            .nav-list > li > a .fa-angle-down {
                font-size: 0.6rem; margin-left: 1px;
                transition: transform 0.3s; color: var(--gray-400);
            }
            .nav-list > li:hover > a .fa-angle-down { transform: rotate(180deg); color: var(--accent); }
            .dropdown-content {
                position: absolute;
                top: 100%; left: 50%;
                transform: translateX(-50%) translateY(10px);
                background: var(--white);
                min-width: 240px;
                box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 8px 20px rgba(0,0,0,0.06);
                border-radius: 14px;
                opacity: 0; visibility: hidden;
                transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
                z-index: 100;
                overflow: hidden;
                border: 1px solid var(--gray-100);
            }
            .nav-list > li:hover .dropdown-content {
                opacity: 1; visibility: visible;
                transform: translateX(-50%) translateY(0);
            }
            .dropdown-content::before {
                content: '';
                position: absolute;
                top: -5px; left: 50%;
                transform: translateX(-50%) rotate(45deg);
                width: 10px; height: 10px;
                background: var(--white);
                border-left: 1px solid var(--gray-100);
                border-top: 1px solid var(--gray-100);
            }
            .dropdown-header {
                background: linear-gradient(135deg, var(--primary), var(--primary-light));
                color: rgba(255,255,255,0.9);
                padding: 14px 18px;
                font-size: 0.72rem;
                font-weight: 400;
                line-height: 1.5;
            }
            .dropdown-header i { margin-right: 10px; opacity: 0.7; }
            .dropdown-content a {
                display: flex; align-items: center; gap: 10px;
                padding: 11px 18px;
                color: var(--gray-600);
                font-size: 0.8rem;
                font-weight: 500;
                border-bottom: 1px solid var(--gray-100);
                transition: all 0.2s;
            }
            .dropdown-content a i { font-size: 0.5rem; color: var(--accent); }
            .dropdown-content a:hover {
                background: linear-gradient(135deg, var(--accent-light), #fff);
                color: var(--accent);
                padding-left: 24px;
            }
            .dropdown-content a:last-child { border-bottom: none; }
            .nav-icons {
                
                display: flex;
                align-items: center;
                gap: 0;
                padding: 2px 0 2px 8px;
                border-left: 1px solid var(--gray-200);
            }
            .nav-icons .nav-icon-btn {
                display: flex;
                flex-direction: column;
                align-items: center;
                padding: 2px 4px 1px;
                transition: all 0.15s;
                border-radius: 4px;
                text-decoration: none;
            }
            .nav-icons .nav-icon-btn:hover { background: var(--gray-100); }
            .nav-icons .nav-icon-btn .ni-box {
                width: 22px;
                height: 22px;
                border-radius: 4px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 0.6rem;
                transition: all 0.15s;
                border: 1px solid transparent;
            }
            .nav-icons .nav-icon-btn:hover .ni-box { transform: scale(1.06); }
            .nav-icons .nav-icon-btn:nth-child(1) .ni-box { background: #fef2f2; color: var(--accent); border-color: #fecaca; }
            .nav-icons .nav-icon-btn:nth-child(2) .ni-box { background: #eef2ff; color: var(--primary); border-color: #c7d2fe; }
            .nav-icons .nav-icon-btn:nth-child(3) .ni-box { background: #fffbeb; color: #d97706; border-color: #fde68a; }
            .nav-icons .nav-icon-btn:nth-child(4) .ni-box { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
            .nav-icons .nav-icon-btn span {
                font-size: 0.4rem;
                color: var(--gray-400);
                font-weight: 600;
                text-transform: uppercase;
                margin-top: 1px;
                letter-spacing: 0.1px;
                white-space: nowrap;
            }
            .hamburger {
                display: none; background: var(--gray-100); border: none;
                cursor: pointer; padding: 8px 4px;
                flex-direction: column; gap: 4px;
                position: relative; z-index: 5;
                border-radius: 8px;
                
            }
            .hamburger span {
                display: block; width: 20px; height: 2px;
                background: var(--gray-600);
                border-radius: 4px;
                transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                transform-origin: center;
            }
            .hamburger:hover span { background: var(--accent); }
            .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); width: 18px; }
            .hamburger.active span:nth-child(2) { opacity: 0; transform: translateX(-4px); }
            .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); width: 18px; }
            .mob-top-bar { display: none; align-items: center; gap: 2px; margin-right: 10px; }
            .mob-top-link { font-size: 0.7rem; color: var(--gray-500); text-decoration: none; padding: 4px 2px; font-weight: 500; }
            .mob-top-link:hover { color: var(--accent); }
            .mob-top-divider { color: var(--gray-300); font-size: 0.65rem; }
            .mob-bottom-bar { display: none; align-items: center; justify-content: space-between; padding: 6px 16px; background: var(--gray-50); width: 100%; }
            .mob-btm-left, .mob-btm-right { display: flex; align-items: center; gap: 2px; }
            .mob-btm-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; color: var(--gray-500); text-decoration: none; border-radius: 6px; font-size: 0.75rem; }
            .mob-btm-icon:hover { background: var(--gray-100); color: var(--accent); }
            .mob-btm-icon-reg { color: var(--accent); }
            .mob-btm-sep { width: 1px; height: 16px; background: var(--gray-200); }
            .sidebar-overlay {
                display: none; position: fixed; inset: 0;
                background: rgba(0,0,0,0.5); z-index: 99;
                opacity: 0; transition: opacity 0.3s;
            }
            .sidebar-overlay.open { display: block; opacity: 1; }
            .sidebar-menu {
                position: fixed; top: 42px; left: -300px; width: 280px;
                height: calc(100vh - 42px); background: var(--white);
                z-index: 100; overflow-y: auto;
                transition: left 0.3s ease;
                box-shadow: 5px 0 30px rgba(0,0,0,0.15);
            }
            .sidebar-menu.open { left: 0; }
            .sidebar-header {
                display: flex; align-items: center; justify-content: space-between;
                padding: 18px 20px; border-bottom: 1px solid var(--gray-100);
            }
            .sidebar-header h3 { font-size: 0.9rem; font-weight: 600; color: var(--gray-900); margin: 0; }
            .sidebar-close { background: none; border: none; font-size: 1.3rem; color: var(--gray-400); cursor: pointer; padding: 4px; }
            .sidebar-close:hover { color: var(--accent); }
            .sidebar-menu a {
                display: flex; align-items: center; gap: 10px;
                padding: 14px 20px;
                color: var(--gray-700); text-decoration: none;
                border-bottom: 1px solid var(--gray-100);
                font-size: 0.85rem; font-weight: 500;
                transition: all 0.2s;
            }
            .sidebar-menu a:hover { background: var(--gray-50); color: var(--accent); padding-left: 26px; }
            .sidebar-menu a i:first-child { font-size: 0.65rem; color: var(--accent); width: 16px; }
            .sidebar-menu .m-dropdown-btn {
                display: flex; justify-content: space-between; align-items: center;
                width: 100%; background: none; border: none;
                color: var(--gray-700);
                padding: 14px 20px;
                font-size: 0.85rem; font-weight: 500;
                font-family: inherit; cursor: pointer;
                border-bottom: 1px solid var(--gray-100);
                transition: all 0.2s;
            }
            .sidebar-menu .m-dropdown-btn:hover { background: var(--gray-50); color: var(--accent); }
            .sidebar-menu .m-submenu { display: none; background: var(--gray-50); }
            .sidebar-menu .m-submenu.open { display: block; }
            .sidebar-menu .m-submenu a { padding-left: 40px; font-size: 0.8rem; }
            .sidebar-menu .m-submenu a:hover { padding-left: 46px; }
            @media (max-width: 1024px) {
                .main-header .container { flex-wrap: wrap; }
                .header-brand { flex: 0 0 auto; }
                .nav-wrapper { flex: 1; justify-content: flex-end; gap: 0; }
                .nav-list { display: none !important; }
                .nav-icons { display: none !important; }
                .hamburger { display: flex !important; flex-shrink: 0; }
                .mob-top-bar { display: flex !important; flex-shrink: 0; }
                .mob-bottom-bar { display: flex !important; }
            }
            @media (max-width: 768px) {
                .top-bar { display: none !important; }
                .header-brand img { max-height: 38px; }
                .hamburger { width: 38px; height: 38px; display: flex !important; align-items: center; justify-content: center; }
                .mob-top-bar { display: flex !important; }
            }
            @media (max-width: 480px) {
                .top-bar-left a { font-size: 0.65rem; }
                .top-bar-left .divider { font-size: 0.6rem; }
                .header-brand img { max-height: 32px; }
            }
            .dropdown-content a.active { background: linear-gradient(135deg, var(--accent-light), #fff); color: var(--accent); padding-left: 24px; }</style>
            <div class="top-bar">
                <div class="container">
                    <div class="top-bar-left">
                        <a href="{{ url("lang/ms") }}">MALAY</a>
                        <span class="divider">|</span>
                        <a href="{{ url("lang/en") }}">ENGLISH</a>
                        <span class="divider">|</span>
                        <a href="{{ url("lang/zh") }}">中文</a>
                    </div>
                    <div class="top-bar-center">
<a href="{{ url("/" . ($siteSlug ?: \App\Http\Helpers\SettingHelper::defaultSiteSlug()) . "/login-web") }}" class="top-btn" target="_blank"><i class="fas fa-sign-in-alt"></i> {{ t("login") }}</a>
                        <a href="{{ url("/" . ($siteSlug ?: \App\Http\Helpers\SettingHelper::defaultSiteSlug()) . "/register-web") }}" class="top-btn top-btn-reg" target="_blank"><i class="fas fa-user-plus"></i> {{ t("register") }}</a>
                    </div>
                    <div class="top-bar-right">
                        <a href="#" class="social-icon" aria-label="Facebook"><i class="fab fa-facebook-f"></i></a>
                        <a href="#" class="social-icon" aria-label="Twitter"><i class="fab fa-twitter"></i></a>
                        <a href="#" class="social-icon" aria-label="YouTube"><i class="fab fa-youtube"></i></a>
                        <a href="#" class="social-icon" aria-label="Instagram"><i class="fab fa-instagram"></i></a>
                        <a href="#" class="access-icon" aria-label="Kebolehcapaian"><i class="fas fa-wheelchair"></i></a>
                    </div>
                </div>
            </div>
            <header class="main-header">
                <div class="container">
                    <div class="header-brand">
                        <div class="header-logo">
                            <img src="/dynaweb4/img/logo.png" alt="Logo Agensi">
                        </div>
                    </div>
                    <div class="nav-wrapper">
                                        <ul class="nav-list">
                @php
            $currentUrl = request()->fullUrl();
        @endphp
        @foreach($menuTree as $item)
                    @php $parentActive = false; if(!empty($item['children'])) { foreach($item['children'] as $ch) { if($ch['menu_link'] && $currentUrl === url($ch['menu_link'])) { $parentActive = true; break; } } } @endphp
                    @if(!empty($item['children']))
                    <li>
                        <a href="{{ $item['menu_link'] ?: '#' }}"@if(($item['menu_link'] && $currentUrl === url($item['menu_link'])) || $parentActive) class="active"@endif><i class="fas fa-angle-right"></i> {{ $item['menu_name'] }} <i class="fas fa-angle-down"></i></a>
                        <div class="dropdown-content">
                            <div class="dropdown-header"><i class="fas fa-link"></i> {{ $item['menu_name'] }}</div>
                            @foreach($item['children'] as $child)
                            <a href="{{ $child['menu_link'] ?: '#' }}"@if($child['menu_link'] && $currentUrl === url($child['menu_link'])) class="active"@endif><i class="fas fa-angle-right"></i> {{ $child['menu_name'] }}</a>
                            @endforeach
                        </div>
                    </li>
                    @else
                    <li><a href="{{ $item['menu_link'] ?: '#' }}"@if($item['menu_link'] && $currentUrl === url($item['menu_link'])) class="active"@endif><i class="fas fa-angle-right"></i> {{ $item['menu_name'] }}</a></li>
                    @endif
                @endforeach
            </ul>
                        <div class="nav-icons">
                            <a href="#" class="nav-icon-btn">
                                <div class="ni-box"><i class="fas fa-question"></i></div>
                                <span>Soalan Lazim</span>
                            </a>
                            
                            <a href="#" class="nav-icon-btn">
                                <div class="ni-box"><i class="fas fa-comment"></i></div>
                                <span>Maklum Balas</span>
                            </a>
                            <a href="/{{ $siteSlug }}/sitemap-web" class="nav-icon-btn">
                                <div class="ni-box"><i class="fas fa-sitemap"></i></div>
                                <span>Sitemap</span>
                            </a>
                        </div>
                        <div class="mob-top-bar">
                            <a href="{{ url("lang/ms") }}" class="mob-top-link">MY</a>
                            <span class="mob-top-divider">|</span>
                            <a href="{{ url("lang/en") }}" class="mob-top-link">EN</a>
                            <span class="mob-top-divider">|</span>
                            <a href="{{ url("lang/zh") }}" class="mob-top-link">中文</a>
                        </div>
                        <button class="hamburger" onclick="toggleMobile()" aria-label="Toggle navigation">
                            <span></span><span></span><span></span>
                        </button>
                    </div>
                    <div class="mob-bottom-bar">
                        <div class="mob-btm-left">
                            <a href="{{ url("/" . ($siteSlug ?: \App\Http\Helpers\SettingHelper::defaultSiteSlug()) . "/login-web") }}" class="mob-btm-icon" target="_blank"><i class="fas fa-sign-in-alt"></i></a>
                            <a href="{{ url("/" . ($siteSlug ?: \App\Http\Helpers\SettingHelper::defaultSiteSlug()) . "/register-web") }}" class="mob-btm-icon mob-btm-icon-reg" target="_blank"><i class="fas fa-user-plus"></i></a>
                        </div>
                        <div class="mob-btm-right">
                            <a href="#" class="mob-btm-icon"><i class="fab fa-facebook-f"></i></a>
                            <a href="#" class="mob-btm-icon"><i class="fab fa-twitter"></i></a>
                            <a href="#" class="mob-btm-icon"><i class="fab fa-youtube"></i></a>
                            <a href="#" class="mob-btm-icon"><i class="fab fa-instagram"></i></a>
                            <a href="#" class="mob-btm-icon"><i class="fas fa-wheelchair"></i></a>
                        </div>
                    </div>
                </div>
            </header>
            <div class="sidebar-overlay" id="sidebarOverlay" onclick="toggleMobile()"></div>
            <div class="sidebar-menu" id="sidebarMenu">
                <div class="sidebar-header">
                    <h3>Menu</h3>
                    <button class="sidebar-close" onclick="toggleMobile()">&times;</button>
                </div>
                @php
            $currentUrl = request()->fullUrl();
        @endphp
        @foreach($menuTree as $item)
                    @php $parentActive = false; if(!empty($item['children'])) { foreach($item['children'] as $ch) { if($ch['menu_link'] && $currentUrl === url($ch['menu_link'])) { $parentActive = true; break; } } } @endphp
                    @if(!empty($item['children']))
                    <button class="m-dropdown-btn" onclick="toggleSub(this)">
                        <span><i class="fas fa-angle-right"></i> {{ $item['menu_name'] }}</span>
                        <i class="fas fa-angle-down"></i>
                    </button>
                    <div class="m-submenu">
                        @foreach($item['children'] as $child)
                        <a href="{{ $child['menu_link'] ?: '#' }}"@if($child['menu_link'] && $currentUrl === url($child['menu_link'])) class="active"@endif><i class="fas fa-angle-right"></i> {{ $child['menu_name'] }}</a>
                        @endforeach
                    </div>
                    @else
                    <a href="{{ $item['menu_link'] ?: '#' }}"><i class="fas fa-angle-right"></i> {{ $item['menu_name'] }}</a>
                    @endif
                @endforeach
            </div>
            <script>
            function toggleMobile() {
                document.getElementById('sidebarMenu')?.classList.toggle('open');
                document.getElementById('sidebarOverlay')?.classList.toggle('open');
                document.querySelector('.hamburger')?.classList.toggle('active');
            }
            function toggleSub(btn) {
                btn.nextElementSibling.classList.toggle('open');
                btn.querySelector('.fa-angle-down')?.classList.toggle('fa-rotate-180');
            }
            </script>