<!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->nama }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        @media print {
            .no-print {
                display: none;
            }
            .card {
                page-break-inside: avoid;
            }
        }

        body {
            background-color: #f5f5f5;
            padding: 20px;
        }

        .kartu-container {
            max-width: 400px;
            margin: 0 auto;
        }

        .kartu-card {
            background: white;
            border: 2px solid #333;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        }

        .header-kartu {
            text-align: center;
            border-bottom: 3px solid #007bff;
            padding-bottom: 15px;
            margin-bottom: 20px;
        }

        .header-kartu h2 {
            color: #007bff;
            font-size: 20px;
            font-weight: bold;
            margin: 10px 0;
        }

        .header-kartu h3 {
            font-size: 16px;
            margin: 5px 0;
        }

        .foto-container {
            text-align: center;
            margin: 20px 0;
        }

        .foto-peserta {
            width: 100px;
            height: 130px;
            object-fit: cover;
            border: 2px solid #333;
            border-radius: 5px;
        }

        .foto-placeholder {
            width: 100px;
            height: 130px;
            background: #e9ecef;
            border: 2px dashed #999;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: #999;
        }

        .info-row {
            margin: 10px 0;
            font-size: 14px;
        }

        .info-label {
            font-weight: bold;
            display: inline-block;
            width: 120px;
        }

        .no-peserta {
            background: #007bff;
            color: white;
            padding: 8px;
            text-align: center;
            font-weight: bold;
            border-radius: 5px;
            margin: 15px 0;
        }

        .footer-kartu {
            margin-top: 20px;
            padding-top: 15px;
            border-top: 2px solid #ddd;
            text-align: center;
            font-size: 11px;
        }

        .jenjang-badge {
            background: #28a745;
            color: white;
            padding: 5px 15px;
            border-radius: 15px;
            display: inline-block;
            margin: 10px 0;
        }
    </style>
</head>
<body>
    <!-- Print Button -->
    <div class="no-print text-center mb-3">
        <button onclick="window.print()" class="btn btn-primary">
            <i class="bi bi-printer"></i> Cetak Kartu
        </button>
        <a href="{{ route('admin-sekolah.psaj.show', $participant->id) }}" class="btn btn-secondary">
            Kembali
        </a>
    </div>

    <!-- Card -->
    <div class="kartu-container">
        <div class="kartu-card">
            <!-- Header -->
            <div class="header-kartu">
                <div style="font-weight: bold; font-size: 12px;">KEMENTERIAN PENDIDIKAN, KEBUDAYAAN, RISET, DAN TEKNOLOGI</div>
                <h3>{{ strtoupper($school->nama_sekolah) }}</h3>
                @if($school->alamat)
                    <div style="font-size: 11px;">{{ $school->alamat }}</div>
                @endif
                <h2>KARTU PESERTA PSAJ</h2>
                <div class="jenjang-badge">{{ $participant->jenjang }}</div>
            </div>

            <!-- Nomor Peserta -->
            <div class="no-peserta">
                {{ $participant->no_peserta }}
            </div>

            <!-- Foto -->
            <div class="foto-container">
                @if ($participant->photo)
                    <img src="{{ asset('storage/' . $participant->photo) }}" alt="Foto" class="foto-peserta">
                @else
                    <div class="foto-placeholder">
                        Foto<br>3x4
                    </div>
                @endif
            </div>

            <!-- Info Peserta -->
            <div class="info-row">
                <span class="info-label">Nama</span>: {{ $participant->nama }}
            </div>
            <div class="info-row">
                <span class="info-label">NISN</span>: {{ $participant->nisn }}
            </div>
            <div class="info-row">
                <span class="info-label">NIK</span>: {{ $participant->nik }}
            </div>
            <div class="info-row">
                <span class="info-label">Tempat/Tgl Lahir</span>: {{ $participant->tempat_lahir }}, {{ $participant->tanggal_lahir->format('d-m-Y') }}
            </div>
            <div class="info-row">
                <span class="info-label">Kelas</span>: {{ $participant->kelas }}
            </div>
            <div class="info-row">
                <span class="info-label">Ketunaan</span>: {{ $participant->disabilityType->name }}
            </div>

            <!-- Footer -->
            <div class="footer-kartu">
                <div style="margin-bottom: 50px;"></div>
                <div>
                    <strong>Kepala Sekolah</strong><br><br><br>
                    <div style="border-top: 1px solid #333; display: inline-block; min-width: 200px; padding-top: 5px;">
                        ( ......................................................... )
                    </div>
                </div>
                <div style="margin-top: 15px; font-size: 10px; color: #666;">
                    Kartu ini adalah bukti resmi kepesertaan PSAJ (Penilaian Sumatif Akhir Jenjang) {{ date('Y') }}
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
