"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,
  LuShieldCheck,
  LuZap,
  LuActivity,
  LuIterationCcw,
  LuCpu
} from "react-icons/lu";
import Breadcrumb 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 Welding Cables | IS 9857 & BS 638 Flexible Wire",
//   description: "Explore Polycab rubber insulated welding cables conforming to IS 9857 and BS 638. High-conductivity Class 6 extra flexible copper lines with HOFR elastomeric sheathing.",
//   keywords: ["Polycab Welding Cable", "IS 9857 Cable", "BS 638 Wire", "HOFR Elastomeric Cable", "Class 6 Flexible Copper"],
// };

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabWeldingCableIS() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Standard Class", val: "IS 9857 / BS 638" },
    { label: "Flexibility Rating", val: "Class 6 Extra Flex" },
    { label: "Sheath Armor", val: "HOFR Elastomeric" },
    { label: "Core Metal", val: "Bunched Plain Copper" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "High-Conductivity Bunched Extra Flexible (Class 6) Copper Conductor",
      category: "Conductor Core Architecture",
      technicalDetails: "Engineered with ultra-fine, high-conductivity bunched plain copper wires classified under Class 6 flexibility ratings. Produced completely in-house via state-of-the-art drawing machinery, this structure provides maximum kinking resistance and effortless structural yielding along crowded shop floors."
    },
    {
      id: "spec-2",
      title: "In-House Developed Cross Linked HOFR Elastomeric Sheath",
      category: "Heavy Duty Protection Shell",
      technicalDetails: "Protected by an in-house developed, cross-linked elastomeric heat & oil resistant flame retardant (HOFR) compound extruded directly around the bunched conductor core. This thermosetting formulation exhibits heavy resistance against volatile slag spatters, high thermal loads, ozone, mechanical tearing, and lubricating oil spills."
    },
    {
      id: "spec-3",
      title: "Dynamic Duty Cycle Optimization Matrix",
      category: "Application Engineering",
      technicalDetails: "The entire cable architecture and compound layering are customized specifically to match variable duty cycle demands outlined in IS 9857. This ensures high structural life and safety thresholds under continuous manual operations or high-speed automated assembly welding lines."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab Rubber Welding Cables" />
      <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">
        {/* Expanded Container maximum widths for seamless 2K and 4K display optimization */}
        <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/Industrial-welding-Cable-IS.png"
                    alt="Polycab Rubber Insulated Extra Flexible Industrial Welding 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 9857 &amp; BS 638 Standard • Toughened Elastomeric Secondary Lines
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab Welding Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl xl:text-3xl block mt-3">
                  Rubber Insulated Class 6 Extra Flexible HOFR Heavy-Industrial Power Links
                </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 high-performance <strong>Rubber Insulated Welding Cables</strong> offer an exceptional blend of electrical transmission capacity and rugged field survival, conforming explicitly to the Bureau of Indian Standards <strong>IS 9857</strong> and British Standard <strong>BS 638</strong> specifications.
                </p>
                <p>
                  Featuring an ultra-supple <strong>Class 6 bunched copper core</strong> combined with premium cross-linked insulation, these heavy-duty secondary power lines easily tolerate high voltage drops and mechanical friction on rough industrial surfaces.
                </p>
                <p>
                  Specially designed to maintain structural integrity across both rapid <strong>automated robotic welding stations</strong> and rugged <strong>manual field welding setups</strong>, they deliver optimal current routing through fluctuating duty cycles and high-load thermal swings.
                </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/products/polycab-cable/industrial-welding-cable/pdf/Industrial-welding-Cable-IS.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 9857 Catalogue
                </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; Material Profile</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Select an extrusion layer module below to evaluate the specific mechanical compounds and structural properties of Polycab's welding matrix.
                </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-[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-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" /> Full Rigorous Stage-by-Stage Machine Testing
                        </span>
                        <span className="text-cyan-600 bg-cyan-50 px-2.5 py-0.5 rounded-md border border-cyan-100 w-fit">
                          IS 9857 BIS Compliant
                        </span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── INDUSTRIAL APPLICATIONS & APPLICATION UTILITY 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">
                <LuZap 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 Current Arc Support</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Optimized to handle high-amperage power transfers safely across multiple secondary manual arc-welding installations.
                </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">
                <LuIterationCcw 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">Automated Robotic Welding</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Class 6 multi-strand cores prevent fatigue failure when subjected to constant robotic arm twisting and high duty cycles.
                </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">Aggressive Environmental Shield</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  The tough, in-house developed elastomeric HOFR wrapper withstands mechanical abrasion, sparks, and crude oil contamination.
                </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>
    </>
  );
}