"use client";

import { useState } from "react";

import ProjectItems from "@/components/services/ProjectItems";
import GetStartedButton from "@/components/navigation/GetStartedButton";
import { projectItemsData } from "@/data/StaticData";

const ServicesPage = () => {
  const [activeIndex, setActiveIndex] = useState(-1);

  return (
    <div className="mx-auto w-full max-w-6xl px-4 sm:px-6 lg:px-8 py-8 sm:pt-32 sm:pb-16">
      <div className="grid grid-cols-1 md:grid-cols-12 gap-6 md:gap-0">
        <div className="md:col-span-6">
          <div className="flex items-center gap-3 mb-3 ml-2">
            <span className="inline-block w-6 h-6 rotate-45 bg-[var(--color-7)]" />
            <h1 className="text-2xl sm:text-3xl font-mono ml-2">
              Bird eye view
            </h1>
          </div>
          <div
            className="md:w-3/4 w-full h-[3px] mb-4"
            style={{ background: "var(--color-2)" }}
          />

          <ProjectItems
            items={projectItemsData}
            activeIndex={activeIndex}
            setActiveIndex={setActiveIndex}
          />
        </div>

        <div className="md:col-span-6">
          <div
            className={`bg-[var(--color-2)] p-6 md:p-8 md:min-h-[510px] flex items-start relative
            ${
              activeIndex === projectItemsData.length - 1
                ? "rounded-tl-lg rounded-tr-lg"
                : "rounded-lg"
            }
          `}
          >
            {activeIndex === -1 ? (
              <>
                <div className="w-full text-center pb-16">
                  <h3 className="text-xl sm:text-2xl font-mono font-extrabold">
                    Boost Your Security.
                    <br />
                    Simplify Your Workflow.
                  </h3>
                  <p className="mt-4 max-w-2xl mx-auto text-sm sm:text-base font-mono leading-relaxed">
                    LAN Codes is designed for organizations that want a smarter,
                    faster way to strengthen their security posture. Our custom
                    LLM automatically detects vulnerabilities and unusual
                    patterns—removing the tedious manual work so your team can
                    focus on what truly matters: investigating threats and
                    finding solutions.
                  </p>
                  <p className="mt-4 max-w-2xl mx-auto text-sm sm:text-base font-mono leading-relaxed">
                    Even if a breach occurs, your critical data stays encrypted
                    and protected, giving you the confidence and time to respond
                    effectively and prevent future incidents.
                  </p>
                </div>
                <div className="absolute bottom-6 left-0 right-0 flex justify-center">
                  <GetStartedButton />
                </div>
              </>
            ) : (
              <div className="w-full text-center pb-16">
                <p className="font-mono text-sm sm:text-base">
                  {projectItemsData[activeIndex]?.content}
                </p>
              </div>
            )}
          </div>
        </div>
      </div>

      <div className="mt-10">
        <div className="relative rounded-lg bg-[var(--color-2)] ring-1 ring-white/10 px-6 py-8 shadow-[0_0_16px_rgba(255,255,255,0.5)]">
          <h2 className="text-center text-xl md:text-2xl font-mono mb-4">
            Affordable Security for Everyone
          </h2>
          <p className="text-center mx-auto text-sm sm:text-base font-mono mb-6">
            We believe cybersecurity should be accessible to all businesses,
            regardless of size. Our solutions are designed to be cost effective
            without compromising on security
          </p>
          <div className="flex justify-center">
            <GetStartedButton />
          </div>
        </div>
      </div>
    </div>
  );
};

export default ServicesPage;
