"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,
  LuSparkles,
  LuShieldCheck,
  LuActivity,
  LuFlame,
  LuSun,
  LuShieldAlert
} 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 Rubber Flexible Elastomeric Cables | IS 9968-2 Wire",
//   description: "Explore Polycab rubber insulated flexible elastomeric cables conforming to IS 9968-2. Premium EPR insulated, HOFR sheathed industrial power cables.",
//   keywords: ["Polycab Rubber Cable", "IS 9968-2 Elastomeric Cable", "EPR Insulated Wire", "HOFR Sheathing", "Flexible Portable Cable"],
// };

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabHtRubberCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Standard Class", val: "IS 9968-2" },
    { label: "Max Operating Temp", val: "90°C Continuous" },
    { label: "Short Circuit Peak", val: "250°C Max Limit" },
    { label: "Voltage Scope", val: "1.9/3.3kV to 19/33kV" }
  ];

  const voltageGrades = [
    "1.9/3.3kv(E)", "3.8/6.6kv(E)", "6.35/11kv(E)",
    "6.6/6.6kv(UE)", "12.7/22kv(E)", "11/11kv(UE)", "19/33kv(E)"
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Tin Coated Flexible Copper Conductor",
      category: "Conductor Infrastructure",
      technicalDetails: "Constructed with high-conductivity tin-coated flexible copper conductors produced entirely in-house using state-of-the-art machinery. The tin coating ensures outstanding protection against atmospheric corrosion and chemical oxidation in heavy industrial environments."
    },
    {
      id: "spec-2",
      title: "Advanced Conductor Screening (≥ 6.35/11kv)",
      category: "Stress Management",
      technicalDetails: "For voltage ratings of 6.35/11kv(E) and above, the conductor is screened by a high-grade semi-conducting tape followed by an extruded semi-conducting layer. This eliminates electrical stress concentrations at the conductor boundaries."
    },
    {
      id: "spec-3",
      title: "Elastomeric Ethylene Propylene Rubber (EPR)",
      category: "Dielectric Matrix",
      technicalDetails: "Insulated with Polycab's specially formulated, in-house developed elastomeric ethylene propylene rubber (EPR) compound. This matrix provides high dielectric strength, remarkable structural flexibility, and thermal endurance up to a 90°C continuous limit."
    },
    {
      id: "spec-4",
      title: "Insulation Screening & Metallic Shielding",
      category: "Electrical Protection",
      technicalDetails: "For configurations rated at 6.35/11kv(E) and above, insulation shielding is achieved via semi-conducting tape accompanied by an extruded semi-conducting layer and a tinned copper wire braid acting as a highly efficient metallic screen."
    },
    {
      id: "spec-5",
      title: "HOFR Reinforcing External Sheath",
      category: "Environmental Defense Shell",
      technicalDetails: "Protected by an in-house developed Heat & Oil Resistant Flame Retardant (HOFR) reinforcing sheath. This external jacket safeguards the internal cores against thermal degradation, hydrocarbon splash, and flame propagation."
    },
    {
      id: "spec-6",
      title: "IS 9968-2 Architectural Compliance",
      category: "Regulatory Standards",
      technicalDetails: "The absolute layout and material properties are customized based on specific user requirements and industrial applications, conforming perfectly to or exceeding the statutory design rules of Indian Standard IS 9968-2."
    }
  ];

  return (
    <>
      <Breadcrumbs pageName="Polycab Rubber Cable" description="Polycab EPR Insulated HT Flexible Elastomeric Cables conforming to IS 9968-2. Premium EPR insulated, HOFR sheathed industrial power cables." />

      {/* Pristine white background & extended breakpoint layout configurations optimized for up to 1920px+ ultra-wide desktop monitors */}
      <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 bg-slate-50 p-6 md:p-10 xl:p-14 rounded-3xl border border-slate-100 shadow-xs">

            {/* 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 overflow-hidden bg-white border border-slate-100 p-8 shadow-xs group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/Rubber-Cable-IS_9968-P2.png"
                    alt="Polycab EPR Insulated HT Flexible Elastomeric Cable conforming to IS 9968-2"
                    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">
                IS 9968-2 Certified • High Voltage Elastomeric Line
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab HT Rubber Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl xl:text-3xl block mt-3">
                  EPR Insulated Single &amp; Three Core High-Voltage Series
                </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-5xl">
                <p>
                  Polycab’s comprehensive range of <strong>High Tension (HT) Rubber Flexible Cables</strong> delivers world-class power transmission resilience under intense physical conditions, conforming explicitly to the <strong>IS 9968-2</strong> standard.
                </p>
                <p>
                  Available across versatile voltage spectrums ranging from 1.9/3.3kv(E) up to 19/33kv(E) in both <strong>single core and three core</strong> variations, these elastomeric systems support a <strong>90°C regular operating ceiling</strong> and can survive severe short-circuit conductor temperatures up to <strong>250°C</strong> without dielectric compromise.
                </p>
                <p>
                  Engineered specifically for heavy duty applications, this robust layout offers supreme protection inside steel mills, wind power installations, marine vessels, textile plants, and heavy generating turbines due to its elite immunity against <strong>Heat, Oil, Ozone, and UV rays</strong>.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-white border border-slate-150 p-4 xl:p-6 rounded-2xl shadow-xs max-w-4xl">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-slate-50 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/rubber-cable/pdf/Rubber-Cable-IS_9968-P2.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 IS 9968-2 HT 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>

          {/* ─── AVAILABLE VOLTAGE GRADES CHIPS ───────────────── */}
          <div className="mb-20 bg-slate-50 border border-slate-100 rounded-2xl p-6 xl:p-8 shadow-xs">
            <h3 className="text-xs xl:text-sm font-black text-slate-900 uppercase tracking-wider mb-4 flex items-center gap-2 text-cyan-600">
              <LuShieldAlert className="w-4 h-4 xl:w-5 h-5" /> Available Standard Voltage Matrices
            </h3>
            <div className="flex flex-wrap gap-2.5">
              {voltageGrades.map((grade, i) => (
                <span key={i} className="bg-white border border-slate-200 text-slate-700 text-xs xl:text-sm font-bold px-4 py-2.5 rounded-xl shadow-2xs transition-all hover:border-cyan-300">
                  {grade}
                </span>
              ))}
            </div>
          </div>

          {/* ─── INTERACTIVE ARCHITECTURE SPECIFICATION VIEWER ──── */}
          <div className="mb-24 lg:mb-32 bg-slate-50 p-6 md:p-10 xl:p-14 rounded-3xl border border-slate-100 shadow-xs">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-200 pb-5">
              <div className="p-2.5 bg-white border border-slate-200 text-cyan-600 rounded-xl shadow-2xs">
                <LuLayers className="w-6 h-6" />
              </div>
              <div>
                <h2 className="text-xl font-black text-slate-900 xl:text-2xl">Technical Specifications &amp; Extrusion Profiles</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Interact with the layers below to view the structural composition—from tinned copper lines to semi-conducting screens.
                </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-white text-slate-700 border-slate-200 hover:bg-slate-100 shadow-2xs"
                      }`}
                  >
                    <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-white border border-slate-200 rounded-2xl p-6 md:p-8 xl:p-10 min-h-[240px] 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-100">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-100 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" /> Stringent Raw Material to Finished Testing
                        </span>
                        <span className="text-cyan-600 bg-cyan-50 px-2.5 py-0.5 rounded-md border border-cyan-100 w-fit">
                          HOFR Reinforced Shell
                        </span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── INDUSTRIAL ADVANTAGE 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">
                <LuFlame 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">Thermal &amp; Oil Protection</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  HOFR sheathing acts as an industrial shield, resisting degradation from ambient heat spikes and petroleum oils.
                </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">
                <LuSun 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">Ozone &amp; UV Degradation Resistance</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Formulated to prevent surface cracking or dielectric degradation when exposed to heavy ozone arcs and continuous direct sunlight.
                </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">
                <LuActivity 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">Dynamic Rotational Elasticity</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Finely tuned multi-strand copper architecture offers effortless flex cycles for heavy power turbines and marine equipment.
                </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>
    </>
  );
}