<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Riwayat Data - PCR Health</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body class="bg-slate-50 text-slate-900 font-sans leading-normal tracking-normal">

    <nav class="bg-white shadow-sm border-b border-slate-200 sticky top-0 z-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16 items-center">
                <div class="flex items-center gap-2">
                    <div class="bg-blue-600 p-1.5 rounded-lg text-white">
                        <i class="fas fa-utensils text-sm md:text-base"></i>
                    </div>
                    <span class="text-lg md:text-xl font-extrabold tracking-tight text-slate-800">PCR<span class="text-blue-600">Health</span></span>
                </div>
                
                <div class="flex items-center space-x-3 md:space-x-4">
                    <a href="/" class="text-xs md:text-sm font-medium text-slate-600 transition">Form</a>
                    <a href="<?php echo e(route('history')); ?>" class="text-xs md:text-sm font-bold text-blue-600 transition">Riwayat</a>

                    <?php if(auth()->guard()->check()): ?>
                        <form action="<?php echo e(route('logout')); ?>" method="POST" class="inline">
                            <?php echo csrf_field(); ?>
                            <button type="submit" class="text-xs md:text-sm font-medium text-red-600 transition">
                                <i class="fas fa-sign-out-alt"></i> <span class="hidden sm:inline">Logout</span>
                            </button>
                        </form>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </nav>

    <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 md:py-10">
        
        <div class="mb-8 flex flex-col md:flex-row md:justify-between md:items-end gap-4 text-center md:text-left">
            <div>
                <h1 class="text-2xl md:text-3xl font-black text-slate-800 italic">Riwayat Analisis</h1>
                <p class="text-xs md:text-sm text-slate-500">Kumpulan data pola makan Anda yang tersimpan di sistem.</p>
            </div>
            <div class="bg-blue-50 px-4 py-2 rounded-2xl border border-blue-100 self-center md:self-end">
                <p class="text-[10px] font-bold text-blue-600 uppercase tracking-widest">Total Record</p>
                <p class="text-lg md:text-xl font-black text-blue-800"><?php echo e($data->count()); ?></p>
            </div>
        </div>

        <div class="hidden md:block bg-white rounded-3xl shadow-xl shadow-slate-200 border border-slate-100 overflow-hidden">
            <table class="w-full text-left border-collapse">
                <thead class="bg-slate-50 border-b border-slate-100">
                    <tr>
                        <th class="px-6 py-4 text-[10px] font-bold text-slate-500 uppercase tracking-widest text-left">Mahasiswa</th>
                        <th class="px-6 py-4 text-[10px] font-bold text-slate-500 uppercase tracking-widest text-center">Hasil AI</th>
                        <th class="px-6 py-4 text-[10px] font-bold text-slate-500 uppercase tracking-widest">Saran Rekomendasi</th>
                        <th class="px-6 py-4 text-[10px] font-bold text-slate-500 uppercase tracking-widest text-center">Tanggal</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-slate-100">
                    <?php $__empty_1 = true; $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr class="hover:bg-slate-50/50 transition">
                        <td class="px-6 py-4">
                            <p class="font-bold text-slate-800 text-sm"><?php echo e($item->nama); ?></p>
                            <p class="text-[10px] text-slate-400 font-mono"><?php echo e($item->nim); ?></p>
                        </td>
                        <td class="px-6 py-4 text-center">
                            <span class="px-3 py-1 rounded-full text-[10px] font-black uppercase
                                <?php echo e($item->label_hasil == 'Teratur' ? 'bg-green-100 text-green-700' : 
                                   ($item->label_hasil == 'Berantakan' ? 'bg-red-100 text-red-700' : 'bg-yellow-100 text-yellow-700')); ?>">
                                <?php echo e($item->label_hasil); ?>

                            </span>
                        </td>
                        <td class="px-6 py-4">
                            <p class="text-xs text-slate-600 leading-relaxed italic max-w-sm">
                                <i class="fas fa-quote-left text-blue-200 mr-1 text-[10px]"></i>
                                <?php echo e($item->rekomendasi ?? 'Tetap jaga kesehatan Anda.'); ?>

                            </p>
                        </td>
                        <td class="px-6 py-4 text-center text-[10px] text-slate-400">
                            <?php echo e($item->created_at->format('d M Y')); ?><br>
                            <span class="opacity-60"><?php echo e($item->created_at->format('H:i')); ?> WIB</span>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <?php endif; ?>
                </tbody>
            </table>
        </div>

        <div class="md:hidden space-y-4">
            <?php $__empty_1 = true; $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <div class="bg-white p-5 rounded-2xl shadow-md border border-slate-100">
                <div class="flex justify-between items-start mb-4">
                    <div>
                        <h3 class="font-bold text-slate-800"><?php echo e($item->nama); ?></h3>
                        <p class="text-xs text-slate-400 font-mono"><?php echo e($item->nim); ?></p>
                    </div>
                    <span class="px-2 py-1 rounded-lg text-[9px] font-black uppercase
                        <?php echo e($item->label_hasil == 'Teratur' ? 'bg-green-100 text-green-700' : 
                           ($item->label_hasil == 'Berantakan' ? 'bg-red-100 text-red-700' : 'bg-yellow-100 text-yellow-700')); ?>">
                        <?php echo e($item->label_hasil); ?>

                    </span>
                </div>
                
                <div class="bg-slate-50 p-3 rounded-xl border border-slate-100 mb-3">
                    <p class="text-[10px] font-bold text-blue-600 uppercase mb-1"><i class="fas fa-magic mr-1"></i> Saran AI:</p>
                    <p class="text-xs text-slate-600 italic leading-relaxed">
                        "<?php echo e($item->rekomendasi ?? 'Saran tidak tersedia.'); ?>"
                    </p>
                </div>
                
                <div class="flex justify-between items-center text-[10px] text-slate-400">
                    <span><i class="far fa-calendar-alt mr-1"></i> <?php echo e($item->created_at->format('d/m/Y')); ?></span>
                    <span><i class="far fa-clock mr-1"></i> <?php echo e($item->created_at->format('H:i')); ?> WIB</span>
                </div>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <div class="p-10 text-center bg-white rounded-3xl border border-dashed border-slate-200">
                <i class="fas fa-folder-open text-4xl text-slate-200 mb-3"></i>
                <p class="text-slate-400 text-sm">Belum ada riwayat data.</p>
                <a href="/" class="text-blue-600 text-xs font-bold mt-2 block underline">Isi Form Sekarang</a>
            </div>
            <?php endif; ?>
        </div>

        <footer class="mt-10 text-center">
            <p class="text-[10px] md:text-xs text-slate-400">© 2026 PCR Health - Sistem Analisis Pola Makan Berbasis AI.</p>
        </div>
    </main>

</body>
</html><?php /**PATH D:\Aplikasi\Laragon\laragon-6.0-minimal\www\ai-apps\resources\views/history.blade.php ENDPATH**/ ?>