"use client";

import React, { useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { FaDownload, FaEnvelope, FaChevronRight } from "react-icons/fa6";
import {
  LuLayers,
  LuThermometer,
  LuFlame,
  LuWorkflow,
  LuActivity,
  LuShieldAlert
} from "react-icons/lu";

export const metadata = {
  title: "Polycab AS/NZS 1429.1 MV HT Cables | Australia New Zealand Standard Power Cable",
  description: "Discover Polycab Medium Voltage High Tension power cables conforming to AS/NZS 1429.1. Available in XLPE/EPR variants graded from 1.9/3.3 kV to 19/33 kV.",
  keywords: ["Polycab AS/NZS 1429.1", "Australian Standard MV Cable", "Copper Wire Screen Cable", "Polyamide Nylon Termite Layer", "Lead Alloy Sheath Cable"],
};

interface CableLayer {
  id: string;
  name: string;
  materialSpec: string;
  benefit: string;
}

export default function PolycabAsNzsCableDetail() {
  const [activeLayerId, setActiveLayerId] = useState<string>("layer-1");

  const regionalSpecs = [
    { label: "Standard Code", val: "AS/NZS 1429.1" },
    { label: "Voltage Options", val: "1.9/3.3 kV to 19/33 kV" },
    { label: "Insulation Compounds", val: "XLPE (90°C) / EPR (105°C)" },
    { label: "Environmental Protection", val: "Nylon Termite & Lead Options" }
  ];

  const structuralBlueprint: CableLayer[] = [
    {
      id: "layer-1",
      name: "1. Core Conductor",
      materialSpec: "High conductivity annealed plain stranded compacted aluminium / copper",
      benefit: "Manufactured in-house using advanced drawing and compaction machinery to ensure minimal geometric resistance tolerances and balanced current distribution."
    },
    {
      id: "layer-2",
      name: "2. Conductor Screen",
      materialSpec: "Extruded layer of cross-linkable semi-conducting compound",
      benefit: "Bridges the gaps along the outer layer of the stranded core, smoothing structural edges to mitigate high-stress partial discharges at core interfaces."
    },
    {
      id: "layer-3",
      name: "3. Primary Thermoset Insulation",
      materialSpec: "In-house cross-linked Polyethylene (XLPE) or Ethylene Propylene Rubber (EPR)",
      benefit: "Delivers highly resilient electrical parameters. Rated at 90°C continuous running temperature for XLPE variants and up to 105°C for high-performance EPR variants."
    },
    {
      id: "layer-4",
      name: "4. Non-Metallic Insulation Screen",
      materialSpec: "Extruded layer of cross-linkable semi-conducting compound",
      benefit: "Applied in a synchronous triple-extrusion head with the conductor shield and insulation compound. This process seals out micro-voids to prolong standard service life."
    },
    {
      id: "layer-5",
      name: "5. Regional Metallic Screen Matrix",
      materialSpec: "Copper wire screen with optional helically applied copper tape",
      benefit: "Engineered specifically to conform to Oceanic system requirements, providing a high cross-sectional area to easily ground transient earth fault currents."
    },
    {
      id: "layer-6",
      name: "6. Laying Up & Geometric Fillers",
      materialSpec: "Laid up elements packed with in-house developed fillers",
      benefit: "For 3-core configurations, the individual insulated elements are stranded together with specialized binders to maximize perfect circularity. Includes an optional earth ground wire."
    },
    {
      id: "layer-7",
      name: "7. Protective Inner Sheath",
      materialSpec: "In-house formulated thermoplastic compound inner jacket",
      benefit: "Applied cleanly over the multi-core assembly to securely enclose and protect the laid-up elements prior to final armor or barrier installation steps."
    },
    {
      id: "layer-8",
      name: "8. Metallic Corrosion Sheath (Optional)",
      materialSpec: "Lead Alloy continuous layer protection",
      benefit: "Provides an absolute hermetic shield against hydrocarbon fuels, volatile moisture seepage, and aggressive chemical ions commonly encountered in chemical processing areas."
    },
    {
      id: "layer-9",
      name: "9. Insect Protective Layer (Optional)",
      materialSpec: "Polyamide Nylon jacket overlay",
      benefit: "Supplies a highly specialized tough exterior skin that effectively deters aggressive termite, borer, or underground insect attacks typical in tropical environments."
    },
    {
      id: "layer-10",
      name: "10. Heavy Outer Protect Sheath",
      materialSpec: "In-house developed thermoplastic low-smoke zero-halogen compound",
      benefit: "Shields internal elements from physical abrasion and climate exposure while restricting toxic smoke density and acidic gas output if subjected to structural fire events."
    }
  ];

  return (
    <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 PRESENTATION HEADER SECTION ──────────────── */}
        <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 items-center mb-20">

          {/* Left Column: Image Viewport */}
          <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="https://realswitchgears.com/assets/images/products/polycab-cable/mv-power-cable/MV-Power-Cable-AS-NZS.png"
                  alt="Polycab AS/NZS 1429.1 regional high tension medium voltage power cable"
                  fill
                  priority
                  className="object-contain group-hover:scale-105 transition-transform duration-500"
                  sizes="(max-width: 768px) 100vw, 420px"
                />
              </div>
            </div>
          </div>

          {/* Right Column: Asset Text Matrix */}
          <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-blue-50 px-4 py-1.5 text-xs font-bold tracking-wider text-blue-800 uppercase border border-blue-200">
              ANZ Regional Grid Specification
            </span>

            <h1 className="text-3xl md:text-4xl font-black tracking-tight text-slate-900 leading-tight">
              Polycab AS/NZS 1429.1 Cables <br />
              <span className="text-amber-600 font-extrabold text-xl md:text-2xl block mt-2">
                MV HT Commercial & Industrial Series
              </span>
            </h1>

            <div className="space-y-4 text-slate-600 text-sm md:text-base leading-relaxed font-medium">
              <p>
                Polycab Medium Voltage High Tension (MV HT) power cables comply fully with the strict manufacturing guidelines and safety provisions of the <strong>AS/NZS 1429.1 standard</strong>, managing network distribution capacities from <strong>1.9/3.3 kV up to 19/33 kV</strong>.
              </p>
              <p>
                Designed for high durability across diverse infrastructure networks, these cable systems are optimized for industrial plants, commercial centers, and dense residential zones—engineered for trouble-free operation inside trays, concrete troughs, open ducts, or via <strong>direct burial in challenging wet or dry earth environments</strong>.
              </p>
              <p>
                Configurations are supplied with advanced thermoset options, featuring high-purity <strong>XLPE (rated continuous at 90°C)</strong> or heavy-duty <strong>EPR insulation (rated at 105°C)</strong> to give you complete operational control over core thermal margins.
              </p>
              <p>
                Their <strong>halogen-free flame retardant characteristics</strong> provide essential security against fire spread, blending dependable continuous load delivery with active, long-term short-circuit security.
              </p>
            </div>

            {/* Quick Metrics Grid layout */}
            <div className="grid grid-cols-2 sm:grid-cols-4 gap-3 bg-white border border-slate-200 p-4 rounded-2xl shadow-xs">
              {regionalSpecs.map((spec, index) => (
                <div key={index} 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>

            {/* Catalog Action Links */}
            <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-AS-NZS.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 AS/NZS Catalog
              </Link>
              <Link
                href="/contact"
                className="inline-flex items-center gap-2 bg-amber-500 hover:bg-amber-600 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 INTERNAL STRUCTURAL LAYERS ─────────── */}
        <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">AS/NZS Material Breakdown Profile</h2>
              <p className="text-xs text-slate-500 font-medium">
                Select an engineering element level block below to verify material tolerances, protective coatings, and Oceanic screening attributes.
              </p>
            </div>
          </div>

          <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">

            {/* Left Hand Selection Stack Panel */}
            <div className="lg:col-span-5 max-h-[500px] overflow-y-auto pr-2 space-y-2 scrollbar-thin scrollbar-thumb-slate-200">
              {structuralBlueprint.map((layer) => (
                <button
                  key={layer.id}
                  onClick={() => setActiveLayerId(layer.id)}
                  className={`w-full text-left p-3.5 rounded-xl border text-xs font-bold transition-all flex items-center justify-between group ${activeLayerId === layer.id
                    ? "bg-amber-500 text-slate-950 border-amber-600 shadow-sm"
                    : "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 ${activeLayerId === layer.id ? "text-slate-950" : "text-slate-400"
                    }`} />
                </button>
              ))}
            </div>

            {/* Right Hand Profile Information Board */}
            <div className="lg:col-span-7 bg-white border border-slate-200 rounded-2xl p-6 md:p-8 min-h-[300px] flex flex-col justify-between shadow-xs">
              {(() => {
                const selectedLayer = structuralBlueprint.find((l) => l.id === activeLayerId)!;
                return (
                  <>
                    <div className="space-y-4">
                      <div>
                        <span className="text-[10px] font-black tracking-widest text-amber-600 uppercase block mb-1">
                          Material Sub-Element Technical Profile
                        </span>
                        <h3 className="text-base font-black text-slate-900">
                          {selectedLayer.name.substring(3)}
                        </h3>
                      </div>
                      <div className="inline-block bg-slate-100 text-slate-800 text-[11px] font-extrabold px-3 py-1.5 rounded-md border border-slate-200">
                        {selectedLayer.materialSpec}
                      </div>
                      <p className="text-xs md:text-sm text-slate-600 font-medium leading-relaxed pt-2">
                        {selectedLayer.benefit}
                      </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">
                        <LuWorkflow className="w-3.5 h-3.5" /> High Precision Drawing
                      </span>
                      <span>AS/NZS 1429.1 Compliance Confirmed</span>
                    </div>
                  </>
                );
              })()}
            </div>

          </div>
        </div>

        {/* ─── ADDED ADVANTAGES METRICS HIGHLIGHTS ─────────────── */}
        <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-amber-50 border border-amber-100 rounded-xl text-amber-700 shrink-0">
              <LuThermometer className="w-5 h-5" />
            </div>
            <div className="space-y-1">
              <h4 className="text-xs font-black text-slate-900">Flexible Thermal Formations</h4>
              <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                Choose between highly stable 90°C XLPE configurations or 105°C thermoset EPR cores to optimize baseline circuit limits.
              </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-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">Low-Toxicity Outers</h4>
              <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                In-house halogen-free thermoplastic jackets significantly lower volatile acid smoke gas emission hazards inside deep cable galleries.
              </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">
              <LuActivity className="w-5 h-5" />
            </div>
            <div className="space-y-1">
              <h4 className="text-xs font-black text-slate-900">Termite & Pest Defenses</h4>
              <p className="text-[11px] text-slate-500 font-medium leading-relaxed">
                Optional premium Polyamide Nylon inner jacket overlays protect standard insulation materials from persistent insect attacks.
              </p>
            </div>
          </div>
        </div>

        {/* ─── REGIONAL PROCUREMENT CALL TO ACTION ─────────────── */}
        <div className="bg-gradient-to-br from-slate-900 to-slate-800 text-white rounded-3xl p-8 md:p-12 text-center max-w-4xl mx-auto shadow-xs">
          <div className="inline-flex p-3 bg-slate-800 rounded-2xl border border-slate-700 text-amber-500 mb-4">
            <LuShieldAlert className="w-6 h-6" />
          </div>
          <h3 className="text-xl md:text-2xl font-black text-white mb-3">
            Source Certified AS/NZS 1429.1 Power Infrastructure Cables
          </h3>
          <p className="text-slate-400 text-sm max-w-xl mx-auto mb-8 font-medium">
            Reach out directly to our Oceania distribution team to verify custom wire gauge arrangements, obtain lead alloy configurations, or secure project quotes.
          </p>
          <div className="flex flex-col sm:flex-row justify-center items-center gap-4">
            <Link
              href="https://realswitchgears.com/assets/images/products/polycab-cable/mv-power-cable/pdf/MV-Power-Cable-AS-NZS.pdf"
              target="_blank"
              className="inline-flex items-center gap-2 bg-slate-800 hover:bg-slate-700 text-white text-xs font-bold px-8 py-4 rounded-full transition-all w-full sm:w-auto justify-center uppercase tracking-wider border border-slate-700"
            >
              <FaDownload className="w-3.5 h-3.5" /> Technical Specification PDF
            </Link>
            <Link
              href="/contact"
              className="inline-flex items-center gap-2 bg-amber-500 hover:bg-amber-600 text-slate-950 text-xs font-bold px-8 py-4 rounded-full transition-all duration-200 active:scale-95 shadow-md shadow-amber-500/10 w-full sm:w-auto justify-center uppercase tracking-wider"
            >
              Request Commercial Quote
              <FaChevronRight className="w-3 h-3" />
            </Link>
          </div>
        </div>

      </div >
    </div >
  );
}