<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Daftar Akun - Sistem Inventaris Sekretariat</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        body { font-family: 'Inter', sans-serif; }
        .form-container { animation: fadeIn 0.5s ease-in-out; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        /* Smooth scrolling */
        html { scroll-behavior: smooth; }
    </style>
</head>
<body class="bg-gray-50 text-gray-900 antialiased">

    <!-- Container Utama: Padding responsif -->
    <div class="min-h-screen w-full flex items-center justify-center p-4 sm:p-6 lg:p-8">
        
        <!-- Kartu Registrasi: Flex column di mobile, row di desktop. Tinggi otomatis menyesuaikan konten -->
        <div class="w-full max-w-6xl flex flex-col lg:flex-row bg-white rounded-2xl shadow-2xl overflow-hidden h-auto">
            
            <!-- Bagian Kiri (Branding): Tampil di atas pada mobile -->
            <div class="w-full lg:w-5/12 bg-gradient-to-br from-indigo-600 to-blue-700 p-8 md:p-12 flex flex-col items-center justify-center text-white text-center relative overflow-hidden min-h-[250px] lg:min-h-full order-first">
                <!-- Pattern Background -->
                <div class="absolute top-0 left-0 w-full h-full opacity-10 pointer-events-none">
                    <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg">
                        <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
                            <path d="M 40 0 L 0 0 0 40" fill="none" stroke="white" stroke-width="1"/>
                        </pattern>
                        <rect width="100%" height="100%" fill="url(#grid)" />
                    </svg>
                </div>

                <div class="relative z-10 my-auto flex flex-col items-center">
                    <div class="bg-white/10 backdrop-blur-sm p-4 lg:p-6 rounded-3xl mb-4 lg:mb-6 ring-1 ring-white/20 shadow-lg transition-transform hover:scale-105 duration-300">
                        <svg xmlns="http://www.w3.org/2000/svg" class="w-12 h-12 lg:w-20 lg:h-20 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="1.5">
                            <path stroke-linecap="round" stroke-linejoin="round" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
                        </svg>
                    </div>

                    <h1 class="text-2xl lg:text-3xl font-bold mb-2 lg:mb-3 leading-tight tracking-tight">Registrasi Akun</h1>
                    <p class="text-indigo-100 text-base lg:text-lg font-medium mb-4 lg:mb-6">Sistem Inventaris Daerah</p>
                    <p class="text-indigo-200 text-xs lg:text-sm max-w-xs mx-auto leading-relaxed hidden sm:block">
                        Bergabunglah untuk mendapatkan akses penuh dalam pengelolaan dan peminjaman aset sekretariat.
                    </p>
                </div>
            </div>

            <!-- Bagian Kanan (Form): Padding responsif -->
            <div class="w-full lg:w-7/12 p-6 sm:p-8 md:p-12 form-container bg-white flex flex-col justify-center">
                <div class="max-w-md mx-auto w-full">
                    <div class="mb-6 lg:mb-8 text-center lg:text-left">
                        <h2 class="text-2xl lg:text-3xl font-extrabold text-gray-900">Buat Akun Baru</h2>
                        <p class="text-gray-500 mt-2 text-sm lg:text-base">Silakan lengkapi formulir di bawah ini</p>
                    </div>

                    @if ($errors->any())
                        <div class="bg-red-50 border-l-4 border-red-500 text-red-700 p-4 rounded-r-md mb-6 text-sm animate-pulse" role="alert">
                            <div class="flex">
                                <svg class="h-5 w-5 text-red-500 mr-2 flex-shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
                                </svg>
                                <div>
                                    <p class="font-bold">Validasi Gagal</p>
                                    <ul class="list-disc list-inside mt-1">
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                        </div>
                    @endif

                    <form method="POST" action="{{ route('register') }}" class="space-y-4 lg:space-y-5">
                        @csrf
                        
                        <!-- Grid 1 Kolom di Mobile, 2 di Desktop -->
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-5">
                            <div>
                                <label for="name" class="block text-sm font-semibold text-gray-700 mb-1">Nama Lengkap</label>
                                <input type="text" id="name" name="name" value="{{ old('name') }}" required
                                    class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm lg:text-base"
                                    placeholder="Nama Anda">
                            </div>

                            <div>
                                <label for="email" class="block text-sm font-semibold text-gray-700 mb-1">Email Instansi</label>
                                <input type="email" id="email" name="email" value="{{ old('email') }}" required
                                    class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm lg:text-base"
                                    placeholder="nama@instansi.go.id">
                            </div>
                        </div>

                        <div>
                            <label for="divisi_id" class="block text-sm font-semibold text-gray-700 mb-1">Divisi / Bidang</label>
                            <div class="relative">
                                <select id="divisi_id" name="divisi_id" required
                                    class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white appearance-none text-sm lg:text-base">
                                    <option value="" disabled selected>-- Pilih Divisi Anda --</option>
                                    @isset($divisis)
                                        @foreach($divisis as $divisi)
                                            <option value="{{ $divisi->id }}" {{ old('divisi_id') == $divisi->id ? 'selected' : '' }}>
                                                {{ $divisi->nama }}
                                            </option>
                                        @endforeach
                                    @endisset
                                </select>
                                <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-4 text-gray-500">
                                    <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
                                </div>
                            </div>
                        </div>

                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4 lg:gap-5">
                            <div>
                                <label for="password" class="block text-sm font-semibold text-gray-700 mb-1">Password</label>
                                <input type="password" id="password" name="password" required
                                    class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm lg:text-base"
                                    placeholder="Min. 8 karakter">
                            </div>

                            <div>
                                <label for="password_confirmation" class="block text-sm font-semibold text-gray-700 mb-1">Konfirmasi Password</label>
                                <input type="password" id="password_confirmation" name="password_confirmation" required
                                    class="w-full px-4 py-2.5 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm lg:text-base"
                                    placeholder="Ulangi password">
                            </div>
                        </div>

                        <div class="pt-2">
                            <button type="submit"
                                class="w-full bg-indigo-600 text-white font-bold py-3 px-4 rounded-lg hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition transform active:scale-[0.98] shadow-md text-sm lg:text-base">
                                DAFTAR SEKARANG
                            </button>
                        </div>
                    </form>

                    <div class="text-center text-sm text-gray-600 mt-6 lg:mt-8 pt-4 lg:pt-6 border-t border-gray-100">
                        Sudah memiliki akun?
                        <a href="{{ route('login') }}" class="font-bold text-indigo-600 hover:text-indigo-500 hover:underline transition-colors ml-1">
                            Masuk di sini
                        </a>
                    </div>
                    
                    <div class="text-center text-xs text-gray-400 mt-6 pb-2 lg:hidden">
                        &copy; {{ date('Y') }} DP3APPKB Surabaya
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>