<!doctype html>
<html lang="ms">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Maklumat Pelajar • 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-soft:#dbeafe;
            --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);
            border-left:none;
            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;
            font-weight:800;
            letter-spacing:.4px;
            font-size:12px;
            color:#dbeafe;
            background:radial-gradient(circle at 0 0,#60a5fa,#1d4ed8);
            box-shadow:0 12px 30px rgba(37,99,235,.65);
        }
        .brand-title{
            font-weight:700;
            white-space:nowrap;
            overflow:hidden;
            text-overflow:ellipsis;
            color:#e5e7eb;
        }

        .sidebar{
            grid-area:sidebar;
            background:rgba(15,23,42,.96);
            border-right:1px solid rgba(30,64,175,.7);
            display:flex;
            flex-direction:column;
            position:sticky;
            top:0;
            height:120vh;
            z-index:20;
        }
        
        .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);
        }
        .panel-title{
            font-weight:700;
            font-size:13px;
        }
        .panel-body{
            padding:12px 12px 14px;
        }

        .stat-label{
            font-size:11px;
            color:var(--muted);
            letter-spacing:.3px;
            text-transform:uppercase;
        }
        .stat-value{
            margin-top:6px;
            font-weight:800;
            font-size:22px;
        }

        .list{
            display:flex;
            flex-direction:column;
            gap:8px;
            padding:10px 12px 14px;
        }
        .row-block{
            border-radius:12px;
            border:1px dashed rgba(148,163,184,.8);
            padding:8px 10px;
            background:linear-gradient(135deg,#f9fafb,#eff6ff);
        }
        .row-header{
            display:flex;
            justify-content:space-between;
            font-size:12px;
            margin-bottom:4px;
        }
        .row-header span:first-child{
            font-weight:600;
        }
        .bar-track{
            width:100%;
            height:10px;
            border-radius:999px;
            background:#e5e7eb;
            overflow:hidden;
            display:flex;
        }
        .bar-seg{
            height:100%;
        }
        .bar-seg.lelaki{background:#d5bf3f;}
        .bar-seg.perempuan{background:#2edbb3;}
        .bar-seg.total{background:#c81681;}

        .two-col{
            grid-template-columns: 1.4fr 1.1fr;
            align-items:start;
        }

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

        @media (max-width: 1100px){
            .grid-3{grid-template-columns: repeat(2, minmax(0, 1fr));}
            .two-col{grid-template-columns: 1fr;}
        }
        @media (max-width: 860px){
            .app{
                grid-template-columns: 1fr;
                grid-template-areas:
                    "topbar"
                    "main";
            }
            .topbar{border-left:1px solid var(--border)}
          
            
            .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 pelajar">
            <h1>Maklumat Pelajar</h1>
            <p>Statistik dan analisis ringkas berdasarkan data dalam pangkalan data pelajar.</p>
        </section>

        <section class="grid grid-3" aria-label="Ringkasan jantina">
            <div class="panel">
                <div class="panel-body">
                    <div class="stat-label">Total Pelajar</div>
                    <div class="stat-value"><?php echo e(number_format($totalPelajar)); ?></div>
                    <p style="margin:6px 0 0;font-size:12px;color:var(--muted);">Semua program</p>
                </div>
            </div>
            <div class="panel">
                <div class="panel-body">
                    <div class="stat-label">Pelajar 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">Pelajar Perempuan</div>
                    <div class="stat-value"><?php echo e(number_format($totalPerempuan)); ?></div>
                </div>
            </div>
        </section>

        <section class="grid two-col" aria-label="Butiran program dan kohort">
            <div class="panel">
                <div class="panel-head">
                    <div class="panel-title">Maklumat Jantina Mengikut Program</div>
                </div>
                <div class="panel-body">
                    <div class="list">
                        <?php $__empty_1 = true; $__currentLoopData = $programJantina; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <?php
                                $jumlah = max(1, (int) $row->jumlah);
                                $lelakiPct = round(($row->lelaki / $jumlah) * 100);
                                $perempuanPct = 100 - $lelakiPct;
                            ?>
                            <div class="row-block">
                                <div class="row-header">
                                    <span><?php echo e($row->program); ?></span>
                                    <span><?php echo e($row->jumlah); ?> pelajar</span>
                                </div>
                                <div class="bar-track">
                                    <div class="bar-seg lelaki" style="width: <?php echo e($lelakiPct); ?>%"></div>
                                    <div class="bar-seg perempuan" style="width: <?php echo e($perempuanPct); ?>%"></div>
                                </div>
                                <div class="row-header" style="margin-top:4px;font-size:11px;color:var(--muted);">
                                    <span>Lelaki: <?php echo e($row->lelaki); ?></span>
                                    <span>Perempuan: <?php echo e($row->perempuan); ?></span>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="row-block">
                                <div class="row-header">
                                    <span>Tiada data program</span>
                                </div>
                                <p style="margin:4px 0 0;font-size:12px;color:var(--muted);">
                                    Sila tambah rekod pelajar dalam modul admin.
                                </p>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>

            <div class="panel">
                <div class="panel-head">
                    <div class="panel-title">Jumlah Pelajar Mengikut Kohort &amp; Kelas</div>
                </div>
                <div class="panel-body">
                    <div class="list">
                        <?php
                            $maxKohort = max(1, (int) ($kohortData->max('jumlah') ?? 1));
                        ?>
                        <?php $__empty_1 = true; $__currentLoopData = $kohortData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                            <?php
                                $pct = round(($row->jumlah / $maxKohort) * 100);
                            ?>
                            <div class="row-block">
                                <div class="row-header">
                                    <span><?php echo e($row->kohort); ?> • Kelas: <?php echo e($row->kelas); ?></span>
                                    <span><?php echo e($row->jumlah); ?> pelajar</span>
                                </div>
                                <div class="bar-track">
                                    <div class="bar-seg total" style="width: <?php echo e($pct); ?>%"></div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                            <div class="row-block">
                                <div class="row-header">
                                    <span>Tiada data kohort</span>
                                </div>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </section>

        <section class="grid" aria-label="Maklumat kaum">
            <div class="panel">
                <div class="panel-head">
                    <div class="panel-title">Maklumat Kaum</div>
                </div>
                <div class="panel-body">
                    <div class="list">
                        <?php
                            $totalKaum = max(1, array_sum($kaum));
                        ?>
                        <?php $__currentLoopData = $kaum; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $nama => $jumlah): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php
                                $pct = round(($jumlah / $totalKaum) * 100);
                            ?>
                            <div class="row-block">
                                <div class="row-header">
                                    <span><?php echo e($nama); ?></span>
                                    <span><?php echo e($jumlah); ?> (<?php echo e($pct); ?>%)</span>
                                </div>
                                <div class="bar-track">
                                    <div class="bar-seg total" style="width: <?php echo e($pct); ?>%"></div>
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </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/students-info.blade.php ENDPATH**/ ?>