@if(auth()->check() && auth()->user()->can('view:administration'))
    @php
        $toolbar = app(\Daylight\Core\Services\AdminToolbar::class);
        $editLinks = $toolbar->getVisibleLinks();
    @endphp
    <style>
        html { margin-top: 32px !important; }
        .admin-toolbar {
            background: #111;
            color: #c3c4c7;
            font-size: 13px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
            line-height: 32px;
            height: 32px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 2147483647;
        }
        .admin-toolbar *, .admin-toolbar *::before, .admin-toolbar *::after {
            box-sizing: border-box;
        }
        .admin-toolbar__inner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            height: 100%;
        }
        .admin-toolbar__left,
        .admin-toolbar__right {
            display: flex;
            align-items: center;
            height: 100%;
            list-style: none;
            margin: 0;
            padding: 0;
        }
        .admin-toolbar__item {
            height: 100%;
            display: flex;
            align-items: center;
        }
        .admin-toolbar__link {
            color: #c3c4c7;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 10px;
            height: 100%;
            white-space: nowrap;
            transition: background-color 0.1s, color 0.1s;
        }
        .admin-toolbar__link:hover {
            background: #222;
            color: #00b9eb;
        }
        .admin-toolbar__link svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }
        .admin-toolbar__brand {
            color: #c3c4c7;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 12px;
            height: 100%;
            font-weight: 600;
            white-space: nowrap;
            transition: background-color 0.1s, color 0.1s;
        }
        .admin-toolbar__brand:hover {
            background: #222;
            color: #00b9eb;
        }
        .admin-toolbar__brand svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }
        .admin-toolbar__user {
            color: #c3c4c7;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 12px;
            height: 100%;
            white-space: nowrap;
            transition: background-color 0.1s, color 0.1s;
        }
        .admin-toolbar__user:hover {
            background: #222;
            color: #00b9eb;
        }
        .admin-toolbar__version {
            color: #777;
            font-size: 11px;
            padding: 0 10px;
        }
        .admin-toolbar__avatar {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #333;
            color: #c3c4c7;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 9px;
            font-weight: 600;
            line-height: 1;
            flex-shrink: 0;
        }
        .admin-toolbar__leave {
            color: #dba617;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 0 10px;
            height: 100%;
            white-space: nowrap;
            transition: background-color 0.1s, color 0.1s;
        }
        .admin-toolbar__leave:hover {
            background: #222;
            color: #f0c33c;
        }
        .admin-toolbar__leave svg {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
        }
        @media print {
            html { margin-top: 0 !important; }
            .admin-toolbar { display: none !important; }
        }
    </style>
    <div class="admin-toolbar">
        <div class="admin-toolbar__inner">
            <ul class="admin-toolbar__left">
                <li class="admin-toolbar__item">
                    <a href="{{ route('daylight.index') }}" class="admin-toolbar__brand">
                        <svg data-slot="icon" fill="none" stroke-width="1.5" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
                            <path stroke-linecap="round" stroke-linejoin="round" d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"></path>
                        </svg>
                        {{ config('app.name', 'Daylight eCommerce Core') }}
                    </a>
                </li>
                @foreach($editLinks as $link)
                    <li class="admin-toolbar__item">
                        <a href="{{ $link['url'] }}" class="admin-toolbar__link">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" />
                            </svg>
                            {{ $link['label'] }}
                        </a>
                    </li>
                @endforeach
            </ul>
            <ul class="admin-toolbar__right">
                <li class="admin-toolbar__item">
                    <span class="admin-toolbar__version">
                        v{{ currentDaylightVersion() }}
                    </span>
                </li>
                @if(is_impersonating())
                    <li class="admin-toolbar__item">
                        <a href="{{ route('daylight.impersonate.leave') }}" class="admin-toolbar__leave">
                            <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9" />
                            </svg>
                            {{ __('daylight::general.leave_impersonation') }}
                        </a>
                    </li>
                @endif
                <li class="admin-toolbar__item">
                    <a href="{{ route('daylight.store.users.show', auth()->id()) }}" class="admin-toolbar__user">
                        <span class="admin-toolbar__avatar">{{ strtoupper(mb_substr(auth()->user()->initials(), 0, 1)) }}</span>
                        {{ auth()->user()->fullName }}
                    </a>
                </li>
            </ul>
        </div>
    </div>
@endif
