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";

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

export default function Page() {
  return (
    <SitePage>
      <a className="skip-link" href="#main">
        Skip to main content
      </a>{" "}
      {/* HEADER */} <SiteHeader active="/donations" />
      <main id="main">
        {/* PAGE HERO */}
        <section className="page-hero relative overflow-hidden py-[52px] md:py-[64px] px-5 text-center">
          <div className="page-hero-pattern" aria-hidden="true"></div>
          <div className="relative z-[2] max-w-[900px] mx-auto" data-reveal="">
            <h1 className="text-[clamp(26px,3.8vw,38px)] font-black text-white leading-tight tracking-[-0.01em]">
              Active Campaigns — Making an Impact Now
            </h1>
            <nav className="mt-4 text-[13px] text-white/70" aria-label="Breadcrumb">
              <ol className="inline-flex items-center gap-2">
                <li>
                  <Link href="/" className="hover:text-white transition-colors">
                    Home
                  </Link>
                </li>
                <li aria-hidden="true" className="text-white/40">
                  &gt;
                </li>
                <li>
                  <Link href="/donations" className="hover:text-white transition-colors">
                    Donations
                  </Link>
                </li>
              </ol>
            </nav>
          </div>
        </section>
        {/* CAMPAIGNS GRID */}
        <section className="bg-white py-[56px] md:py-[72px] pb-[72px]">
          <div className="w-full max-w-[1180px] mx-auto px-6">
            <div id="campaigns-grid" className="campaigns-grid grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6">
              {Array.from({ length: 9 }, (_, i) => (
                <CampaignCard key={i} />
              ))}
            </div>
            <nav
              className="pagination mt-12 flex items-center justify-center gap-2 flex-wrap"
              aria-label="Campaign pages"
              data-reveal=""
            >
              <button type="button" className="pagination-btn pagination-arrow" aria-label="Previous page" disabled>
                {" "}
                <svg className="w-4 h-4" viewBox="0 0 16 16" fill="none" aria-hidden="true">
                  <path
                    d="M10 3L5 8l5 5"
                    stroke="currentColor"
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  ></path>
                  <path
                    d="M12 3L7 8l5 5"
                    stroke="currentColor"
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  ></path>
                </svg>{" "}
              </button>{" "}
              <button type="button" className="pagination-btn is-active" aria-current="page">
                1
              </button>{" "}
              <button type="button" className="pagination-btn">
                2
              </button>{" "}
              <button type="button" className="pagination-btn">
                3
              </button>{" "}
              <span className="pagination-ellipsis text-[#2E2E2E] px-1 select-none" aria-hidden="true">
                …
              </span>{" "}
              <button type="button" className="pagination-btn">
                10
              </button>{" "}
              <button type="button" className="pagination-btn pagination-arrow" aria-label="Next page">
                {" "}
                <svg className="w-4 h-4" viewBox="0 0 16 16" fill="none" aria-hidden="true">
                  <path
                    d="M6 3l5 5-5 5"
                    stroke="currentColor"
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  ></path>
                  <path
                    d="M4 3l5 5-5 5"
                    stroke="currentColor"
                    strokeWidth="1.8"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                  ></path>
                </svg>{" "}
              </button>
            </nav>
          </div>
        </section>
      </main>
      {/* FOOTER */}
      <SiteFooter />
    </SitePage>
  );
}

function CampaignCard() {
  return (
    <>
      <Link
        href="/campaign-detail"
        className="campaign-card campaign-card-link bg-white rounded-[6px] border border-[#e8ecf2] shadow-[0_4px_24px_rgba(15,27,46,0.07)] overflow-hidden flex flex-col"
        data-reveal=""
      >
        <div className="relative">
          <img
            src="/assets/images/donations/campaign-education.jpg"
            alt="Children learning together around a globe"
            className="w-full aspect-[380/200] object-cover block"
            width="380"
            height="200"
            loading="lazy"
          />{" "}
          <span className="absolute top-3 right-3 px-[10px] py-[4px] text-[10px] font-bold tracking-[0.06em] text-white bg-[#13836f] rounded-[4px]">
            Education
          </span>
        </div>
        <div className="p-5 flex flex-col flex-1">
          <div className="flex items-center justify-between gap-2 mb-3 text-[12px]">
            <span className="text-[#2E2E2E]">
              By <span className="text-[#0056D2] font-semibold">Unionists Group</span>
            </span>{" "}
            <span className="text-[#2E2E2E]">200 Days To Go</span>
          </div>
          <h3 className="text-[16px] font-bold text-ink mb-2 leading-[1.35]">Education for Every Child</h3>
          <p className="text-[13px] text-[#2E2E2E] leading-[1.6] mb-5 flex-1">
            Figma ipsum component variant main layer. Invite style vector pencil union frame. Share move frame line
            polygon thumbnail overflow.
          </p>
          <div className="mb-2">
            <div className="progress-track h-[6px] rounded-full bg-[#eef0f3] overflow-hidden">
              <div
                className="progress-fill h-full rounded-full"
                data-progress="86.54"
                style={{ width: "0", background: "linear-gradient(90deg,#f5a623,#f7c948)" }}
              ></div>
            </div>
          </div>
          <div className="mb-5">
            <div className="flex items-baseline justify-between gap-3">
              <div className="text-[14px] font-bold text-ink">$45,000</div>{" "}
              <span className="text-[14px] text-ink progress-label shrink-0" data-target="86.54">
                0%
              </span>
            </div>
            <div className="text-[12px] text-[#2E2E2E]">raised of $52,000</div>
          </div>{" "}
          <span className="w-full inline-flex items-center justify-center py-[13px] text-[12px] font-bold tracking-[0.08em] uppercase rounded-[6px] border-[1.5px] border-transparent bg-[#1f63d6] text-white transition-all duration-[180ms]">
            Donate
          </span>
        </div>
      </Link>
    </>
  );
}
