"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,
  LuLayers,
  LuZap,
  LuFlame,
  LuWorkflow,
  LuSettings
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";

// Next.js SEO Metadata Configuration
// export const metadata = {
//   title: "Polycab IEC 60502-2 MV HT Cables | Medium Voltage Power Systems",
//   description: "Explore Polycab Medium Voltage High Tension power cables conforming to IEC 60502-2. Delivering 3.6 kV to 36 kV options featuring halogen-free flame retardant protection.",
//   keywords: ["Polycab IEC 60502-2", "Medium Voltage Cable", "High Tension Power Cable", "Triple Extrusion Cable", "Halogen Free Flame Retardant", "Direct Burial Cable"],
// };

interface TechLayer {
  id: string;
  name: string;
  material: string;
  advantage: string;
}

export default function PolycabIecMvCableDetail() {
  const [selectedLayer, setSelectedLayer] = useState<string>("layer-1");

  const engineeringSpecs = [
    { label: "Standard Baseline", val: "IEC 60502 - 2" },
    { label: "Voltage Grade Spectrum", val: "3.6 kV up to 36 kV" },
    { label: "Thermal Limit", val: "90°C Rated XLPE Core" },
    { label: "Safety Profile", val: "Halogen Free Flame Retardant" }
  ];

  const layerBreakdown: TechLayer[] = [
    {
      id: "layer-1",
      name: "1. Core Conductor",
      material: "High Conductivity Annealed Plain Stranded Compacted Aluminium / Copper",
      advantage: "Processed in-house using premium wire-drawing machines to maximize electrical throughput while maintaining a highly uniform, compact cross-section."
    },
    {
      id: "layer-2",
      name: "2. Conductor Screen Shielding",
      material: "Extruded Layer of Cross-Linkable Semi-Conducting Compound",
      advantage: "Eliminates potential sharp microscopic points on the raw conductor surface, nullifying the risk of electrical discharge or tracking at the critical interface."
    },
    {
      id: "layer-3",
      name: "3. Primary Thermoset Insulation",
      material: "In-House Formulated Cross-Linked Polyethylene (XLPE)",
      advantage: "Delivers exceptionally high insulation resistance alongside high dielectric strength to easily manage heavy continuous high-temperature loads."
    },
    {
      id: "layer-4",
      name: "4. Non-Metallic Insulation Screen",
      material: "Extruded Layer of Cross-Linkable Semi-Conducting Compound",
      advantage: "Applied via an advanced simultaneous triple-extrusion process. This completely eliminates micro-voids during curing, yielding a longer structural lifespan."
    },
    {
      id: "layer-5",
      name: "5. Ground Metallic Screen",
      material: "Helically Applied Pure Copper Tape Matrix",
      advantage: "Provides a reliable path for system fault currents, efficiently mitigating electrical stresses and preventing dangerous line faults."
    }
  ];

  return (
    <>
      <Breadcrumb
        pageName="Polycab IEC 60502-2 MV Cables"
        description="Polycab Medium Voltage High Tension power cables conforming to IEC 60502-2. Delivering 3.6 kV to 36 kV options featuring halogen-free flame retardant protection."
      />
      <div className="min-h-screen bg-slate-50 text-slate-800 py-16 lg:py-24 selection:bg-amber-100 selection:text-amber-950">
        <div className="container mx-auto px-4 max-w-7xl">

          {/* ─── HERO BLOCK & PRODUCT IMAGE CONTAINER ───────────── */}
          <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 items-center mb-20">

            {/* Left Layout Box: Product Visual Frame */}
            <div className="lg:col-span-5 flex justify-center order-2 lg:order-1">
              <div className="relative w-full max-w-[420px] aspect-square rounded-3xl overflow-hidden bg-white border border-slate-200 p-6 shadow-xs group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/MV-Power-Cable-IEC-60502-2.png"
                    alt="Polycab IEC 60502-2 medium voltage high tension power cable cross sectional profile"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500"
                    sizes="(max-width: 768px) 100vw, 420px"
                  />
                </div>
              </div>
            </div>

            {/* Right Layout Box: Context and Descriptive Copy */}
            <div className="lg:col-span-7 space-y-6 order-1 lg:order-2">
              <span className="inline-flex items-center gap-1.5 rounded-full bg-slate-100 px-4 py-1.5 text-xs font-bold tracking-wider text-slate-700 uppercase border border-slate-200">
                International Utility Standard
              </span>

              <h1 className="text-3xl md:text-4xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab IEC 60502-2 MV Cables <br />
                <span className="text-cyan-500 font-extrabold text-xl md:text-2xl block mt-2">
                  High Tension Power Distribution Networks
                </span>
              </h1>

              <div className="space-y-4 text-slate-600 text-sm md:text-base leading-relaxed font-medium">
                <p>
                  Polycab’s Medium Voltage High Tension (MV HT) power cables are precisely certified to the globally recognized
                  <strong> IEC 60502-2 standard</strong>, processing operational transmission thresholds ranging from <strong>3.6 kV to 36 kV</strong>.
                </p>
                <p>
                  These high-capacity power systems are highly recommended for municipal infrastructure grids, underground networks, external cable ducting channels, and direct burial installations where long-term line safety is essential.
                </p>
                <p>
                  Equipped with custom <strong>halogen-free flame retardant (HFFR)</strong> properties, they supply steady load distribution alongside enhanced structural protection during sudden short-circuit scenarios or open-fire emergencies.
                </p>
              </div>

              {/* Quick Metrics Reference Board */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-3 bg-white border border-slate-200 p-4 rounded-2xl shadow-xs">
                {engineeringSpecs.map((spec, idx) => (
                  <div key={idx} className="bg-slate-50 border border-slate-100 p-3 rounded-xl text-center flex flex-col justify-center">
                    <span className="text-[10px] text-slate-400 font-bold uppercase tracking-wider block mb-1">
                      {spec.label}
                    </span>
                    <span className="text-xs font-black text-slate-900 leading-snug">
                      {spec.val}
                    </span>
                  </div>
                ))}
              </div>

              {/* Direct Commercial CTAs */}
              <div className="flex flex-wrap gap-4 pt-2">
                <Link
                  href="/images/products/polycab-cable/mv-power-cable/pdf/MV-Power-Cable-IEC-60502-2.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-3.5 rounded-xl transition-all group"
                >
                  <FaDownload className="w-3.5 h-3.5 group-hover:translate-y-0.5 transition-transform" />
                  Download IEC Catalogue
                </Link>
                <Link
                  href="/contact"
                  className="inline-flex items-center gap-2 bg-cyan-500 hover:bg-cyan-500 text-slate-950 text-xs font-bold px-6 py-3.5 rounded-xl transition-all shadow-sm"
                >
                  Send Enquiry <FaEnvelope className="w-3.5 h-3.5" />
                </Link>
              </div>
            </div>

          </div>

          {/* ─── INTERACTIVE LAYER DATA ARCHITECTURE MONITOR ───────── */}
          <div className="mb-20">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-200/60 pb-4">
              <div className="p-2 bg-slate-100 border border-slate-200 text-slate-700 rounded-xl">
                <LuLayers className="w-5 h-5" />
              </div>
              <div>
                <h2 className="text-lg font-black text-slate-900">Technical Core Engineering Breakdown</h2>
                <p className="text-xs text-slate-500 font-medium">
                  Select an internal manufacturing layer component below to inspect specialized material behaviors and discharge protection criteria.
                </p>
              </div>
            </div>

            <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">

              {/* Left Box Panel Layout Controls */}
              <div className="lg:col-span-5 space-y-2">
                {layerBreakdown.map((layer) => (
                  <button
                    key={layer.id}
                    onClick={() => setSelectedLayer(layer.id)}
                    className={`w-full text-left p-4 rounded-xl border text-xs font-bold transition-all flex items-center justify-between group ${selectedLayer === layer.id
                      ? "bg-cyan-500 text-slate-950 border-cyan-500 shadow-xs"
                      : "bg-white text-slate-700 border-slate-200 hover:bg-slate-100"
                      }`}
                  >
                    <span className="truncate">{layer.name}</span>
                    <FaChevronRight className={`w-2.5 h-2.5 opacity-70 group-hover:translate-x-0.5 transition-transform ${selectedLayer === layer.id ? "text-slate-950" : "text-slate-400"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Interactive Structural Information Dashboard */}
              <div className="lg:col-span-7 bg-white border border-slate-200 rounded-2xl p-6 md:p-8 min-h-[260px] flex flex-col justify-between shadow-xs">
                {(() => {
                  const item = layerBreakdown.find((l) => l.id === selectedLayer)!;
                  return (
                    <>
                      <div className="space-y-4">
                        <div>
                          <span className="text-[10px] font-black tracking-widest text-amber-600 uppercase block mb-1">
                            Layer Composition Matrix
                          </span>
                          <h3 className="text-base font-black text-slate-900">
                            {item.name.substring(3)}
                          </h3>
                        </div>
                        <div className="inline-block bg-slate-100 text-slate-800 text-[11px] font-extrabold px-3 py-1 rounded-md border border-slate-200">
                          {item.material}
                        </div>
                        <p className="text-xs md:text-sm text-slate-600 font-medium leading-relaxed pt-2">
                          {item.advantage}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-100 flex items-center justify-between text-[11px] text-slate-400 font-bold">
                        <span className="flex items-center gap-1 text-blue-600">
                          <LuSettings className="w-3.5 h-3.5 animate-spin-slow" /> Factory Cured Core
                        </span>
                        <span>IEC 60502 Part II Standard</span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── ADDED ADVANTAGES VALUE TILES ─────────────────────── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-20">
            <div className="bg-white border border-slate-200 rounded-2xl p-5 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-rose-50 border border-rose-100 rounded-xl text-rose-700 shrink-0">
                <LuFlame className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs font-black text-slate-900">Halogen-Free Safety</h4>
                <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                  Utilizes advanced raw materials to minimize toxic gas emissions and smoke opacity under critical thermal emergencies.
                </p>
              </div>
            </div>
            <div className="bg-white border border-slate-200 rounded-2xl p-5 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-amber-50 border border-amber-100 rounded-xl text-amber-700 shrink-0">
                <LuZap className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs font-black text-slate-900">Triple Extrusion Layering</h4>
                <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                  The conductor shield, primary XLPE layer, and non-metallic outer shield are extruded simultaneously to prevent any potential micro-void vulnerabilities.
                </p>
              </div>
            </div>
            <div className="bg-white border border-slate-200 rounded-2xl p-5 shadow-xs flex items-start gap-4">
              <div className="p-2.5 bg-blue-50 border border-blue-100 rounded-xl text-blue-700 shrink-0">
                <LuWorkflow className="w-5 h-5" />
              </div>
              <div className="space-y-1">
                <h4 className="text-xs font-black text-slate-900">Extreme Environment Deployment</h4>
                <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                  Engineered with high mechanical resistance properties, allowing for direct burial inside challenging soils or complex industrial cable runs.
                </p>
              </div>
            </div>
          </div>

          {/* ─── COMMERCIAL ENQUIRY HUB CALLOUT ──────────────────── */}
          <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 >
    </>
  );
}