@extends('layouts.app')

@section('title', 'Lengkapi Dokumen Pengajuan Magang')

@section('content')
<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="glass-card p-4 p-md-5">
                <div class="d-flex align-items-center gap-3 mb-4 border-bottom pb-3">
                    <div class="nav-brand-icon bg-primary text-white" style="width: 48px; height: 48px; font-size: 1.5rem;">
                        <i class="fa-solid fa-file-arrow-up"></i>
                    </div>
                    <div>
                        <h4 class="fw-bold mb-1">Unggah Dokumen Persyaratan</h4>
                        <p class="text-muted mb-0 small">Selesaikan pendaftaran magang Anda ke instansi tujuan.</p>
                    </div>
                </div>

                <div class="alert alert-info border-0 rounded-3 small">
                    <strong>Instansi Tujuan:</strong> {{ $booking->instansi->nama ?? 'Instansi Pemerintahan' }}<br>
                    <strong>ID Booking:</strong> #{{ str_pad($booking->id, 5, '0', STR_PAD_LEFT) }}
                </div>

                <form action="{{ route('application.submit') }}" method="POST" enctype="multipart/form-data">
                    @csrf
                    <input type="hidden" name="booking_id" value="{{ $booking->id }}">

                    <div class="mb-4">
                        <label class="form-label-premium">1. Foto / Scan KTP Asli <span class="text-danger">*</span></label>
                        <input type="file" name="ktp_file" class="form-control form-control-premium" accept=".jpg,.jpeg,.png,.pdf" required>
                        <div class="form-text mt-1 text-muted small"><i class="fa-solid fa-info-circle"></i> Format JPG/PNG/PDF. Maksimal 2MB.</div>
                        @error('ktp_file')
                            <div class="text-danger mt-1 small">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="mb-4">
                        <label class="form-label-premium">2. Surat Permohonan / Pengantar Kampus <span class="text-danger">*</span></label>
                        <input type="file" name="surat_pengantar_file" class="form-control form-control-premium" accept=".pdf" required>
                        <div class="form-text mt-1 text-muted small"><i class="fa-solid fa-info-circle"></i> Wajib format PDF. Maksimal 5MB.</div>
                        @error('surat_pengantar_file')
                            <div class="text-danger mt-1 small">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="mb-4">
                        <label class="form-label-premium">3. Dokumen Persyaratan dari Kesbangpol <span class="text-danger">*</span></label>
                        <input type="file" name="dokumen_kesbangpol_file" class="form-control form-control-premium" accept=".pdf" required>
                        <div class="form-text mt-1 text-muted small"><i class="fa-solid fa-info-circle"></i> Surat pengantar / persetujuan dari Badan Kesbangpol. Wajib format PDF. Maksimal 5MB.</div>
                        @error('dokumen_kesbangpol_file')
                            <div class="text-danger mt-1 small">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="mb-4">
                        <label class="form-label-premium">4. Proposal Magang (Opsional)</label>
                        <input type="file" name="proposal_file" class="form-control form-control-premium" accept=".pdf">
                        <div class="form-text mt-1 text-muted small"><i class="fa-solid fa-info-circle"></i> Jika ada. Format PDF. Maksimal 10MB.</div>
                        @error('proposal_file')
                            <div class="text-danger mt-1 small">{{ $message }}</div>
                        @enderror
                    </div>

                    <div class="d-flex gap-3 mt-5 pt-3 border-top">
                        <a href="{{ route('absensi.index') }}" class="btn btn-premium-secondary flex-grow-1 text-center text-decoration-none">Batal</a>
                        <button type="submit" class="btn btn-premium-primary flex-grow-1">
                            <i class="fa-solid fa-paper-plane me-2"></i> Kirim Pengajuan
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
