<!doctype html>
<html lang="ms">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Staf • System Dashboard</title>

    <link rel="preconnect" href="https://fonts.bunny.net">
    <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

    <style>
        :root{
            --bg:linear-gradient(135deg,#0f172a,#1d4ed8);
            --panel:#ffffff;
            --border:rgba(15,23,42,.15);
            --muted:#6b7280;
            --text:#0f172a;
            --shadow:0 14px 30px rgba(15,23,42,.12);
            --sidebar-w:260px;
            --topbar-h:56px;
            --accent:#2563eb;
            --accent-strong:#1d4ed8;
        }

        *{box-sizing:border-box}
        html,body{height:100%}
        body{
            margin:0;
            font-family:Figtree,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
            color:var(--text);
            background:var(--bg);
            background-attachment:fixed;
        }

        .app{
            min-height:100vh;
            display:grid;
            grid-template-columns: var(--sidebar-w) 1fr;
            grid-template-rows: var(--topbar-h) 1fr;
            grid-template-areas:
                "sidebar topbar"
                "sidebar main";
        }

        .topbar{
            grid-area:topbar;
            height:var(--topbar-h);
            background:rgba(15,23,42,.88);
            backdrop-filter:blur(12px);
            border-bottom:1px solid rgba(148,163,184,.45);
            display:flex;
            align-items:center;
            justify-content:space-between;
            padding:0 14px;
            box-shadow:var(--shadow);
            position:sticky;
            top:0;
            z-index:10;
        }
        .topbar-left{display:flex;align-items:center;gap:10px;min-width:0}
        .btn-icon{
            width:34px;height:34px;
            display:inline-flex;
            align-items:center;
            justify-content:center;
            border:1px solid rgba(148,163,184,.7);
            background:rgba(15,23,42,.75);
            color:#e5e7eb;
            cursor:pointer;
            border-radius:999px;
            transition:background .18s ease,transform .18s ease,box-shadow .18s ease,border-color .18s ease;
        }
        .btn-icon:hover{
            background:rgba(37,99,235,.9);
            border-color:rgba(191,219,254,1);
            box-shadow:0 10px 25px rgba(15,23,42,.55);
            transform:translateY(-1px);
        }
        .brand{display:flex;align-items:center;gap:10px;min-width:0}
        .brand-badge{
            width:160px;height:55px;
            border-radius:999px;
            border:1px solid rgba(191,219,254,1);
            display:grid;
            place-items:center;
            background:radial-gradient(circle at 0 0,#60a5fa,#1d4ed8);
            box-shadow:0 12px 30px rgba(37,99,235,.65);
            overflow:hidden;
        }
        .brand-title{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#e5e7eb}

        .main{grid-area:main;padding:18px 18px 24px;}

        .page-head{
            border-radius:18px;
            border:1px solid rgba(148,163,184,.5);
            background:linear-gradient(135deg,rgba(248,250,252,.98),rgba(219,234,254,.98));
            padding:16px 18px;
            box-shadow:0 18px 40px rgba(15,23,42,.18);
        }
        .page-head h1{margin:0;font-size:20px;}
        .page-head p{margin:6px 0 0;color:var(--muted);font-size:13px;}

        .grid{margin-top:14px;display:grid;gap:14px;}
        .grid-3{grid-template-columns: repeat(3, minmax(0, 1fr));}

        .panel{
            border-radius:16px;
            border:1px solid rgba(148,163,184,.35);
            background:var(--panel);
            box-shadow:var(--shadow);
            overflow:hidden;
        }
        .panel-head{
            display:flex;align-items:center;justify-content:space-between;gap:10px;
            padding:10px 12px;
            border-bottom:1px solid var(--border);
            background:linear-gradient(135deg,rgba(248,250,252,.98),rgba(219,234,254,.9));
        }
        .panel-title{font-weight:700}
        .panel-body{padding:12px}

        .stat-label{
            font-size:12px;color:var(--muted);font-weight:600;
            text-transform:uppercase;letter-spacing:.08em;
        }
        .stat-value{font-size:30px;font-weight:800;margin-top:4px;}

        .filters{display:flex;gap:10px;flex-wrap:wrap;align-items:center;}
        .input,.select{
            padding:8px 10px;border-radius:10px;border:1px solid rgba(148,163,184,.7);
            background:#fff;color:var(--text);font-size:12px;min-height:36px;
        }
        .input{min-width:280px;flex:1}
        .btn{
            padding:8px 12px;border-radius:10px;border:1px solid rgba(148,163,184,.7);
            background:rgba(37,99,235,.12);color:var(--accent-strong);
            font-weight:700;font-size:12px;cursor:pointer;text-decoration:none;
            display:inline-flex;align-items:center;gap:6px;
        }
        .btn:hover{background:rgba(37,99,235,.18)}

        table{width:100%;border-collapse:collapse;font-size:12px;}
        th,td{padding:10px 10px;border-bottom:1px solid rgba(15,23,42,.08);text-align:left;vertical-align:top;}
        th{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;white-space:nowrap;}
        .muted{color:var(--muted)}

        .pager{
            margin-top:10px;
            display:flex;
            justify-content:space-between;
            gap:10px;
            align-items:center;
            flex-wrap:wrap;
            font-size:12px;
            color:var(--muted);
        }
        .pager a{
            color:var(--accent-strong);
            text-decoration:none;
            font-weight:700;
            padding:4px 6px;
            border-radius:8px;
        }
        .pager a:hover{background:rgba(37,99,235,.12)}
        .pager .disabled{opacity:.45}
        .pager .current{font-weight:800;text-decoration:underline;color:var(--text);padding:4px 6px;}

        .footer{margin-top:16px;text-align:center;color:white;font-size:12px;}

        @media (max-width: 980px){ .grid-3{grid-template-columns:1fr} }
        @media (max-width: 820px){
            .app{
                grid-template-columns: 1fr;
                grid-template-areas: "topbar" "main";
            }
            .backdrop{
                display:none;position:fixed;inset:0;background:rgba(0,0,0,.22);z-index:15;
            }
            .backdrop.show{display:block}
        }
    </style>
</head>
<body>
<div class="app" data-app>
    <?php echo $__env->make('partials.sidebar', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    <header class="topbar" role="banner">
        <div class="topbar-left">
            <button class="btn-icon" type="button" aria-label="Buka menu" data-open-sidebar>
                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" aria-hidden="true">
                    <path d="M4 6h16M4 12h16M4 18h16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                </svg>
            </button>
            <div class="brand" aria-label="Jenama">
                <div class="brand-badge"><img src="<?php echo e(asset('image/logo_kv_sepang.png')); ?>" alt="Logo" style="width:100%;height:100%;"></div>
                <div class="brand-title">System Dashboard</div>
            </div>
        </div>
    </header>

    <main class="main" role="main">
        <section class="page-head" aria-label="Ringkasan staf">
            <h1>Staf</h1>
            <p>Maklumat staf sokongan dan pentadbiran.</p>
        </section>

        <section class="grid grid-3" aria-label="Ringkasan">
            <div class="panel">
                <div class="panel-body">
                    <div class="stat-label">Jumlah Staf</div>
                    <div class="stat-value"><?php echo e(number_format($totalStaf)); ?></div>
                </div>
            </div>
            <div class="panel">
                <div class="panel-body">
                    <div class="stat-label">Staf Lelaki</div>
                    <div class="stat-value"><?php echo e(number_format($totalLelaki)); ?></div>
                </div>
            </div>
            <div class="panel">
                <div class="panel-body">
                    <div class="stat-label">Staf Perempuan</div>
                    <div class="stat-value"><?php echo e(number_format($totalPerempuan)); ?></div>
                </div>
            </div>
        </section>

        <section class="grid" aria-label="Carian dan penapis">
            <div class="panel">
                <div class="panel-head">
                    <div class="panel-title">Carian / Penapis</div>
                    <a class="btn" href="<?php echo e(route('staff.info')); ?>">Reset</a>
                </div>
                <div class="panel-body">
                    <form method="get" action="<?php echo e(route('staff.info')); ?>" class="filters">
                        <input class="input" type="text" name="search" placeholder="Cari nama staf…" value="<?php echo e(request('search')); ?>">

                        <select class="select" name="jawatan">
                            <option value="">Semua Jawatan</option>
                            <?php $__currentLoopData = $jawatanOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $j): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($j); ?>" <?php if(request('jawatan') === $j): echo 'selected'; endif; ?>><?php echo e($j); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>

                        <select class="select" name="jantina">
                            <option value="">Semua Jantina</option>
                            <option value="Lelaki" <?php if(request('jantina') === 'Lelaki'): echo 'selected'; endif; ?>>Lelaki</option>
                            <option value="Perempuan" <?php if(request('jantina') === 'Perempuan'): echo 'selected'; endif; ?>>Perempuan</option>
                        </select>

                        <button class="btn" type="submit">Tapis</button>
                    </form>
                </div>
            </div>
        </section>

        <section class="grid" aria-label="Senarai staf">
            <div class="panel">
                <div class="panel-head">
                    <div class="panel-title">Senarai Staf</div>
                    <div class="muted" style="font-size:12px;">
                        <?php if($staff->total()): ?>
                            <?php echo e(number_format($staff->total())); ?> rekod
                        <?php else: ?>
                            Tiada rekod
                        <?php endif; ?>
                    </div>
                </div>
                <div class="panel-body" style="padding:0;">
                    <div style="overflow:auto;">
                        <table>
                            <thead>
                            <tr>
                                <th style="width:70px;">No</th>
                                <th>Nama</th>
                                <th>Jantina</th>
                                <th>Jawatan</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $staff; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $s): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td class="muted"><?php echo e($staff->firstItem() + $loop->index); ?></td>
                                    <td style="font-weight:700;"><?php echo e($s->nama); ?></td>
                                    <td><?php echo e($s->jantina); ?></td>
                                    <td><?php echo e($s->jawatan); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="4" class="muted" style="padding:14px 10px;">
                                        Tiada rekod staf mengikut carian/penapis semasa.
                                    </td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>

                    <?php if($staff->hasPages()): ?>
                        <?php
                            $last = (int) $staff->lastPage();
                            $current = (int) $staff->currentPage();
                            $start = max(1, $current - 3);
                            $end = min($last, $current + 3);
                            if ($end - $start < 6) {
                                $start = max(1, $end - 6);
                                $end = min($last, $start + 6);
                            }
                        ?>
                        <div class="pager" style="padding:12px;">
                            <div>
                                Menunjukkan <?php echo e($staff->firstItem()); ?>–<?php echo e($staff->lastItem()); ?> daripada <?php echo e($staff->total()); ?> rekod.
                            </div>
                            <div>
                                <?php if($staff->onFirstPage()): ?>
                                    <span class="disabled">« Sebelum</span>
                                <?php else: ?>
                                    <a href="<?php echo e($staff->previousPageUrl()); ?>">« Sebelum</a>
                                <?php endif; ?>

                                <?php if($start > 1): ?>
                                    <a href="<?php echo e($staff->url(1)); ?>">1</a>
                                    <?php if($start > 2): ?>
                                        <span class="disabled">…</span>
                                    <?php endif; ?>
                                <?php endif; ?>

                                <?php $__currentLoopData = $staff->getUrlRange($start, $end); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page => $url): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <?php if($page == $staff->currentPage()): ?>
                                        <span class="current"><?php echo e($page); ?></span>
                                    <?php else: ?>
                                        <a href="<?php echo e($url); ?>"><?php echo e($page); ?></a>
                                    <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                                <?php if($end < $last): ?>
                                    <?php if($end < $last - 1): ?>
                                        <span class="disabled">…</span>
                                    <?php endif; ?>
                                    <a href="<?php echo e($staff->url($last)); ?>"><?php echo e($last); ?></a>
                                <?php endif; ?>

                                <?php if($staff->hasMorePages()): ?>
                                    <a href="<?php echo e($staff->nextPageUrl()); ?>">Seterusnya »</a>
                                <?php else: ?>
                                    <span class="disabled">Seterusnya »</span>
                                <?php endif; ?>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </section>

        <div class="footer">
            © <?php echo e(date('Y')); ?> • System Dashboard v1.0
        </div>
    </main>
</div>

<?php echo $__env->make('partials.chatbot', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<div class="backdrop" data-backdrop aria-hidden="true"></div>

<script>
    (function () {
        const sidebar = document.querySelector('[data-sidebar]');
        const openBtn = document.querySelector('[data-open-sidebar]');
        const closeBtn = document.querySelector('[data-close-sidebar]');
        const backdrop = document.querySelector('[data-backdrop]');

        function openSidebar() {
            if (!sidebar || !backdrop) return;
            sidebar.classList.add('open');
            backdrop.classList.add('show');
            backdrop.setAttribute('aria-hidden', 'false');
        }
        function closeSidebar() {
            if (!sidebar || !backdrop) return;
            sidebar.classList.remove('open');
            backdrop.classList.remove('show');
            backdrop.setAttribute('aria-hidden', 'true');
        }

        openBtn && openBtn.addEventListener('click', openSidebar);
        closeBtn && closeBtn.addEventListener('click', closeSidebar);
        backdrop && backdrop.addEventListener('click', closeSidebar);
    })();
</script>
</body>
</html>
<?php /**PATH C:\xampp\htdocs\dash\resources\views/staff-info.blade.php ENDPATH**/ ?>