import Image from "next/image";
import { OurServicesWorksProps } from "@/types/aesthetic-offers-bulle";
import Link from "next/link";

export default function OurServicesWorks({
  title,
  heading,
  description,
  image,
  cta_text,
  cta_url,
  left_content,
}: OurServicesWorksProps) {
  return (
    <section className="relative overflow-hidden bg-[#F2F4F6] px-5 py-10 md:px-10 md:py-20 xl:px-20 md:mb-[80px] pb-8">
      {/* Decorative background — replace with the actual Figma asset if available */}
      {/* Background image */}
      <div className="pointer-events-none absolute inset-0">
        <Image
          src="/images/services-bg.png"
          alt=""
          fill
          priority
          sizes="100vw"
          className="object-cover object-left"
        />
      </div>

      {/* Desktop image */}
      {image && (
        <div className="pointer-events-none absolute bottom-6 right-0 top-10 hidden w-[52%] md:block xl:top-20">
          <Image
            src={image}
            alt=""
            fill
            priority
            sizes="(min-width: 1280px) 52vw, 55vw"
            className="object-contain object-right-bottom"
          />
        </div>
      )}

      <div className="container relative z-[1]">
        <div className="max-w-[760px]">
          {title && (
            <span className="mb-2 block text-[10px] font-medium uppercase tracking-[0.5px] text-[#334D72] md:text-[14px]">
              {title}
            </span>
          )}

          {heading && (
            <h2 className="mb-2 text-[24px] font-medium leading-[1.1] tracking-[-0.5px] text-[#00204F] md:text-[48px]">
              {heading}
            </h2>
          )}

          {description && (
            <p className="mb-8 max-w-[480px] text-[12px] font-normal leading-[1.3] text-[#334D72] md:mb-12 md:text-[20px]">
              {description}
            </p>
          )}

          <div className="max-w-[760px]">
            {left_content?.map((item, index) => (
              <div key={`${item.number}-${index}`}>
                <div className="flex items-start gap-3 py-4 md:py-0 md:pb-6">
                  <span className="w-[31px] shrink-0 text-[20px] font-medium leading-[1.2] tracking-[-0.5px] text-[#1718FF] md:w-[51px] md:text-[40px]">
                    {item.number}
                  </span>

                  <div className="min-w-0 flex-1">
                    <div className="mb-2 flex flex-wrap items-center gap-2">
                      <h3 className="text-[14px] font-bold leading-[1.3] text-[#00204F] md:text-[24px]">
                        {item.title}
                      </h3>

                      {item.text && (
                        <span className="inline-flex shrink-0 items-center gap-1 rounded-[6px] bg-[#D5E4FF] px-2 py-1 text-[10px] font-bold leading-[1.4] text-[#2F46FF] md:text-[14px]">
                          {item.icon && (
                            <Image
                              src={item.icon}
                              alt=""
                              width={16}
                              height={16}
                              className="h-3 w-3 object-contain md:h-4 md:w-4"
                            />
                          )}
                          {item.text}
                        </span>
                      )}
                    </div>

                    {item.description && (
                      <p className="text-[10px] font-medium leading-[1.4] text-[#334D72] md:text-[16px]">
                        {item.description}
                      </p>
                    )}
                  </div>
                </div>

                {index !== left_content.length - 1 && (
                  <div className="h-px w-full bg-[#CCD2DC] md:mb-6" />
                )}
              </div>
            ))}
          </div>

          {cta_text && (
            <Link
              href={cta_url || "#"}
              className="mt-5 inline-flex min-h-[40px] items-center justify-center gap-2 rounded-[8px] border border-[#1718FF] px-4 py-2 text-[11px] font-bold leading-[1.4] text-[#1718FF] md:mt-0 md:min-h-[56px] md:px-8 md:text-[18px]"
            >
              {cta_text}
              <span className="text-[16px] leading-none">›</span>
            </Link>
          )}
        </div>
      </div>

      {/* Bottom blue strip */}
      <div className="absolute bottom-0 left-0 h-[10px] w-full bg-[#B3CCFF] md:h-[25px]" />
    </section>
  );
}
