"use client";

import React, { useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { FaDownload, FaEnvelope, FaChevronRight, FaArrowRight } from "react-icons/fa6";
import {
  LuLayers,
  LuShieldCheck,
  LuFlameKindling,
  LuShieldAlert,
  LuBuilding2,
  LuCpu
} from "react-icons/lu";
import Breadcrumbs from "@/components/Common/Breadcrumb";

// Note: If using Next.js App Router, extract this metadata block 
// into a separate layout.tsx or static page file since this is a "use client" file.
// export const metadata = {
//   title: "Polycab Ignis Fire Survival Cables | LSZH Safety Wire",
//   description: "Explore Polycab IGNIS Series fire survival cables. Low smoke halogen free (LSZH) lines designed with Mica glass tape fire barriers for uninterrupted power in high-rise buildings.",
//   keywords: ["Polycab Ignis Series", "Fire Survival Cable", "LSZH Cable", "Mica Glass Tape", "Fire Resistant Wire", "IEC Compliant Cable"],
// };

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabFireSurvivalCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Product Line", val: "IGNIS Series" },
    { label: "Smoke Profile", val: "LSZH / FRLS" },
    { label: "Fire Barrier", val: "Mica Glass Tape" },
    { label: "Core Processing", val: "Contirod Line Copper" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Annealed Plain Stranded Copper Conductor",
      category: "1. Core Conductor Framework",
      technicalDetails: "Constructed with a high-conductivity annealed plain stranded copper conductor. The entire raw processing loop runs in-house using an advanced, state-of-the-art Contirod manufacturing line to guarantee pristine electrical pathway continuity and optimal structural flexibility."
    },
    {
      id: "spec-2",
      title: "Mica Glass Tape Fire Barrier",
      category: "2. Thermal Shielding",
      technicalDetails: "Wrapped in a specialized Mica Glass Tape fire barrier layer. This strategic thermal block defends the innermost conducting cores from blistering heat loads, preventing immediate short circuiting and keeping emergency power active during active blazes."
    },
    {
      id: "spec-3",
      title: "Advanced Polymeric Insulating Compound",
      category: "3. Dielectric Layering",
      technicalDetails: "Insulated with Polycab's in-house developed high insulation resistance polymers. Available options include Cross-Linked Polyethylene (XLPE), Electron Beam Cross-Linked material, Silicone Rubber, or Cross-Linked Halogen-Free Flame Retardant Insulation formulations."
    },
    {
      id: "spec-4",
      title: "Individual & Collective Aluminium Mylar Shields",
      category: "4. Signal Protection",
      technicalDetails: "Where specific application blueprints demand it, pairs are given individual or collective screening. The assembly utilizes Aluminium Mylar Tape shields wrapped alongside a dedicated metallic drain wire to ground electromagnetic interference."
    },
    {
      id: "spec-5",
      title: "Extruded Inner Covering & Protective Sheath Bedding",
      category: "5. Laying-Up Architecture",
      technicalDetails: "Creates an engineered mechanical boundary layer between core structural insulation and exterior armor elements. Formed via a highly uniform extruded application of Low Smoke Zero Halogen (LSZH), Flame Retardant Low Smoke (FRLS) PVC, or specialized protective wrapping tapes."
    },
    {
      id: "spec-6",
      title: "Galvanised Round Steel Wire Armour or Metallic Braid",
      category: "6. Mechanical Reinforcement",
      technicalDetails: "Layered with heavy-duty Galvanised Steel Round Wire armouring, explicit Copper Braiding, or structural shielding. This tough metal cage guarantees the cable effortlessly resists brutal tensile strains and physical crushing forces on-site."
    },
    {
      id: "spec-7",
      title: "In-House Formulated FRLS PVC or LSZH Outer Casing",
      category: "7. Environmental Extrusion",
      technicalDetails: "Enclosed in a durable, in-house developed Type FRLS PVC or pristine LSZH outer jacket. This custom compound suppresses aggressive fire creeping, restricts dark smoke emission levels, limits carbon monoxide generation, and avoids the venting of toxic or highly corrosive gases."
    }
  ];

  return (
    <>
      <Breadcrumbs pageName="Polycab Ignis Fire Survival Cables" description="L&amp;T Electrical &amp; Automation offers a complete range of intelligent Automatic Power Factor Correction (APFC) controllers engineered for industrial and commercial operations to automate power networks instantly." />

      {/* Complete background modified to bg-white & optimized viewport boundaries for extreme large desktop resolutions */}
      <div className="min-h-screen bg-white text-slate-800 py-16 lg:py-24 xl:py-32 selection:bg-cyan-100 selection:text-slate-900">
        <div className="container mx-auto px-4 max-w-7xl xl:max-w-[1440px] 2xl:max-w-[1680px] 3xl:max-w-[1920px]">

          {/* ─── HERO BRAND / DETAILS SECTION ──────────────────── */}
          <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 xl:gap-16 2xl:gap-24 items-center mb-24 lg:mb-32">

            {/* Left Frame: Image Asset Viewport */}
            <div className="lg:col-span-5 flex justify-center order-2 lg:order-1">
              <div className="relative w-full max-w-[420px] xl:max-w-[500px] aspect-square rounded-3xl overflow-hidden bg-slate-50 border border-slate-100 p-8 shadow-sm group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/Rubber-Cable-BS-EN-50525-2-21.png"
                    alt="Polycab IGNIS Series Low Smoke Halogen Free Fire Survival Cable"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500 mix-blend-multiply"
                    sizes="(max-width: 768px) 100vw, (max-width: 1280px) 420px, 500px"
                  />
                </div>
              </div>
            </div>

            {/* Right Frame: Text Narrative Content */}
            <div className="lg:col-span-7 space-y-6 xl:space-y-8 order-1 lg:order-2">
              <span className="inline-flex items-center gap-1.5 rounded-full bg-slate-900 px-4 py-1.5 text-xs font-bold tracking-wider text-cyan-400 uppercase border border-slate-800 shadow-xs">
                IEC &amp; BS Conformance • Critical Circuit Continuity Systems
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab Fire Survival Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl block mt-3">
                  IGNIS Series LSZH Circuit Integrity Power &amp; Control Cabling
                </span>
              </h1>

              <div className="space-y-4 xl:space-y-6 text-slate-600 text-sm md:text-base xl:text-lg leading-relaxed font-medium max-w-4xl">
                <p>
                  In modern structural engineering projects, electrical circuitry represents a primary line of defense. Standard insulation layers easily catch fire, sparking rapid overheating, structural arcing, short circuits, and uncontrolled flame propagation that releases toxic smoke and corrosive gases.
                </p>
                <p>
                  <strong>Polycab IGNIS Fire Survival Cables</strong> are engineered with advanced Low Smoke Halogen Free (LSZH) properties to maintain continuous, life-saving electrical power throughout a fire. They ensure critical smoke extraction, emergency lighting, and alarm systems keep running when safety is compromised.
                </p>
                <p>
                  Conforming strictly to internationally recognized <strong>IEC and BS test specifications</strong>, the IGNIS range is verified by leading labs and certified by major Indian public sector corporations and safety-critical industries for high-risk zoning.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-slate-50 border border-slate-100 p-4 xl:p-6 rounded-2xl shadow-xs max-w-3xl">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-white border border-slate-100 p-3.5 xl:p-5 rounded-xl text-center flex flex-col justify-center transition-all hover:border-cyan-200">
                    <span className="text-[10px] xl:text-xs text-slate-400 font-bold uppercase tracking-wider block mb-1.5">
                      {metric.label}
                    </span>
                    <span className="text-xs xl:text-sm font-black text-slate-900 leading-snug">
                      {metric.val}
                    </span>
                  </div>
                ))}
              </div>

              {/* Direct Brochure CTAs */}
              <div className="flex flex-wrap gap-4 pt-2">
                <Link
                  href="https://realswitchgears.com/assets/images/products/polycab-cable/fire-resistant-cable/pdf/Fire-servival-Cable-BS-IGNIS.pdf"
                  target="_blank"
                  className="inline-flex items-center gap-2 bg-slate-900 hover:bg-slate-800 text-white text-xs xl:text-sm font-bold px-6 py-4 rounded-xl transition-all group shadow-sm"
                >
                  <FaDownload className="w-3.5 h-3.5 group-hover:translate-y-0.5 transition-transform" />
                  Download IGNIS Series Catalog
                </Link>
                <Link
                  href="/contact"
                  className="inline-flex items-center gap-2 bg-cyan-500 hover:bg-cyan-600 text-white text-xs xl:text-sm font-bold px-6 py-4 rounded-xl transition-all shadow-md shadow-cyan-500/10"
                >
                  Send Enquiry <FaEnvelope className="w-3.5 h-3.5" />
                </Link>
              </div>
            </div>

          </div>

          {/* ─── INTERACTIVE ARCHITECTURE SPECIFICATION VIEWER ──── */}
          <div className="mb-24 lg:mb-32">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-100 pb-5">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 text-cyan-600 rounded-xl">
                <LuLayers className="w-6 h-6" />
              </div>
              <div>
                <h2 className="text-xl font-black text-slate-900 xl:text-2xl">Technical Specifications &amp; Multi-Core Layering</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Select an engineering layer or laying-up option below to inspect the specialized fire barriers, armours, and LSZH compounds.
                </p>
              </div>
            </div>

            <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 xl:gap-12 items-start">

              {/* Left Control Panel Column */}
              <div className="lg:col-span-5 space-y-2.5">
                {technicalSpecifications.map((spec) => (
                  <button
                    key={spec.id}
                    onClick={() => setActiveSpecId(spec.id)}
                    className={`w-full text-left p-4 rounded-xl border text-xs xl:text-sm font-bold transition-all flex items-center justify-between group ${activeSpecId === spec.id
                      ? "bg-cyan-500 text-white border-cyan-600 shadow-md shadow-cyan-500/10"
                      : "bg-slate-50 text-slate-700 border-slate-100 hover:bg-slate-100"
                      }`}
                  >
                    <span className="truncate pr-4">{spec.title}</span>
                    <FaChevronRight className={`w-3 h-3 opacity-80 shrink-0 group-hover:translate-x-0.5 transition-transform ${activeSpecId === spec.id ? "text-white" : "text-slate-400"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Details Information Block */}
              <div className="lg:col-span-7 bg-slate-50 border border-slate-100 rounded-2xl p-6 md:p-8 xl:p-10 min-h-[250px] flex flex-col justify-between shadow-xs">
                {(() => {
                  const specMatch = technicalSpecifications.find((s) => s.id === activeSpecId)!;
                  return (
                    <>
                      <div className="space-y-4">
                        <div>
                          <span className="text-[10px] xl:text-xs font-black tracking-widest text-cyan-600 uppercase block mb-1">
                            {specMatch.category}
                          </span>
                          <h3 className="text-base xl:text-lg font-black text-slate-900">
                            {specMatch.title}
                          </h3>
                        </div>
                        <p className="text-xs md:text-sm xl:text-base text-slate-600 font-medium leading-relaxed pt-3 border-t border-slate-200/60">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-200/60 flex flex-col sm:flex-row gap-2 sm:items-center justify-between text-[11px] xl:text-xs text-slate-400 font-bold">
                        <span className="flex items-center gap-1.5 text-slate-700">
                          <LuShieldCheck className="w-4 h-4 text-cyan-500" /> High-Density Stranded Contirod Extrusion
                        </span>
                        <span className="text-cyan-600 bg-cyan-50 px-2.5 py-0.5 rounded-md border border-cyan-100 w-fit">
                          IEC &amp; BS Certified
                        </span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── TECHNICAL SAFETY & UTILITY OVERVIEW CARDS ──────── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 xl:gap-8 mb-24 lg:mb-32">

            <div className="bg-slate-50 border border-slate-100 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuFlameKindling className="w-5 h-5 xl:w-6 h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Zero Halogen Gas Suppression</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  The LSZH formulation prevents the release of acidic, corrosive gases, safeguarding sensitive digital electronics and critical measuring devices.
                </p>
              </div>
            </div>

            <div className="bg-slate-50 border border-slate-100 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuShieldAlert className="w-5 h-5 xl:w-6 h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Continuous Electrical Survival</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Designed to retain continuous electrical load routing during active structural fire outbreaks, backing life-safety extraction grids.
                </p>
              </div>
            </div>

            <div className="bg-slate-50 border border-slate-100 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuBuilding2 className="w-5 h-5 xl:w-6 h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">High-Density Infrastructure</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  The ideal choice for heavily populated complexes including high-rise towers, subways, modern shopping malls, airports, schools, and hospitals.
                </p>
              </div>
            </div>

          </div>

          {/* ─── COMMERCIAL INQUIRY BLOCK ──────────────────────── */}

          <div className="flex flex-col sm:flex-row justify-center items-center gap-4 w-full">
            <Link
              href="/images/products/polycab-cable/lv-power-cable/pdf/LV-Power-Cable-IS-1.pdf"
              target="_blank"
              className="inline-flex items-center justify-center gap-2 bg-slate-100 hover:bg-slate-200 text-slate-900 text-xs font-bold px-8 py-4 rounded-full transition-all w-full sm:w-auto uppercase tracking-wider border border-slate-200 shadow-xs"
            >
              <FaDownload className="w-3.5 h-3.5" />
              View Technical PDF
            </Link>

            <Link
              href="/contact"
              className="inline-flex items-center justify-center gap-2 bg-cyan-500 hover:bg-cyan-600 text-white text-xs xl:text-sm font-bold px-8 sm:px-10 py-4 rounded-full transition-all duration-200 active:scale-95 shadow-md shadow-cyan-500/10 w-full sm:w-auto uppercase tracking-wider"
            >
              Send Enquiry
              <FaArrowRight className="w-3.5 h-3.5 transition-transform group-hover:translate-x-0.5" />
            </Link>
          </div>


        </div>
      </div>
    </>
  );
}