import GuestLayout from '@/Layouts/GuestLayout';
import InputError from '@/Components/InputError';
import PrimaryButton from '@/Components/PrimaryButton';
import TextInput from '@/Components/TextInput';
import { Head, useForm } from '@inertiajs/react';

export default function ForgotPassword({ status }) {
    const { data, setData, post, processing, errors } = useForm({
        email: '',
    });

    const submit = (e) => {
        e.preventDefault();
        post(route('password.email'));
    };

    return (
        <GuestLayout>
            <Head title="Forgot Password" />

            {/* Background Container */}
            <div className="relative min-h-screen flex items-center justify-center bg-gradient-to-r from-blue-100 to-blue-400 overflow-hidden">
                
                {/* Circle Shapes using SVG */}
                <div className="absolute inset-0">
                    {/* Top-left Circle */}
                    <svg
                        className="absolute top-10 left-10 w-32 h-32 opacity-20"
                        xmlns="http://www.w3.org/2000/svg"
                        viewBox="0 0 200 200"
                    >
                        <circle cx="100" cy="100" r="80" fill="#ffffff" />
                    </svg>

                    {/* Bottom-right Circle */}
                    <svg
                        className="absolute bottom-10 right-10 w-40 h-40 opacity-20"
                        xmlns="http://www.w3.org/2000/svg"
                        viewBox="0 0 200 200"
                    >
                        <circle cx="100" cy="100" r="90" fill="#ffffff" />
                    </svg>

                    {/* Middle-left smaller circle */}
                    <svg
                        className="absolute top-1/3 left-20 w-16 h-16 opacity-30"
                        xmlns="http://www.w3.org/2000/svg"
                        viewBox="0 0 200 200"
                    >
                        <circle cx="100" cy="100" r="50" fill="#ffffff" />
                    </svg>

                    {/* Middle-right smaller circle */}
                    <svg
                        className="absolute bottom-1/3 right-32 w-20 h-20 opacity-25"
                        xmlns="http://www.w3.org/2000/svg"
                        viewBox="0 0 200 200"
                    >
                        <circle cx="100" cy="100" r="60" fill="#ffffff" />
                    </svg>
                </div>

                {/* Forgot Password Form */}
                <div className="bg-white shadow-lg rounded-2xl overflow-hidden w-full max-w-md p-8 relative z-10">
                    <h2 className="text-2xl font-bold text-gray-900 text-center">Reset Password</h2>
                    <p className="text-gray-600 text-center mb-6">
                        Enter your email address, and we'll send you a link to reset your password.
                    </p>

                    {status && <div className="mb-4 font-medium text-sm text-green-600 text-center">{status}</div>}

                    <form onSubmit={submit} className="space-y-4">
                        <div>
                            <TextInput
                                id="email"
                                type="email"
                                name="email"
                                value={data.email}
                                className="mt-1 block w-full"
                                isFocused={true}
                                onChange={(e) => setData('email', e.target.value)}
                                placeholder="Enter your email"
                            />
                            <InputError message={errors.email} className="mt-2" />
                        </div>

                        <div className="flex items-center justify-center mt-4">
                            <PrimaryButton className="w-full py-3 flex justify-center" disabled={processing}>
                                Send Reset Link
                            </PrimaryButton>
                        </div>
                    </form>
                </div>
            </div>
        </GuestLayout>
    );
}
