"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,
  LuFlame,
  LuWrench,
  LuDroplet
} 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-1 Wire",
//   description: "Explore Polycab rubber insulated flexible elastomeric cables conforming to IS 9968-1. Premium EPR insulated, HOFR sheathed industrial power cables.",
//   keywords: ["Polycab Rubber Cable", "IS 9968-1 Elastomeric Cable", "EPR Insulated Wire", "HOFR Sheathing", "Flexible Portable Cable"],
// };

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabRubberFlexibleCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Standard Class", val: "IS 9968-1" },
    { label: "Primary Core", val: "Tin Coated Copper" },
    { label: "Insulation Matrix", val: "Cross-Linked EPR" },
    { label: "Sheath Formulations", val: "PCP / CSP / HOFR" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Tin Coated Copper Conductor Architecture",
      category: "Conductor Infrastructure",
      technicalDetails: "Constructed using high-conductivity solid, stranded, or bunched copper conductors engineered in-house. A uniform tin coating is applied using state-of-the-art machinery to defend the core against oxidation and atmospheric degradation."
    },
    {
      id: "spec-2",
      title: "Optional Proofed / Synthetic Separator",
      category: "Core Isolation Layer",
      technicalDetails: "Features an optional high-grade proofed cotton tape or synthetic polyester tape layer positioned between the tinned conductor and primary insulation to maintain high flex-life and prevent compounding adhesion."
    },
    {
      id: "spec-3",
      title: "Cross-Linked EPR Insulation Matrix",
      category: "Primary Dielectric Layer",
      technicalDetails: "Insulated with Polycab's proprietary, in-house developed cross-linked elastomeric Ethylene Propylene Rubber (EPR) compound, striking an optimal balance between electrical integrity and physical flexibility."
    },
    {
      id: "spec-4",
      title: "Zero-Halogen / Elastomeric Bedding",
      category: "Internal Bedding Base",
      technicalDetails: "Built with an internal bedding layer consisting of a zero-halogen elastomeric compound or standard high-performance elastomeric matrix to protect inner core layouts from multi-axis shear stresses."
    },
    {
      id: "spec-5",
      title: "Specialized Multi-Material Braiding Options",
      category: "Structural Reinforcement",
      technicalDetails: "Configurable with custom-selected structural overlays including magnetic wire braiding, non-magnetic wire braiding, glass fiber braiding, or classic high-tensile textile braiding to combat heavy tensile pull."
    },
    {
      id: "spec-6",
      title: "Proprietary Elastomeric External Sheathing",
      category: "Environmental Defense Shell",
      technicalDetails: "Finished with premium in-house developed cross-linked elastomeric sheathing options. Available in Polychloroprene (PCP), Chlorosulphonated Polyethylene (CSP), Heat & Oil Resistant Flame Retardant (HOFR), NBR-PVC, or SE4 formulations depending on structural requirements."
    },
    {
      id: "spec-7",
      title: "IS 9968 Structural Compliance Profiles",
      category: "Regulatory Design Guidelines",
      technicalDetails: "The absolute geometry, wall thickness dimensions, and compounding envelopes are customized around user specifications while fully conforming to or exceeding the design rules of Indian Standard IS 9968-1."
    }
  ];

  return (
    <>
      <Breadcrumbs pageName="Polycab Rubber Cable" description="Polycab EPR Insulated HT Flexible Elastomeric Cables conforming to IS 9968-1. Premium EPR insulated, HOFR sheathed industrial power cables." />

      {/* Pristine white background & extended breakpoint wrappers for maximum resolution desktop displays */}
      <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">

            {/* 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-3xl overflow-hidden bg-slate-50 border border-slate-100 p-8 shadow-sm group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/Rubber-Cable-IS_9968-P1.png"
                    alt="Polycab Rubber Insulated Flexible Elastomeric Cable"
                    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-1 Standard • Heavy Duty Industrial Elastomer
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab Flexible Rubber Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl block mt-3">
                  EPR/HOFR Insulated Portable Machinery Distribution Lines
                </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-4xl">
                <p>
                  Polycab’s <strong>Rubber Insulated Flexible Elastomeric Cables</strong> deliver rugged, reliable performance for mobile machinery and portable electrical infrastructure, built in strict compliance with the <strong>IS 9968-1</strong> standard.
                </p>
                <p>
                  Industrial machinery requires power cables capable of enduring harsh mechanical wear. These high-flexibility cables are engineered to withstand continuous friction, bending fatigue, aggressive weather variations, heat exposure, and petrochemical contamination.
                </p>
                <p>
                  They are ideally suited for main connections in heavy-duty tools, commercial appliances, temporary lighting networks, and high-capacity industrial equipment that demands structural flexibility under continuous power load.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-slate-50 border border-slate-100 p-4 xl:p-6 rounded-2xl shadow-xs max-w-3xl">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-white 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="/images/polycab/Rubber-Cable-IS_9968-P1.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-1 Specification Sheet
                </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>

          {/* ─── INTERACTIVE ARCHITECTURE SPECIFICATION VIEWER ──── */}
          <div className="mb-24 lg:mb-32">
            <div className="flex items-center gap-3 mb-10 border-b border-slate-100 pb-5">
              <div className="p-2.5 bg-cyan-50 border border-cyan-100 text-cyan-600 rounded-xl">
                <LuLayers className="w-6 h-6" />
              </div>
              <div>
                <h2 className="text-xl font-black text-slate-900 xl:text-2xl">Technical Specifications &amp; Multi-Core Layering Data</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Review internal shielding options, tinned core designs, and high-performance outer elastomeric sheathing options.
                </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-slate-50 text-slate-700 border-slate-100 hover:bg-slate-100"
                      }`}
                  >
                    <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-slate-50 border border-slate-100 rounded-2xl p-6 md:p-8 xl:p-10 min-h-[220px] 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-200/60">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-6 pt-4 border-t border-slate-200/60 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" /> High Tear Strength Elastomer
                        </span>
                        <span className="text-cyan-600 bg-cyan-50 px-2.5 py-0.5 rounded-md border border-cyan-100 w-fit">
                          IS 9968-1 Configuration Profile
                        </span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── TECHNICAL 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">
                <LuWrench 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">High Wear &amp; Tear Durability</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Engineered with high mechanical durability to handle the regular pulling, twisting, and dragging forces typical of heavy machinery operations.
                </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">
                <LuDroplet 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">Oil, Grease, &amp; Chemical Shield</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Specialized external sheathing ensures stable performance in areas prone to oil, grease, or chemical spills without material degradation.
                </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">
                <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">High Heat Zone Compatibility</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Cross-linked rubber structures maintain electrical and mechanical integrity in extreme high-temperature environments.
                </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>
    </>
  );
}