"use client";

import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import NavbarStyleFullscreen from '@/components/navbar/NavbarStyleFullscreen/NavbarStyleFullscreen';
import { useState } from "react";
import Link from "next/link";

export default function LoginPage() {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [isLoading, setIsLoading] = useState(false);

  const handleLogin = (e: React.FormEvent) => {
    e.preventDefault();
    setIsLoading(true);
    setTimeout(() => {
      setIsLoading(false);
    }, 1000);
  };

  return (
    <ThemeProvider
      defaultButtonVariant="hover-magnetic"
      defaultTextAnimation="entrance-slide"
      borderRadius="pill"
      contentWidth="smallMedium"
      sizing="largeSmall"
      background="floatingGradient"
      cardStyle="solid"
      primaryButtonStyle="primary-glow"
      secondaryButtonStyle="layered"
      headingFontWeight="normal"
    >
      <div id="nav" data-section="nav">
        <NavbarStyleFullscreen
          navItems={[
            { name: "Home", id: "/" },
            { name: "Services", id: "/services" },
            { name: "Features", id: "/features" },
            { name: "Pricing", id: "/pricing" },
            { name: "Contact", id: "/contact" },
          ]}
          brandName="SponsorDesk"
          bottomLeftText="HR & Legal Solutions"
          bottomRightText="support@sponsordesk.com"
        />
      </div>

      <div className="min-h-screen bg-[#fbfaff] flex items-center justify-center px-4 py-12">
        <div className="w-full max-w-md">
          <div className="bg-[#f7f5ff] rounded-3xl p-8 shadow-lg border border-[#d8cef5]">
            <div className="mb-8">
              <h1 className="text-3xl font-bold text-[#0f0022] mb-2">
                Welcome Back
              </h1>
              <p className="text-[#0f0022]/60">
                Sign in to access your SponsorDesk dashboard
              </p>
            </div>

            <form onSubmit={handleLogin} className="space-y-6">
              <div>
                <label className="block text-sm font-medium text-[#0f0022] mb-2">
                  Email Address
                </label>
                <input
                  type="email"
                  value={email}
                  onChange={(e) => setEmail(e.target.value)}
                  placeholder="you@example.com"
                  required
                  className="w-full px-4 py-3 rounded-xl bg-[#fbfaff] border border-[#d8cef5] text-[#0f0022] placeholder-[#0f0022]/40 focus:outline-none focus:ring-2 focus:ring-[#8b5cf6] transition"
                />
              </div>

              <div>
                <label className="block text-sm font-medium text-[#0f0022] mb-2">
                  Password
                </label>
                <input
                  type="password"
                  value={password}
                  onChange={(e) => setPassword(e.target.value)}
                  placeholder="••••••••"
                  required
                  className="w-full px-4 py-3 rounded-xl bg-[#fbfaff] border border-[#d8cef5] text-[#0f0022] placeholder-[#0f0022]/40 focus:outline-none focus:ring-2 focus:ring-[#8b5cf6] transition"
                />
              </div>

              <div className="flex items-center justify-between text-sm">
                <label className="flex items-center">
                  <input
                    type="checkbox"
                    className="w-4 h-4 rounded accent-[#8b5cf6]"
                  />
                  <span className="ml-2 text-[#0f0022]">Remember me</span>
                </label>
                <a
                  href="#"
                  className="text-[#8b5cf6] hover:text-[#8b5cf6]/80 transition"
                >
                  Forgot password?
                </a>
              </div>

              <button
                type="submit"
                disabled={isLoading}
                className="w-full px-6 py-3 bg-[#8b5cf6] text-[#fbfaff] font-medium rounded-xl hover:bg-[#8b5cf6]/90 transition disabled:opacity-50"
              >
                {isLoading ? "Signing in..." : "Sign In"}
              </button>
            </form>

            <div className="mt-6 pt-6 border-t border-[#d8cef5]">
              <p className="text-center text-[#0f0022]/60 text-sm">
                Don't have an account?{" "}
                <Link
                  href="/signup"
                  className="text-[#8b5cf6] font-medium hover:text-[#8b5cf6]/80 transition"
                >
                  Sign up
                </Link>
              </p>
            </div>
          </div>

          <div className="mt-8 text-center text-sm text-[#0f0022]/50">
            <p>
              By signing in, you agree to our{" "}
              <a href="#" className="text-[#8b5cf6] hover:underline">
                Terms of Service
              </a>{" "}
              and{" "}
              <a href="#" className="text-[#8b5cf6] hover:underline">
                Privacy Policy
              </a>
            </p>
          </div>
        </div>
      </div>

      <footer className="bg-[#0f0022] text-[#fbfaff] py-8 mt-16">
        <div className="max-w-6xl mx-auto px-4 md:px-6 text-center text-sm text-[#fbfaff]/60">
          <p>© 2025 SponsorDesk. All rights reserved.</p>
        </div>
      </footer>
    </ThemeProvider>
  );
}