@extends('layouts.app')

@section('title', 'Register - TUNJUK-i')

@section('content')
<div class="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
    <div class="max-w-md w-full space-y-8 bg-white p-8 rounded-lg shadow-md">
        <div>
            <h2 class="text-center text-3xl font-extrabold text-[#0b2b4a]">
                TUNJUK-i
            </h2>
            <p class="mt-2 text-center text-sm text-gray-600">
                Daftar akun baru
            </p>
        </div>

        @if($errors->any())
            <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded">
                <ul>
                    @foreach($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <form method="POST" action="/api/auth/register" class="mt-8 space-y-6">
            @csrf

            <div class="rounded-md shadow-sm -space-y-px">
                <div>
                    <label for="name" class="sr-only">Nama</label>
                    <input id="name" name="name" type="text" required
                           class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-[#0b2b4a] focus:border-[#0b2b4a] focus:z-10 sm:text-sm"
                           placeholder="Nama Lengkap">
                </div>
                <div>
                    <label for="email" class="sr-only">Email</label>
                    <input id="email" name="email" type="email" required
                           class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-[#0b2b4a] focus:border-[#0b2b4a] focus:z-10 sm:text-sm"
                           placeholder="Email">
                </div>
                <div>
                    <label for="role" class="sr-only">Role</label>
                    <select id="role" name="role" required
                            class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-[#0b2b4a] focus:border-[#0b2b4a] focus:z-10 sm:text-sm">
                        <option value="contractor">Kontraktor OAP</option>
                        <option value="ppk">PPK</option>
                        <option value="agent">Agent</option>
                        <option value="bank">Bank</option>
                        <option value="auditor">Auditor</option>
                        <option value="admin">Admin</option>
                    </select>
                </div>
                <div>
                    <label for="password" class="sr-only">Password</label>
                    <input id="password" name="password" type="password" required
                           class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-[#0b2b4a] focus:border-[#0b2b4a] focus:z-10 sm:text-sm"
                           placeholder="Password (min 8 karakter)">
                </div>
            </div>

            <div>
                <button type="submit"
                        class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-[#0b2b4a] hover:bg-[#1a4a6e] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#0b2b4a]">
                    Register
                </button>
            </div>
        </form>

        <p class="text-center text-sm text-gray-600">
            Sudah punya akun?
            <a href="{{ route('login') }}" class="font-medium text-[#0b2b4a] hover:text-[#1a4a6e]">
                Login
            </a>
        </p>
    </div>
</div>
@endsection