<header class="sticky top-0 z-30 flex w-full flex-col gap-2 border-b border-gray-200 bg-white/95 px-4 py-3 shadow-sm backdrop-blur-md supports-[backdrop-filter]:bg-white/90 md:h-16 md:flex-row md:items-center md:justify-between md:gap-3 md:px-6 md:py-0 2xl:px-8">
    <div class="flex min-w-0 items-center gap-3">
        <button type="button" id="btn-mobile-sidebar" class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-gray-200 bg-white text-gray-700 shadow-sm hover:bg-gray-50 lg:hidden" aria-label="Buka menu">
            <i class="fa-solid fa-bars text-lg"></i>
        </button>
        <button type="button" id="btn-desktop-sidebar-toggle" class="hidden h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-gray-200 bg-white text-gray-700 shadow-sm hover:bg-gray-50 lg:inline-flex" aria-label="Ciutkan sidebar">
            <i class="fa-solid fa-table-columns text-sm"></i>
        </button>
        <div class="min-w-0 leading-tight">
            <p class="truncate text-sm font-semibold tracking-tight text-gray-900">Panel administrasi</p>
            <?php if (session()->get('admin_auth_source') === 'admin_users' && is_array(session()->get('admin_ion_groups'))) : ?>
                <p class="truncate text-xs text-gray-500">
                    <?= esc(session('admin_username') ?? '') ?>
                    <span class="text-gray-300">·</span>
                    <?= esc(implode(', ', session('admin_ion_groups'))) ?>
                </p>
            <?php elseif (session()->get('admin_auth_source') === 'pegawai') : ?>
                <p class="truncate text-xs text-gray-500"><?= esc(session('admin_username') ?? '') ?> (pegawai)</p>
            <?php endif ?>
        </div>
    </div>
    <div class="flex flex-wrap items-center justify-end gap-2 md:max-w-[50%]">
        <?php if (session()->getFlashdata('message')) : ?>
            <span class="inline-flex max-w-full items-center rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1.5 text-xs font-medium text-emerald-800"><?= esc(session()->getFlashdata('message')) ?></span>
        <?php endif ?>
        <?php if (session()->getFlashdata('error')) : ?>
            <span class="inline-flex max-w-full items-center rounded-full border border-red-200 bg-red-50 px-3 py-1.5 text-xs font-medium text-red-800"><?= esc(session()->getFlashdata('error')) ?></span>
        <?php endif ?>
        <span class="hidden shrink-0 text-[11px] font-medium uppercase tracking-wide text-gray-400 sm:inline">Presensi Admin</span>
    </div>
</header>