<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <title>Safety Result - {{ $izin->nama_tamu }}</title>
    <style>
        body {
            font-family: DejaVu Sans, sans-serif;
            background-color: #f1f5f9; /* slate-100 */
            padding: 20px;
        }
        .card {
            background: #ffffff;
            border-radius: 12px;
            padding: 24px;
            max-width: 800px;
            margin: 0 auto;
            box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        }
        h2 {
            font-size: 22px;
            font-weight: bold;
            color: #0e7490; /* cyan-700 */
            margin-bottom: 20px;
            text-align: center;
        }
        .detail p {
            margin: 6px 0;
            color: #374151; /* gray-700 */
            font-size: 14px;
        }
        .score {
            margin: 12px 0;
            font-size: 16px;
            font-weight: bold;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 16px;
            font-size: 14px;
        }
        th, td {
            border: 1px solid #e5e7eb; /* gray-200 */
            padding: 8px 10px;
            text-align: left;
        }
        th {
            background-color: #f9fafb; /* gray-50 */
            color: #374151;
        }
        .badge {
            display: inline-block;
            padding: 4px 10px;
            font-size: 12px;
            font-weight: bold;
            border-radius: 6px;
        }
        .yes {
            background: #d1fae5; /* green-100 */
            color: #065f46; /* green-800 */
        }
        .no {
            background: #fee2e2; /* red-100 */
            color: #991b1b; /* red-800 */
        }
    </style>
</head>
<body>
    <div class="card">
        <h2>📋 Hasil Safety Induction</h2>

        <div class="detail">
            <p><strong>Nama Tamu:</strong> {{ $izin->nama_tamu }}</p>
            <p><strong>Perusahaan:</strong> {{ $izin->perusahaan }}</p>
            <p><strong>Dept. Tujuan:</strong> {{ $izin->yang_ditemui }}</p>
            <p><strong>User Ditemui:</strong> {{ $izin->user_ditemui }}</p>
            <p><strong>Lokasi Penerimaan:</strong> {{ $izin->lokasi_penerimaan }}</p>
            <p><strong>Status:</strong> {{ ucfirst($izin->status_hadir) }}</p>
            <p class="score"><strong>Score:</strong> {{ $izin->safety_score ?? 0 }}%</p>
        </div>

        <h3>Detail Jawaban:</h3>
        <table>
            <thead>
                <tr>
                    <th>No</th>
                    <th>Pertanyaan</th>
                    <th>Jawaban</th>
                </tr>
            </thead>
            <tbody>
                @foreach($hasil as $index => $row)
                    <tr>
                        <td>{{ $index+1 }}</td>
                        <td>{{ $row['pertanyaan'] }}</td>
                        <td>
                            <span class="badge {{ $row['jawaban'] == 'Mengerti' ? 'yes' : 'no' }}">
                                {{ $row['jawaban'] }}
                            </span>
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
</body>
</html>
