"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,
  LuZap,
  LuShieldAlert,
  LuActivity,
  LuSparkles,
  LuFlameKindling
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";
interface TechnicalLayer {
  id: string;
  layerName: string;
  materialComposition: string;
  engineeringBenefit: string;
}

export default function PolycabBs6724CableDetail() {
  const [selectedLayerId, setSelectedLayerId] = useState<string>("layer-1");

  const engineeringMetrics = [
    { label: "Standard Baseline", val: "BS 6724 Standard" },
    { label: "Voltage Options", val: "6.6kV up to 33kV" },
    { label: "Safety Rating", val: "Low Smoke Zero Halogen" },
    { label: "Thermal Limits", val: "90°C Rated / 250°C Short" }
  ];

  const coreBlueprint: TechnicalLayer[] = [
    {
      id: "layer-1",
      layerName: "1. Core Conductor",
      materialComposition: "High Conductivity Stranded Compacted Copper or Aluminium",
      engineeringBenefit: "Processed in-house using advanced wire-drawing machinery to maximize electrical throughput while keeping a compact, uniform profile."
    },
    {
      id: "layer-2",
      layerName: "2. Conductor Screen",
      materialComposition: "Extruded Semi-Conducting Compound",
      engineeringBenefit: "Creates a smooth electrical boundary over the stranded core, smoothing out high-stress electrical points to optimize dielectric life."
    },
    {
      id: "layer-3",
      layerName: "3. Core Insulation",
      materialComposition: "High Insulation Resistance XLPE or EPR Thermoset Compound",
      engineeringBenefit: "Provides high dielectric parameters and consistent thermal tolerance, built to safely handle continuous heavy power demands."
    },
    {
      id: "layer-4",
      layerName: "4. Insulation Screen Matrix",
      materialComposition: "Semi-Conducting Layer bound with Copper Tape Screen",
      engineeringBenefit: "Combines an extruded semi-conducting bed followed by a low-resistance copper tape wrap to ground system fault currents quickly."
    },
    {
      id: "layer-5",
      layerName: "5. Formed Inner Covering",
      materialComposition: "Extruded Halogen-Free Flame Retardant Compound",
      engineeringBenefit: "Extruded directly over the insulation screen assembly to shield the primary electrical cores from physical friction against the outer armor grid while prioritizing LSZH containment."
    },
    {
      id: "layer-6",
      layerName: "6. Tensile Wire Armor",
      materialComposition: "Galvanized Round Steel Wire or Aluminum Wire Matrix",
      engineeringBenefit: "Supplies high structural strength, enabling the complete cable bundle to easily withstand heavy crushing forces and pulling stresses during burial."
    },
    {
      id: "layer-7",
      layerName: "7. Low Smoke Outer Sheath",
      materialComposition: "In-House Developed Low Smoke Zero Halogen (LSZH) Compound",
      engineeringBenefit: "Engineered to shield the inner layers from mechanical abrasion and weather while ensuring minimal smoke density and zero halogen gas emissions under fire conditions."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab ICEA S-93-639 MV HT Cables" />
      <div className="min-h-screen bg-white text-slate-800 py-12 md:py-20 lg:py-28 xl:py-36 selection:bg-cyan-100 selection:text-cyan-950">
        <div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl xl:max-w-[1600px] 2xl:max-w-[1800px]">

          {/* ─── HERO BRAND / DETAILS SECTION ──────────────────── */}
          <div className="bg-white rounded-3xl p-6 md:p-12 xl:p-16 border border-cyan-400/20 shadow-2xl grid grid-cols-1 lg:grid-cols-12 gap-12 xl:gap-16 items-center mb-12 xl:mb-16">

            {/* 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-2xl bg-slate-50 border border-slate-100 p-6 xl:p-10 group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/MV-Power-Cable-BS_6622.png"
                    alt="Polycab BS 6724 LSZH armored medium voltage high tension power cable"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500"
                    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-cyan-50 px-4 py-1.5 text-xs xl:text-sm font-bold tracking-wider text-cyan-800 uppercase border border-cyan-200">
                LSZH Public Safety Standard
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl 2xl:text-6xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab BS 6724 Armored Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl xl:text-3xl block mt-2">
                  Low Smoke Zero Halogen Medium Voltage Series
                </span>
              </h1>

              <div className="space-y-4 text-slate-600 text-sm md:text-base xl:text-lg leading-relaxed font-medium">
                <p>
                  Polycab’s Medium Voltage high-tension armored cables are built to meet the structural and environmental performance profiles set by the <strong>BS 6724 standard</strong>. They provide safe grid distribution performance across all major voltage grades:
                  <strong> 3.8/6.6 (7.2) kV, 6.35/11 (12) kV, 8.7/15 (17.5) kV, 12.7/22 (24) kV, and 19/33 (36) kV</strong>.
                </p>
                <p>
                  Engineered for maximum deployment safety in populated areas, these Low Smoke Zero Halogen (LSZH) armored configurations are highly recommended for public infrastructure networks, underground paths, or internal cable ducts where toxic gas prevention is critical.
                </p>
                <p>
                  Available in <strong>single and three-core options</strong>, they support a sustained maximum continuous core temperature of <strong>90°C</strong> and can safely handle peak short-circuit thermal surges up to <strong>250°C</strong>.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-3 xl:gap-4 bg-slate-50 border border-slate-200/60 p-4 rounded-2xl">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-white border border-slate-100 p-3 xl:p-4 rounded-xl text-center flex flex-col justify-center shadow-xs">
                    <span className="text-[10px] xl:text-xs text-slate-400 font-bold uppercase tracking-wider block mb-1">
                      {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/polycab-cable/mv-power-cable/pdf/MV-Power-Cable-BS_6622.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-3.5 xl:px-8 xl:py-4 rounded-xl transition-all group"
                >
                  <FaDownload className="w-3.5 h-3.5 group-hover:translate-y-0.5 transition-transform" />
                  Download Technical 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-3.5 xl:px-8 xl:py-4 rounded-xl transition-all shadow-sm"
                >
                  Send Enquiry <FaEnvelope className="w-3.5 h-3.5" />
                </Link>
              </div>
            </div>

          </div>

          {/* ─── INTERACTIVE ARCHITECTURE LAYER VIEWER ──────────── */}
          <div className="bg-white rounded-3xl p-6 md:p-12 xl:p-16 border border-cyan-400/20 shadow-2xl mb-12 xl:mb-16">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-100 pb-6">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 text-cyan-700 rounded-xl">
                <LuLayers className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div>
                <h2 className="text-lg xl:text-2xl font-black text-slate-900">Technical Profile Core Explorer</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Click on any manufacturing layer item below to evaluate material engineering classifications and LSZH features.
                </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 xl:space-y-3">
                {coreBlueprint.map((layer) => (
                  <button
                    key={layer.id}
                    onClick={() => setSelectedLayerId(layer.id)}
                    className={`w-full text-left p-4 xl:p-5 rounded-xl border text-xs xl:text-sm font-bold transition-all flex items-center justify-between group ${selectedLayerId === layer.id
                      ? "bg-cyan-500 text-white border-cyan-600 shadow-md"
                      : "bg-slate-50 text-slate-700 border-slate-200 hover:bg-slate-100"
                      }`}
                  >
                    <span className="truncate">{layer.layerName}</span>
                    <FaChevronRight className={`w-2.5 h-2.5 xl:w-3 xl:h-3 opacity-70 group-hover:translate-x-0.5 transition-transform ${selectedLayerId === layer.id ? "text-white" : "text-slate-400"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Details Information Block */}
              <div className="lg:col-span-7 bg-slate-50 border border-slate-200 rounded-2xl p-6 md:p-8 xl:p-12 min-h-[300px] xl:min-h-[380px] flex flex-col justify-between">
                {(() => {
                  const layerMatch = coreBlueprint.find((l) => l.id === selectedLayerId)!;
                  return (
                    <>
                      <div className="space-y-4 xl:space-y-6">
                        <div>
                          <span className="text-[10px] xl:text-xs font-black tracking-widest text-cyan-600 uppercase block mb-1">
                            Material Compound Specifications
                          </span>
                          <h3 className="text-base xl:text-xl font-black text-slate-900">
                            {layerMatch.layerName.substring(3)}
                          </h3>
                        </div>
                        <div className="inline-block bg-white text-slate-800 text-[11px] xl:text-xs font-extrabold px-3 py-1.5 rounded-md border border-slate-200/60 shadow-xs">
                          {layerMatch.materialComposition}
                        </div>
                        <p className="text-xs md:text-sm xl:text-base text-slate-600 font-medium leading-relaxed pt-2">
                          {layerMatch.engineeringBenefit}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-200/60 flex items-center justify-between text-[11px] xl:text-xs text-slate-400 font-bold">
                        <span className="flex items-center gap-1 text-emerald-600">
                          <LuFlameKindling className="w-3.5 h-3.5 xl:w-4 xl:h-4" /> Low Smoke Flame Retardant
                        </span>
                        <span>BS 6724 Compliant Run</span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── ADDED ADVANTAGES SPECS CARDS ──────────────────── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 xl:gap-8 mb-12 xl:mb-16">
            <div className="bg-white border border-cyan-400/20 rounded-2xl p-6 xl:p-8 shadow-xl flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuZap className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Thermoset Resilience</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Premium high-insulation XLPE/EPR cores offer long-term electrical reliability under continuous high load cycles.
                </p>
              </div>
            </div>
            <div className="bg-white border border-cyan-400/20 rounded-2xl p-6 xl:p-8 shadow-xl flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuActivity className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Heavy Tensile Shielding</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Galvanized round wire armoring provides rugged defense against heavy impact loads during direct underground pulls.
                </p>
              </div>
            </div>
            <div className="bg-white border border-cyan-400/20 rounded-2xl p-6 xl:p-8 shadow-xl flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuSparkles className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Zero Halogen Integrity</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Specially formulated jackets minimize hazardous gas generation, making them optimal for confined installations.
                </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="https://realswitchgears.com/assets/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>
    </>
  );
}