"use client";

import { useTranslations } from "next-intl";
import Image from "next/image";
import { ReactNode } from "react";

export function AuthShell({
  children,
  wide = false,
}: {
  children: ReactNode;
  wide?: boolean;
}) {
  const t = useTranslations("auth");

  return (
    <div className="grid min-h-screen w-full grid-cols-12 overflow-hidden bg-background">
      <div
        className={`relative hidden flex-col items-center justify-center xl:flex ${
          wide ? "xl:col-span-5" : "xl:col-span-7"
        }`}
      >
        <Image
          src="/deliver-us-logo.png"
          alt="Deliver Us"
          width={220}
          height={48}
          className="relative z-10 mb-6 h-auto w-[220px]"
          priority
        />
        <h1 className="relative z-10 max-w-xl px-8 text-center text-[40px] font-bold leading-tight text-gray-800 2xl:text-[56px]">
          <span className="block">{t("heroLine1")}</span>
          <span className="block">{t("heroLine2")}</span>
          <span className="mt-1 block text-Base">{t("heroLine3")}</span>
        </h1>
        <p className="relative z-10 mt-4 max-w-md px-8 text-center text-base text-gray-700">
          {t("heroSubtitle")}
        </p>
        <Image
          src="/deskbg.jpg"
          alt=""
          fill
          priority
          className="object-cover object-center"
          sizes="50vw"
        />
        <div className="absolute inset-0 bg-white/55" />
      </div>

      <div
        className={`col-span-12 flex border-s ${
          wide
            ? "xl:col-span-7 items-stretch"
            : "xl:col-span-5 items-center justify-center"
        }`}
      >
        <div
          className={`w-full overflow-y-auto px-6 py-8 md:px-10 ${
            wide ? "max-w-4xl mx-auto" : "max-w-md"
          }`}
        >
          {children}
        </div>
      </div>
    </div>
  );
}
