<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kartu Peserta PSAJ - {{ $participant['no_peserta'] }}</title>
    <style>
        @media print {
            body {
                margin: 0;
                padding: 0;
            }
            .no-print {
                display: none;
            }
            .print-button {
                display: none;
            }
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Arial', sans-serif;
            background: #f5f5f5;
            padding: 20px;
        }
        
        .container {
            max-width: 900px;
            margin: 0 auto;
        }
        
        .print-button {
            text-align: center;
            margin-bottom: 20px;
        }
        
        .btn-print {
            background: #007bff;
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }
        
        .btn-print:hover {
            background: #0056b3;
        }
        
        .btn-back {
            background: #6c757d;
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            margin-left: 10px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            text-decoration: none;
            display: inline-block;
        }
        
        .btn-back:hover {
            background: #5a6268;
        }
        
        .card-wrapper {
            background: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
        }
        
        .kartu-peserta {
            width: 100%;
            border: 3px solid #2c3e50;
            border-radius: 15px;
            padding: 30px;
            background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
            position: relative;
            overflow: hidden;
        }
        
        .kartu-peserta::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 8px;
            background: linear-gradient(90deg, #007bff 0%, #28a745 50%, #ffc107 100%);
        }
        
        .header-kartu {
            text-align: center;
            border-bottom: 3px solid #007bff;
            padding-bottom: 20px;
            margin-bottom: 30px;
        }
        
        .logo-area {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 20px;
            margin-bottom: 15px;
        }
        
        .logo {
            width: 80px;
            height: 80px;
            background: #007bff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 40px;
            font-weight: bold;
        }
        
        .header-kartu h1 {
            font-size: 28px;
            color: #2c3e50;
            margin: 10px 0;
            font-weight: bold;
            text-transform: uppercase;
        }
        
        .header-kartu h2 {
            font-size: 20px;
            color: #007bff;
            margin: 5px 0;
            font-weight: bold;
        }
        
        .header-kartu .school-name {
            font-size: 16px;
            color: #555;
            margin-top: 10px;
        }
        
        .body-kartu {
            display: flex;
            gap: 30px;
            margin-top: 30px;
        }
        
        .foto-peserta {
            flex-shrink: 0;
            width: 150px;
            text-align: center;
        }
        
        .foto-placeholder {
            width: 150px;
            height: 180px;
            border: 3px solid #007bff;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f8f9fa;
            font-size: 60px;
            color: #007bff;
            margin-bottom: 10px;
        }
        
        .no-peserta-badge {
            background: #007bff;
            color: white;
            padding: 8px 12px;
            border-radius: 5px;
            font-weight: bold;
            font-size: 14px;
            margin-top: 10px;
            word-break: break-all;
        }
        
        .data-peserta {
            flex-grow: 1;
        }
        
        .data-row {
            display: grid;
            grid-template-columns: 180px 10px 1fr;
            margin-bottom: 15px;
            align-items: start;
        }
        
        .data-label {
            font-weight: bold;
            color: #2c3e50;
            font-size: 15px;
        }
        
        .data-separator {
            color: #2c3e50;
        }
        
        .data-value {
            color: #555;
            font-size: 15px;
        }
        
        .footer-kartu {
            margin-top: 40px;
            padding-top: 20px;
            border-top: 2px solid #e0e0e0;
            text-align: center;
        }
        
        .footer-kartu p {
            color: #666;
            font-size: 13px;
            margin: 5px 0;
        }
        
        .qr-placeholder {
            width: 100px;
            height: 100px;
            border: 2px solid #ccc;
            margin: 15px auto;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            color: #999;
            text-align: center;
            padding: 10px;
        }
        
        .jenjang-badge {
            position: absolute;
            top: 40px;
            right: 40px;
            background: #28a745;
            color: white;
            padding: 10px 20px;
            border-radius: 20px;
            font-weight: bold;
            font-size: 16px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="print-button no-print">
            <button class="btn-print" onclick="window.print()">
                🖨️ Cetak Kartu Peserta
            </button>
            <a href="javascript:history.back()" class="btn-back">
                ← Kembali
            </a>
        </div>
        
        <div class="card-wrapper">
            <div class="kartu-peserta">
                <div class="jenjang-badge">{{ $jenjang }}</div>
                
                <div class="header-kartu">
                    <div class="logo-area">
                        <div class="logo">P</div>
                    </div>
                    <h1>KARTU PESERTA PSAJ</h1>
                    <h2>Program Satuan Pendidikan Anak Jalanan</h2>
                    @if($school)
                    <p class="school-name">{{ $school->name }}</p>
                    <p class="school-name" style="font-size: 14px; color: #777;">NPSN: {{ $school->npsn }}</p>
                    @endif
                </div>
                
                <div class="body-kartu">
                    <div class="foto-peserta">
                        <div class="foto-placeholder">
                            👤
                        </div>
                        <div class="no-peserta-badge">
                            {{ $participant['no_peserta'] }}
                        </div>
                    </div>
                    
                    <div class="data-peserta">
                        <div class="data-row">
                            <div class="data-label">NISN</div>
                            <div class="data-separator">:</div>
                            <div class="data-value">{{ $participant['nisn'] }}</div>
                        </div>
                        
                        <div class="data-row">
                            <div class="data-label">Nama Lengkap</div>
                            <div class="data-separator">:</div>
                            <div class="data-value">{{ $participant['nama_lengkap'] }}</div>
                        </div>
                        
                        <div class="data-row">
                            <div class="data-label">Jenjang</div>
                            <div class="data-separator">:</div>
                            <div class="data-value">{{ $jenjang }}</div>
                        </div>
                        
                        <div class="data-row">
                            <div class="data-label">Kelas</div>
                            <div class="data-separator">:</div>
                            <div class="data-value">{{ $participant['kelas'] }}</div>
                        </div>
                        
                        <div class="data-row">
                            <div class="data-label">Program</div>
                            <div class="data-separator">:</div>
                            <div class="data-value">{{ $participant['program'] }}</div>
                        </div>
                    </div>
                </div>
                
                <div class="footer-kartu">
                    <div class="qr-placeholder">
                        QR Code<br>
                        {{ $participant['no_peserta'] }}
                    </div>
                    <p><strong>Kartu ini adalah bukti resmi kepesertaan PSAJ</strong></p>
                    <p>Harap dibawa saat mengikuti kegiatan program</p>
                    <p style="margin-top: 15px; font-size: 12px;">Dicetak pada: {{ now()->isoFormat('dddd, D MMMM Y HH:mm') }}</p>
                </div>
            </div>
        </div>
    </div>
    
    <script>
        // Auto focus for better print experience
        window.onload = function() {
            // Optional: Auto print when page loads (uncomment if needed)
            // setTimeout(() => window.print(), 500);
        };
    </script>
</body>
</html>
