"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 {
  LuShieldAlert,
  LuThermometerSnowflake,
  LuDroplet,
  LuWind,
  LuBinary,
  LuCpu
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";
interface TechnicalLayer {
  id: string;
  componentName: string;
  materialType: string;
  functionalRole: string;
}

export default function PolycabBs7870CableDetail() {
  const [activeLayerId, setActiveLayerId] = useState<string>("layer-1");

  const coreTechnicalParameters = [
    { label: "Standard Compliance", val: "BS 7870-4-10 Certified" },
    { label: "Voltage Ratings", val: "11kV, 22kV, & 33kV Systems" },
    { label: "Formations", val: "Single Core & Triplex Bundles" },
    { label: "Thermal Thresholds", val: "90°C Continuous / 250°C Short-Circuit" }
  ];

  const structuralLayers: TechnicalLayer[] = [
    {
      id: "layer-1",
      componentName: "Conductor Core",
      materialType: "High-Conductivity Stranded Compacted Copper / Aluminum",
      functionalRole: "Produced in-house using state-of-the-art drawing machinery, delivering optimal electrical throughput with reduced cross-sectional resistance."
    },
    {
      id: "layer-2",
      componentName: "Conductor Shield Screen",
      materialType: "Extruded Semi-Conducting Compound",
      functionalRole: "Smoothes electric fields at the boundary layer, uniformizing voltage stress concentrations across the primary physical core."
    },
    {
      id: "layer-3",
      componentName: "Core Insulation Layer",
      materialType: "High Insulation Resistance XLPE / EPR",
      functionalRole: "Formulated using advanced Cross-Linked Polyethylene or Ethylene Propylene Rubber to provide premium dielectric strength under high heat loads."
    },
    {
      id: "layer-4",
      componentName: "Insulation & Metallic Screen Matrix",
      materialType: "Semi-Conducting Layer + Copper Wire & Copper Tape",
      functionalRole: "An insulation shield layer followed by a concentric copper wire array and helical tape counter-spiral to successfully carry ground fault currents."
    },
    {
      id: "layer-5",
      componentName: "Moisture Barrier Separator",
      materialType: "High-Performance Water Swellable Tape",
      functionalRole: "Applied precisely below and over the metallic copper screen layers to instantly swell upon contact with moisture, preventing longitudinal water ingress."
    },
    {
      id: "layer-6",
      componentName: "Mechanical Outer Sheath",
      materialType: "In-House Medium Density Polyethylene (MDPE) / LSZH",
      functionalRole: "Engineered specifically to withstand tough weather fluctuations, UV degradation, and structural abrasion during installation maneuvers."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab MV HT Power Cable" />
      <div className="min-h-screen bg-white text-slate-800 py-16 lg:py-24 2xl:py-32 selection:bg-cyan-100 selection:text-cyan-950">
        <div className="container mx-auto px-4 max-w-7xl 2xl:max-w-(screen-2xl)">

          {/* ─── HERO & POWER NETWORK HIGHLIGHTS ───────────────── */}
          <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 2xl:gap-16 items-center mb-24 2xl:mb-32">

            {/* Left Column: Product Visuals */}
            <div className="lg:col-span-5 flex justify-center order-2 lg:order-1">
              <div className="relative w-full max-w-[420px] 2xl:max-w-[500px] aspect-square rounded-3xl overflow-hidden bg-slate-50 border border-slate-100 p-8 shadow-xs group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/MV-Power-Cable-BS.png"
                    alt="Polycab BS 7870-4-10 medium voltage copper wire screened power cable architecture"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500"
                    sizes="(max-width: 768px) 100vw, (max-width: 1536px) 420px, 500px"
                  />
                </div>
              </div>
            </div>

            {/* Right Column: Narrative Data */}
            <div className="lg:col-span-7 space-y-6 2xl: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 font-bold tracking-wider text-cyan-800 uppercase border border-cyan-200/60">
                Utility Power Distribution Networks
              </span>

              <h1 className="text-3xl md:text-4xl 2xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab BS 7870 MV Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl 2xl:text-3xl block mt-2">
                  Copper Wire Screened Medium Voltage Series
                </span>
              </h1>

              <div className="space-y-4 text-slate-600 text-sm md:text-base 2xl:text-lg leading-relaxed font-medium max-w-3xl">
                <p>
                  Polycab's medium voltage copper wire screened power cables conform precisely to the construction and testing benchmarks of <strong>BS 7870-4-10</strong>. These systems operate across high-tier utility voltage thresholds including <strong>6.35/11 (12) kV, 12.7/22 (24) kV, and 19/33 (36) kV</strong>.
                </p>
                <p>
                  Engineered with high environmental resistance profiles, they are tailored for municipal power distribution grids, underground direct burial setups, or installation inside industrial cable ducting networks.
                </p>
                <p>
                  Available in both standard <strong>single core and triplex formations</strong>, these assemblies carry a continuous conductor operating temperature rating of <strong>90°C</strong> and are certified to manage acute short-circuit thermal conditions up to <strong>250°C</strong>.
                </p>
              </div>

              {/* Parameter Block Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-slate-50 border border-slate-100 p-5 rounded-2xl shadow-xs">
                {coreTechnicalParameters.map((param, index) => (
                  <div key={index} className="bg-white border border-slate-200/60 p-4 rounded-xl text-center flex flex-col justify-center shadow-xs">
                    <span className="text-[10px] 2xl:text-xs text-slate-400 font-bold uppercase tracking-wider block mb-1">
                      {param.label}
                    </span>
                    <span className="text-xs 2xl:text-sm font-black text-slate-900 leading-snug">
                      {param.val}
                    </span>
                  </div>
                ))}
              </div>

              {/* Action Documentation Link Channels */}
              <div className="flex flex-wrap gap-4 pt-2">
                <Link
                  href="https://realswitchgears.com/assets/images/products/polycab-cable/mv-power-cable/pdf/MV-Power-Cable-BS_7870-4_10-20.pdf"
                  target="_blank"
                  className="inline-flex items-center gap-2 bg-slate-900 hover:bg-slate-800 text-white text-xs font-bold px-6 py-4 rounded-xl transition-all group"
                >
                  <FaDownload className="w-3.5 h-3.5 group-hover:translate-y-0.5 transition-transform" />
                  Download BS 7870 PDF
                </Link>
                <Link
                  href="/contact"
                  className="inline-flex items-center gap-2 bg-cyan-500 hover:bg-cyan-600 text-white text-xs font-bold px-6 py-4 rounded-xl transition-all shadow-sm"
                >
                  Send Enquiry <FaEnvelope className="w-3.5 h-3.5" />
                </Link>
              </div>
            </div>

          </div>

          {/* ─── CABLE MULTI-LAYER DATA COMPOSITION ARCHITECTURE ─── */}
          <div className="mb-24 2xl:mb-32">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-200/60 pb-5">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 text-cyan-600 rounded-xl">
                <LuBinary className="w-5 h-5 2xl:w-6 2xl:h-6" />
              </div>
              <div>
                <h2 className="text-xl font-black text-slate-900 2xl:text-2xl">Technical Layer Composition Matrix</h2>
                <p className="text-xs md:text-sm text-slate-500 font-medium mt-0.5">
                  Click through the primary manufacturing components below to view specialized raw materials and operational properties.
                </p>
              </div>
            </div>

            <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 2xl:gap-12 items-start">

              {/* Left Controller Group */}
              <div className="lg:col-span-5 space-y-2.5">
                {structuralLayers.map((layer) => (
                  <button
                    key={layer.id}
                    onClick={() => setActiveLayerId(layer.id)}
                    className={`w-full text-left p-4 2xl:p-5 rounded-xl border text-xs 2xl:text-sm font-bold transition-all flex items-center justify-between group ${activeLayerId === layer.id
                      ? "bg-cyan-500 text-white border-cyan-600 shadow-md shadow-cyan-500/10"
                      : "bg-slate-50 text-slate-700 border-slate-200/60 hover:bg-slate-100/80"
                      }`}
                  >
                    <span>{layer.componentName}</span>
                    <FaChevronRight className={`w-2.5 h-2.5 opacity-70 group-hover:translate-x-0.5 transition-transform ${activeLayerId === layer.id ? "text-white" : "text-slate-400"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Information Frame */}
              <div className="lg:col-span-7 bg-slate-50 border border-slate-200/60 rounded-2xl p-6 md:p-8 2xl:p-10 min-h-[280px] flex flex-col justify-between shadow-xs">
                {(() => {
                  const target = structuralLayers.find((l) => l.id === activeLayerId)!;
                  return (
                    <>
                      <div className="space-y-4">
                        <div>
                          <span className="text-[10px] 2xl:text-xs font-black tracking-widest text-cyan-600 uppercase block mb-1">
                            Material & Performance Blueprint
                          </span>
                          <h3 className="text-base md:text-lg font-black text-slate-900">
                            {target.componentName}
                          </h3>
                        </div>
                        <div className="inline-block bg-white text-slate-800 text-[11px] 2xl:text-xs font-extrabold px-3 py-1.5 rounded-md border border-slate-200 shadow-2xs">
                          {target.materialType}
                        </div>
                        <p className="text-xs md:text-sm 2xl:text-base text-slate-600 font-medium leading-relaxed pt-2">
                          {target.functionalRole}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-200/60 flex items-center justify-between text-[11px] 2xl:text-xs text-slate-400 font-bold">
                        <span className="flex items-center gap-1.5 text-cyan-600">
                          <LuCpu className="w-3.5 h-3.5" /> High Precision Machined
                        </span>
                        <span>BS 7870-4-10 Standard</span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── REVISED COMMERCIAL FEATURE GRID METRICS ───────────── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 2xl:gap-8 mb-24 2xl:mb-32">

            <div className="bg-slate-50 border border-slate-200/60 rounded-2xl p-6 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuDroplet className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs md:text-sm font-black text-slate-900">Water Swellable Barriers</h4>
                <p className="text-[11px] md:text-xs text-slate-500 font-medium leading-relaxed">
                  Dual-layer water swellable tape blocks radial or longitudinal moisture migration, securing sub-surface grids against wet soil degradation.
                </p>
              </div>
            </div>

            <div className="bg-slate-50 border border-slate-200/60 rounded-2xl p-6 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuWind className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs md:text-sm font-black text-slate-900">Advanced MDPE & LSZH Sheathing</h4>
                <p className="text-[11px] md:text-xs text-slate-500 font-medium leading-relaxed">
                  Outers available in specialized MDPE or Low Smoke Zero Halogen configurations for optimal mechanical abrasion resistance.
                </p>
              </div>
            </div>

            <div className="bg-slate-50 border border-slate-200/60 rounded-2xl p-6 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuThermometerSnowflake className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs md:text-sm font-black text-slate-900">Triplex Grid Configurations</h4>
                <p className="text-[11px] md:text-xs text-slate-500 font-medium leading-relaxed">
                  Supplied in standard single core or wound triplex groupings to decrease deployment timelines during complex trenching operations.
                </p>
              </div>
            </div>

          </div>

          {/* ─── PROCUREMENT CALL TO ACTION ─────────────────────── */}

          <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>
    </>
  );
}