import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Github, Lock } from "lucide-react";
import Link from "next/link";
import { SubmitButton } from "../submit-button";
import { signInAction } from "@/actions/auth/sign-in";

export function LoginForm2({
  className,
  ...props
}: React.ComponentPropsWithoutRef<"form">) {
  return (
    <div>
      <div className="flex-1 flex items-center justify-center px-6">
        <div className="w-full max-w-xl space-y-8">
          <div className="flex flex-col gap-1">
            <h1 className="text-3xl font-bold tracking-tight text-white">
              Welcome back
            </h1>
            <p className="text-sm text-gray-400">Sign in to your account</p>
          </div>

          <div className="space-y-4">
            {/* <Button
              variant="outline"
              className="w-full bg-[#1C1C1C] text-white border-gray-800 hover:bg-[#2C2C2C] hover:border-gray-700"
              size="lg"
            >
              <Github className="mr-2 h-5 w-5" />
              Continue with GitHub
            </Button>*/}
            <Button
              variant="outline"
              className="w-full bg-[#1C1C1C] text-white border-gray-800 hover:bg-[#2C2C2C] hover:border-gray-700"
              size="lg"
            >
              <Lock className="mr-2 h-5 w-5" />
              Continue with SSO
            </Button>

            <div className="relative">
              <div className="absolute inset-0 flex items-center">
                <span className="w-full border-t border-gray-800" />
              </div>
              <div className="relative flex justify-center text-xs">
                <span className="bg-background px-2 text-gray-400">or</span>
              </div>
            </div>
          </div>

          <form className="space-y-4" {...props}>
            <div className="space-y-2">
              <Label htmlFor="email" className="text-sm text-gray-300">
                Email
              </Label>
              <Input
                id="email"
                type="email"
                name="email"
                placeholder="you@example.com"
                className="bg-[#1C1C1C] border-gray-800 text-white placeholder:text-gray-500 focus:border-emerald-600 focus:ring-emerald-600"
                required
              />
              <Link
                href="email-recovery"
                className="flex items-end justify-end text-xs text-gray-400 hover:text-emerald-500"
              >
                Forgot Email?
              </Link>
            </div>
            <div className="space-y-2">
              <div className="flex items-center justify-between">
                {/* <Label htmlFor="password" className="text-sm text-gray-300">
                  Password
                </Label> */}
                {/* <Link
                  href="#"
                  className="text-xs text-gray-400 hover:text-gray-300"
                >
                  Forgot Email?
                </Link> */}
              </div>
              {/* <Input
                id="password"
                type="password"
                className="bg-[#1C1C1C] border-gray-800 text-white focus:border-emerald-600 focus:ring-emerald-600"
                required
              /> */}
            </div>

            <SubmitButton
              className="w-full bg-emerald-600 hover:bg-emerald-700 text-white"
              size="lg"
              pendingText="Signing In..."
              formAction={signInAction}
            >
              Sign In
            </SubmitButton>
          </form>

          <div className="text-center text-lg">
            <span className="text-gray-400">Don't have an account? </span>
            <Link
              href="/contact-us"
              className="text-white hover:text-emerald-500"
            >
              Contact Us
            </Link>
          </div>

          <p className="text-center text-xs text-gray-400">
            By continuing, you agree to Sigap's{" "}
            <a href="#" className="text-gray-400 hover:text-white">
              Terms of Service
            </a>{" "}
            and{" "}
            <a href="#" className="text-gray-400 hover:text-white">
              Privacy Policy
            </a>
            , and to receive periodic emails with updates.
          </p>
        </div>
      </div>
    </div>
  );
}
