@extends('layouts.marketing')

@section('title', __('auth.register'))

@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">
        <div>
            <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
                {{ __('auth.register') }}
            </h2>
            @if($package ?? false)
                <div class="mt-4 p-4 bg-blue-50 border border-blue-200 rounded-md">
                    <h3 class="text-lg font-semibold text-blue-900 mb-2">{{ $package->name }}</h3>
                    <p class="text-blue-800 mb-2">{{ $package->description }}</p>
                    <p class="text-sm text-blue-700">
                        {{ $package->price == 0 ? __('marketing.register.free') : $package->price . ' ' . __('currency.euro') }}
                    </p>
                </div>
            @endif
        </div>
        <form class="mt-8 space-y-6" action="{{ route('register.store') }}" method="POST">
            @csrf
            @if($package ?? false)
                <input type="hidden" name="package_id" value="{{ $package->id }}">
            @endif

            <!-- Username Field -->
            <div>
                <label for="username" class="block text-sm font-medium text-gray-700">
                    {{ __('auth.username') }}
                </label>
                <input id="username" name="username" type="text" required
                       value="{{ old('username') }}"
                       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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('username') border-red-500 @enderror"
                       placeholder="{{ __('auth.username_placeholder') }}">
                @error('username')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Email Field -->
            <div>
                <label for="email" class="block text-sm font-medium text-gray-700">
                    {{ __('auth.email') }}
                </label>
                <input id="email" name="email" type="email" required
                       value="{{ old('email') }}"
                       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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('email') border-red-500 @enderror"
                       placeholder="{{ __('auth.email_placeholder') }}">
                @error('email')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Password Field -->
            <div>
                <label for="password" class="block text-sm font-medium text-gray-700">
                    {{ __('auth.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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('password') border-red-500 @enderror"
                       placeholder="{{ __('auth.password_placeholder') }}">
                @error('password')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Confirm Password Field -->
            <div>
                <label for="password_confirmation" class="block text-sm font-medium text-gray-700">
                    {{ __('auth.confirm_password') }}
                </label>
                <input id="password_confirmation" name="password_confirmation" 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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
                       placeholder="{{ __('auth.confirm_password_placeholder') }}">
            </div>

            <!-- First Name Field -->
            <div>
                <label for="first_name" class="block text-sm font-medium text-gray-700">
                    {{ __('profile.first_name') }}
                </label>
                <input id="first_name" name="first_name" type="text" required
                       value="{{ old('first_name') }}"
                       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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('first_name') border-red-500 @enderror"
                       placeholder="{{ __('profile.first_name_placeholder') }}">
                @error('first_name')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Last Name Field -->
            <div>
                <label for="last_name" class="block text-sm font-medium text-gray-700">
                    {{ __('profile.last_name') }}
                </label>
                <input id="last_name" name="last_name" type="text" required
                       value="{{ old('last_name') }}"
                       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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('last_name') border-red-500 @enderror"
                       placeholder="{{ __('profile.last_name_placeholder') }}">
                @error('last_name')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Address Field -->
            <div>
                <label for="address" class="block text-sm font-medium text-gray-700">
                    {{ __('profile.address') }}
                </label>
                <textarea id="address" name="address" required rows="3"
                          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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('address') border-red-500 @enderror">{{ old('address') }}</textarea>
                @error('address')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Phone Field -->
            <div>
                <label for="phone" class="block text-sm font-medium text-gray-700">
                    {{ __('profile.phone') }}
                </label>
                <input id="phone" name="phone" type="tel" required
                       value="{{ old('phone') }}"
                       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-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm @error('phone') border-red-500 @enderror"
                       placeholder="{{ __('profile.phone_placeholder') }}">
                @error('phone')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Privacy Consent -->
            <div class="flex items-start">
                <div class="flex items-center h-5">
                    <input id="privacy_consent" name="privacy_consent" type="checkbox" required
                           class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded @error('privacy_consent') border-red-500 @enderror">
                </div>
                <div class="ml-3 text-sm">
                    <label for="privacy_consent" class="font-medium text-gray-700">
                        {{ __('auth.privacy_consent') }}
                        <a href="{{ route('datenschutz') }}" class="text-blue-600 hover:text-blue-500">{{ __('auth.privacy_policy') }}</a>.
                    </label>
                    @error('privacy_consent')
                        <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                    @enderror
                </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-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 transition duration-300">
                    {{ __('auth.register') }}
                </button>
            </div>

            <div class="text-center">
                <p class="text-sm text-gray-600">
                    {{ __('auth.have_account') }}
                    <a href="{{ route('login') }}" class="font-medium text-blue-600 hover:text-blue-500">
                        {{ __('auth.login') }}
                    </a>
                </p>
            </div>
        </form>
    </div>
</div>
@endsection