import type { Metadata } from "next";
import Link from "next/link";
import { SitePage } from "@/app/(site)/_components/SitePage";
import { SiteHeader } from "@/app/(site)/_components/SiteHeader";
import { SiteFooter } from "@/app/(site)/_components/SiteFooter";
import { LoginError, LoginForm, LoginSubmit } from "@/app/(site)/_components/LoginForm";

export const metadata: Metadata = {
  title: "Login — Unionists Group",
};

export default function Page() {
  return (
    <SitePage>
      <a className="skip-link" href="#main">
        Skip to main content
      </a>{" "}
      <SiteHeader accountCurrent />
      <main id="main" className="login-page-main">
        <div className="auth-page-grid grid grid-cols-1 lg:grid-cols-2 min-h-[min(640px,calc(100vh-57px))]">
          {/* Globe panel */}
          <div className="auth-globe-panel relative overflow-hidden lg:min-h-[320px]">
            <img
              src="/assets/images/globe-bg.png"
              alt=""
              className="absolute inset-0 w-full h-full object-cover object-center login-globe-image"
              width="885"
              height="1024"
              fetchPriority="high"
              decoding="async"
            />
          </div>
          {/* Login form panel */}
          <div className="flex flex-col items-center justify-center px-6 py-12 md:px-12 lg:px-16 bg-white">
            <div className="w-full max-w-[400px] login-form-panel" data-reveal="">
              <h1 className="text-[clamp(22px,2.8vw,26px)] font-bold text-ink mb-2 leading-snug">
                Login In To Your Account
              </h1>
              <p className="text-[14px] text-[#2E2E2E] mb-8 leading-[1.55]">
                Access Your Global Trade Intelligence Network Securely.
              </p>
              <LoginForm id="login-form" className="flex flex-col gap-[14px]">
                <input
                  type="email"
                  name="email"
                  placeholder="Enter Email"
                  autoComplete="email"
                  required
                  className="login-input-light w-full px-4 py-[13px] rounded-[6px] text-sm text-ink outline-none"
                />{" "}
                <div className="relative">
                  <input
                    type="password"
                    id="login-pwd"
                    name="password"
                    placeholder="Enter Password"
                    autoComplete="current-password"
                    required
                    className="login-input-light w-full px-4 py-[13px] pr-11 rounded-[6px] text-sm text-ink outline-none"
                  />{" "}
                  <button
                    type="button"
                    data-legacy-onclick="togglePwd('login-pwd', this)"
                    aria-label="Toggle password"
                    className="absolute right-[13px] top-1/2 -translate-y-1/2 text-[#9aa3b0] hover:text-[#3c4554] transition-colors"
                  >
                    {" "}
                    <svg
                      className="eye-open w-[18px] h-[18px]"
                      fill="none"
                      viewBox="0 0 24 24"
                      stroke="currentColor"
                      strokeWidth="1.7"
                    >
                      <path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
                      <path
                        strokeLinecap="round"
                        strokeLinejoin="round"
                        d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
                      ></path>
                    </svg>{" "}
                    <svg
                      className="eye-closed hidden w-[18px] h-[18px]"
                      fill="none"
                      viewBox="0 0 24 24"
                      stroke="currentColor"
                      strokeWidth="1.7"
                    >
                      <path
                        strokeLinecap="round"
                        strokeLinejoin="round"
                        d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88L6.59 6.59m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
                      ></path>
                    </svg>{" "}
                  </button>
                </div>
                <div className="flex justify-end -mt-1">
                  <Link href="/forgot-password" className="text-[13px] font-medium hover:underline text-[#13836f]">
                    Recover Password ?
                  </Link>
                </div>
<LoginError className="text-[13px] leading-[1.5] text-[#d3365a] -mt-1" />
                <LoginSubmit
                  type="submit"
                  className="btn w-full py-[13px] mt-1 text-white font-bold text-[13px] tracking-[0.1em] uppercase rounded-[6px] border-[1.5px] border-transparent bg-[#1f63d6] transition-all duration-[180ms] hover:bg-[#194fab] hover:-translate-y-px"
                >
                  {" "}
                  Login{" "}
                </LoginSubmit>{" "}
                <div className="login-divider flex items-center gap-3 my-2">
                  <span className="flex-1 h-px bg-[#e2e8f0]"></span>{" "}
                  <span className="text-[12px] text-[#9aa3b0] whitespace-nowrap">Or continue with</span>{" "}
                  <span className="flex-1 h-px bg-[#e2e8f0]"></span>
                </div>
                <div className="grid grid-cols-3 gap-3">
                  <button type="button" className="social-login-btn" aria-label="Continue with Google">
                    {" "}
                    <svg className="w-5 h-5" viewBox="0 0 24 24" aria-hidden="true">
                      <path
                        fill="#4285F4"
                        d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
                      ></path>
                      <path
                        fill="#34A853"
                        d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
                      ></path>
                      <path
                        fill="#FBBC05"
                        d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
                      ></path>
                      <path
                        fill="#EA4335"
                        d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
                      ></path>
                    </svg>{" "}
                  </button>{" "}
                  <button type="button" className="social-login-btn" aria-label="Continue with Apple">
                    {" "}
                    <svg className="w-5 h-5 text-ink" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
                      <path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"></path>
                    </svg>{" "}
                  </button>{" "}
                  <button type="button" className="social-login-btn" aria-label="Continue with Facebook">
                    {" "}
                    <svg className="w-5 h-5" viewBox="0 0 24 24" fill="#1877F2" aria-hidden="true">
                      <path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"></path>
                    </svg>{" "}
                  </button>
                </div>
                <p className="text-[13px] text-center mt-4 text-[#2E2E2E]">
                  Don&apos;t have an account?{" "}
                  <Link href="/signup" className="font-medium hover:underline text-[#13836f]">
                    Signup
                  </Link>
                </p>
              </LoginForm>
              <p className="text-center mt-5">
                <Link
                  href="/login-alt"
                  className="login-screen-switch text-[11px] font-medium tracking-[0.04em] text-[#9aa3b0] hover:text-[#13836f] hover:underline transition-colors"
                >
                  {" "}
                  Login screen 1 →{" "}
                </Link>
              </p>
            </div>
          </div>
        </div>
      </main>
      <SiteFooter />
    </SitePage>
  );
}
