import { Link } from '@inertiajs/react';
import { home } from '@/routes';
import type { AuthLayoutProps } from '@/types';

const logoMP = '/images/logos/mp.png';

export default function AuthSimpleLayout({
    children,
    title,
    description,
}: AuthLayoutProps) {
    return (
        <div className="flex min-h-svh flex-col items-center justify-center bg-background p-6 md:p-10">
            <div className="w-full max-w-sm">
                <div className="flex flex-col gap-8">
                    <div className="flex flex-col items-center gap-6">
                        <Link
                            href={home()}
                            className="flex w-full flex-col items-center font-medium"
                        >
                            <div className="flex w-full items-center justify-center rounded-xl bg-sidebar px-6 py-5 shadow-sm">
                                <img
                                    src={logoMP}
                                    alt="Ministerio Público de Guatemala"
                                    className="h-32 w-auto max-w-full object-contain"
                                />
                            </div>

                            <span className="sr-only">
                                Ministerio Público de Guatemala
                            </span>
                        </Link>

                        <div className="space-y-2 text-center">
                            <h1 className="text-xl font-semibold">{title}</h1>

                            <p className="text-sm text-muted-foreground">
                                {description}
                            </p>
                        </div>
                    </div>

                    {children}
                </div>
            </div>
        </div>
    );
}