@extends('layouts.marketing')

@section('title', __('profile.title'))

@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">
                {{ __('profile.title') }}
            </h2>
        </div>
        <form class="mt-8 space-y-6" action="{{ route('profile.update') }}" method="POST">
            @csrf
            @method('PATCH')

            <!-- First Name -->
            <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', $user->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 -->
            <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', $user->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 -->
            <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', $user->address) }}</textarea>
                @error('address')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </div>

            <!-- Phone -->
            <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', $user->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>

            <!-- Password -->
            <div>
                <label for="password" class="block text-sm font-medium text-gray-700">
                    {{ __('profile.password') }}
                </label>
                <input id="password" name="password" type="password"
                       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('password') border-red-500 @enderror"
                       placeholder="{{ __('profile.password_placeholder') }}">
                @error('password')
                    <p class="mt-1 text-sm text-red-600">{{ $message }}</p>
                @enderror
            </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">
                    {{ __('profile.save') }}
                </button>
            </div>

            <div class="text-center">
                <p class="text-sm text-gray-600">
                    {{ __('profile.delete_account') }} <a href="#" class="text-red-600 hover:text-red-500">{{ __('profile.delete') }}</a>
                </p>
            </div>
        </form>
    </div>
</div>
@endsection