import { Link } from "react-router-dom";
import { UserPlus, FileSearch, Store, PanelsTopLeft, ClipboardCheck, BadgeIndianRupee, Info } from "lucide-react";
import { Seo } from "@/components/Seo";
import { PageHero } from "@/components/PageHero";
import { Reveal } from "@/components/Reveal";
import { useQuote } from "@/components/QuoteModal";
import { useContent } from "@/lib/content";

const STEP_ICONS = [UserPlus, FileSearch, Store, PanelsTopLeft, ClipboardCheck, BadgeIndianRupee];

export default function PmSuryaGhar() {
  const { openQuote } = useQuote();
  const { IMAGES, PM } = useContent();
  return (
    <>
      <Seo
        title="PM Surya Ghar: Muft Bijli Yojana in Chennai | Rooftop Solar Subsidy | DHIYAA SOLAR ENERGY"
        description="PM Surya Ghar: Muft Bijli Yojana rooftop solar programme — Central Financial Assistance of ₹30,000/kW for the first 2 kW and ₹18,000/kW for the 3rd kW for eligible residential consumers. PM Surya Ghar rooftop solar solutions in Chennai."
      />
      <PageHero
        eyebrow="PM Surya Ghar: Muft Bijli Yojana"
        title="Make Your Home a Solar Home"
        subtitle="PM Surya Ghar – Rooftop Solar Solutions with Central Financial Assistance for eligible residential consumers."
        image={IMAGES.pmSurya}
      />

      <section className="mx-auto max-w-7xl px-4 py-16 sm:px-6" data-testid="pm-intro">
        <div className="grid items-center gap-12 lg:grid-cols-2">
          <Reveal>
            <h2 className="font-heading text-3xl font-extrabold tracking-tight text-brand-navy">
              Central Financial Assistance for Rooftop Solar
            </h2>
            <p className="mt-4 leading-relaxed text-slate-600">{PM.intro}</p>
            <div className="mt-6 grid grid-cols-3 gap-3">
              {PM.subsidy.map((s) => (
                <div key={s.l} className="rounded-xl border border-brand-green/20 bg-brand-green/5 p-4">
                  <p className="font-heading text-xl sm:text-2xl font-extrabold text-brand-green">{s.v}</p>
                  <p className="mt-1 text-[11px] leading-snug text-slate-500">{s.l}</p>
                </div>
              ))}
            </div>
            <p className="mt-5 text-sm leading-relaxed text-slate-600">{PM.stateNote}</p>
          </Reveal>
          <Reveal delay={0.15}>
            <img src={IMAGES.pmSurya} alt="Rooftop solar installation under PM Surya Ghar scheme" className="w-full rounded-3xl object-cover shadow-2xl" />
          </Reveal>
        </div>
      </section>

      <section className="bg-brand-sky py-16" data-testid="pm-steps">
        <div className="mx-auto max-w-7xl px-4 sm:px-6">
          <Reveal>
            <p className="text-xs font-bold uppercase tracking-[0.25em] text-brand-orange">The Journey</p>
            <h2 className="mt-3 font-heading text-3xl font-extrabold tracking-tight text-brand-navy">How PM Surya Ghar Works</h2>
          </Reveal>
          <div className="mt-10 grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
            {PM.steps.map((s, i) => {
              const Icon = STEP_ICONS[i % STEP_ICONS.length];
              return (
                <Reveal key={s.title + i} delay={i * 0.07}>
                  <div className="relative h-full rounded-2xl bg-white p-7 shadow-sm transition-all hover:-translate-y-1 hover:shadow-lg">
                    <span className="absolute right-6 top-6 font-heading text-4xl font-extrabold text-brand-orange/15">{`0${i + 1}`}</span>
                    <span className="flex h-12 w-12 items-center justify-center rounded-xl bg-brand-blue/10 text-brand-blue">
                      <Icon className="h-6 w-6" />
                    </span>
                    <h3 className="mt-4 font-heading text-lg font-bold text-brand-navy">{s.title}</h3>
                    <p className="mt-2 text-sm leading-relaxed text-slate-600">{s.desc}</p>
                  </div>
                </Reveal>
              );
            })}
          </div>
          <Reveal className="mt-8">
            <div className="flex items-start gap-3 rounded-2xl border border-brand-orange/25 bg-brand-orange/5 p-5">
              <Info className="mt-0.5 h-5 w-5 shrink-0 text-brand-orange" />
              <p className="text-sm leading-relaxed text-slate-600">{PM.note}</p>
            </div>
          </Reveal>
        </div>
      </section>

      <section className="bg-brand-navy py-16 sun-rays" data-testid="pm-cta">
        <div className="mx-auto flex max-w-4xl flex-col items-center gap-5 px-4 text-center sm:px-6">
          <h2 className="font-heading text-3xl sm:text-4xl font-extrabold text-white">Check Your Rooftop Solar Requirement</h2>
          <p className="max-w-xl text-white/70">
            Find out your indicative system size, savings and subsidy — then get a free site assessment from our team.
          </p>
          <div className="flex flex-wrap justify-center gap-3">
            <Link to="/calculator" className="rounded-full bg-brand-orange px-8 py-4 font-heading text-sm font-bold uppercase tracking-wider text-white transition-colors hover:bg-brand-orangedark" data-testid="pm-calc-btn">
              Calculate My Savings
            </Link>
            <button onClick={() => openQuote({ property_type: "Residential", solar_requirement: "Rooftop Solar" })} className="rounded-full border border-white/30 px-8 py-4 font-heading text-sm font-bold uppercase tracking-wider text-white transition-colors hover:border-brand-orange hover:text-brand-orange" data-testid="pm-quote-btn">
              Get Free Site Assessment
            </button>
          </div>
        </div>
      </section>
    </>
  );
}
