import type { Metadata } from "next";
import Link from "next/link";
import { SitePage } from "@/app/(site)/_components/SitePage";

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

export default function Page() {
  return (
    <SitePage className="signup-page">
      {/* ── Header ───────────────────────────────────────────────── */}
      <header
        className="site-header flex items-center justify-between px-7 py-[14px] border-b shrink-0 z-10"
        style={{ borderColor: "rgba(255,255,255,0.08)" }}
      >
        <Link
          href="/"
          className="text-white font-black text-[19px] tracking-[0.01em] hover:opacity-90 transition-opacity"
        >
          {" "}
          Unionists{" "}
        </Link>{" "}
        <Link
          href="/login"
          className="text-white text-[12px] font-bold tracking-[0.08em] uppercase px-[18px] py-[7px] rounded transition-all hover:bg-white/10"
          style={{ border: "1.5px solid #00FFC7" }}
        >
          {" "}
          LOGIN{" "}
        </Link>
      </header>
      {/* ── Main split layout ─────────────────────────────────────── */}
      <div className="auth-page-layout flex flex-1 flex-col lg:flex-row">
        {/* Left: globe image panel */}
        <div className="auth-globe-panel relative overflow-hidden shrink-0">
          <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>
        {/* Right: signup form panel */}
        <div className="auth-form-panel flex-1 flex flex-col items-center justify-center px-8 lg:px-16 bg-geometric-navy">
          {/* Step indicator dots */}
          <div className="auth-step-indicator flex gap-2 mb-7">
            <div
              id="dot-1"
              className="h-[6px] rounded-full transition-all duration-300"
              style={{ width: "28px", background: "#00FFC7" }}
            ></div>
            <div
              id="dot-2"
              className="h-[6px] rounded-full transition-all duration-300"
              style={{ width: "6px", background: "rgba(255,255,255,0.2)" }}
            ></div>
          </div>
          <div className="w-full max-w-[380px] relative">
            {/* ── Step 1: Account Info ─────────────────────────────── */}
            <div id="step1" className="step active-step">
              <h1 className="text-white text-[21px] font-bold text-center mb-[10px] leading-snug">
                Create Your Unionists Account
              </h1>
              <p className="text-center text-[13px] mb-7 leading-[1.55] text-white">
                Join the Unionists global trade ecosystem.
              </p>
              <form
                id="form-step1"
                className="signup-form flex flex-col gap-[13px]"
                data-legacy-onsubmit="goToStep2(event)"
              >
                <input
                  type="text"
                  name="fullname"
                  placeholder="Enter your full name"
                  autoComplete="name"
                  required
                  className="w-full px-4 py-[13px] rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                  style={{ background: "#0d2a58" }}
                />{" "}
                <input
                  type="email"
                  name="email"
                  placeholder="Enter your email"
                  autoComplete="email"
                  required
                  className="w-full px-4 py-[13px] rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                  style={{ background: "#0d2a58" }}
                />{" "}
                {/* Password */}{" "}
                <div className="relative">
                  <input
                    type="password"
                    id="pwd1"
                    name="password"
                    placeholder="Create Password"
                    autoComplete="new-password"
                    required
                    minLength={8}
                    className="w-full px-4 py-[13px] pr-11 rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                    style={{ background: "#0d2a58" }}
                  />{" "}
                  <button
                    type="button"
                    data-legacy-onclick="togglePwd('pwd1', this)"
                    aria-label="Show password"
                    className="absolute right-[13px] top-1/2 -translate-y-1/2 transition-colors"
                    style={{ color: "rgba(255,255,255,0.35)" }}
                    data-legacy-onmouseover="this.style.color='rgba(255,255,255,0.7)'"
                    data-legacy-onmouseout="this.style.color='rgba(255,255,255,0.35)'"
                  >
                    {" "}
                    <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>
                {/* Confirm Password */}
                <div className="relative">
                  <input
                    type="password"
                    id="pwd2"
                    name="confirm_password"
                    placeholder="Confirm Password"
                    autoComplete="new-password"
                    required
                    className="w-full px-4 py-[13px] pr-11 rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                    style={{ background: "#0d2a58" }}
                  />{" "}
                  <button
                    type="button"
                    data-legacy-onclick="togglePwd('pwd2', this)"
                    aria-label="Show confirm password"
                    className="absolute right-[13px] top-1/2 -translate-y-1/2 transition-colors"
                    style={{ color: "rgba(255,255,255,0.35)" }}
                    data-legacy-onmouseover="this.style.color='rgba(255,255,255,0.7)'"
                    data-legacy-onmouseout="this.style.color='rgba(255,255,255,0.35)'"
                  >
                    {" "}
                    <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>
                <p id="pwd-error" className="text-red-400 text-[12px] hidden -mt-1">
                  Passwords do not match.
                </p>{" "}
                <button
                  type="submit"
                  className="w-full py-[13px] mt-2 text-white font-bold text-[13px] tracking-[0.1em] uppercase rounded
                           transition-all duration-150 active:scale-[0.99]"
                  style={{ background: "#1f63d6" }}
                  data-legacy-onmouseover="this.style.background='#194fab'"
                  data-legacy-onmouseout="this.style.background='#1f63d6'"
                >
                  {" "}
                  CONTINUE{" "}
                </button>{" "}
                <p className="text-[12px] text-center mt-1 text-white">
                  Already have an account?{" "}
                  <Link href="/login" className="hover:underline font-medium" style={{ color: "#00FFC7" }}>
                    Login
                  </Link>
                </p>
              </form>
            </div>
            {/* ── Step 2: Business Info ───────────────────────────── */}
            <div id="step2" className="step hidden-step">
              <h1 className="text-white text-[21px] font-bold text-center mb-[10px] leading-snug">
                Tell Us About Your Business
              </h1>
              <p className="text-center text-[13px] mb-7 leading-[1.55] text-white">
                Help us tailor your access to our global trade network.
              </p>
              <form
                id="form-step2"
                className="signup-form flex flex-col gap-[13px]"
                data-legacy-onsubmit="handleSignup(event)"
              >
                <input
                  type="text"
                  name="business_name"
                  placeholder="Enter your business name"
                  required
                  className="w-full px-4 py-[13px] rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                  style={{ background: "#0d2a58" }}
                />{" "}
                <input
                  type="email"
                  name="business_email"
                  placeholder="Enter your business email"
                  required
                  className="w-full px-4 py-[13px] rounded text-white text-sm outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 placeholder:text-white"
                  style={{ background: "#0d2a58" }}
                />{" "}
                {/* Industry dropdown */}{" "}
                <div className="relative">
                  <select
                    name="industry"
                    id="industry-select"
                    required
                    className="signup-select w-full px-4 py-[13px] pr-10 rounded text-sm text-white appearance-none outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 cursor-pointer"
                    style={{ background: "#0d2a58" }}
                    defaultValue=""
                  >
                    <option value="" disabled hidden>
                      Industry Type
                    </option>
                    <option value="agriculture">Agriculture &amp; Food</option>
                    <option value="manufacturing">Manufacturing</option>
                    <option value="technology">Technology</option>
                    <option value="logistics">Logistics &amp; Transport</option>
                    <option value="finance">Finance &amp; Banking</option>
                    <option value="retail">Retail &amp; Trade</option>
                    <option value="healthcare">Healthcare &amp; Pharma</option>
                    <option value="energy">Energy &amp; Resources</option>
                    <option value="other">Other</option>
                  </select>{" "}
                  <div className="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-white">
                    <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.2">
                      <path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7"></path>
                    </svg>
                  </div>
                </div>
                {/* Country dropdown */}
                <div className="relative">
                  <select
                    name="country"
                    id="country-select"
                    required
                    className="signup-select w-full px-4 py-[13px] pr-10 rounded text-sm text-white appearance-none outline-none border-none transition-shadow focus:ring-2 focus:ring-blue-500/40 cursor-pointer"
                    style={{ background: "#0d2a58" }}
                    defaultValue=""
                  >
                    <option value="" disabled hidden>
                      Select Country
                    </option>
                    <option value="in">India</option>
                    <option value="us">United States</option>
                    <option value="gb">United Kingdom</option>
                    <option value="ae">United Arab Emirates</option>
                    <option value="sg">Singapore</option>
                    <option value="de">Germany</option>
                    <option value="cn">China</option>
                    <option value="jp">Japan</option>
                    <option value="au">Australia</option>
                    <option value="ca">Canada</option>
                    <option value="fr">France</option>
                    <option value="br">Brazil</option>
                    <option value="za">South Africa</option>
                    <option value="ng">Nigeria</option>
                    <option value="other">Other</option>
                  </select>{" "}
                  <div className="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-white">
                    <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.2">
                      <path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7"></path>
                    </svg>
                  </div>
                </div>{" "}
                {/* Terms checkbox */}{" "}
                <label className="flex items-start gap-[10px] cursor-pointer mt-[2px]">
                  {" "}
                  <input type="checkbox" name="terms" required className="mt-[2px]" defaultChecked />{" "}
                  <span className="text-[12.5px] leading-[1.5] text-white">
                    {" "}
                    I agree to the{" "}
                    <a href="#" className="hover:underline" style={{ color: "#00FFC7" }}>
                      Terms of Service
                    </a>{" "}
                    and{" "}
                    <a href="#" className="hover:underline" style={{ color: "#00FFC7" }}>
                      Privacy Policy
                    </a>
                    .{" "}
                  </span>{" "}
                </label>{" "}
                {/* Submit */}{" "}
                <button
                  type="submit"
                  className="w-full py-[13px] mt-1 text-white font-bold text-[13px] tracking-[0.1em] uppercase rounded
                           transition-all duration-150 active:scale-[0.99]"
                  style={{ background: "#1f63d6" }}
                  data-legacy-onmouseover="this.style.background='#194fab'"
                  data-legacy-onmouseout="this.style.background='#1f63d6'"
                >
                  {" "}
                  SIGNUP{" "}
                </button>{" "}
                <button
                  type="button"
                  data-legacy-onclick="goBack()"
                  className="w-full py-[10px] text-[12px] text-white transition-colors"
                  data-legacy-onmouseover="this.style.color='rgba(255,255,255,0.7)'"
                  data-legacy-onmouseout="this.style.color='#fff'"
                >
                  {" "}
                  ← Back to account details{" "}
                </button>
              </form>
            </div>
          </div>
        </div>
      </div>
    </SitePage>
  );
}
