"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,
  LuBuilding2,
  LuRadio,
  LuHammer,
  LuCpu
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";
// Extracted metadata object if needed elsewhere (Note: App Router requires metadata in server components)
// export const metadata = {
//   title: "Polycab BMS Cables | Building Management System Wiring",
//   description: "Explore Polycab BMS cables for building automation systems. Featuring EMI suppression shielding and high-insulation resistance PVC conforming to IS 694 guidelines.",
//   keywords: ["Polycab BMS Cable", "Building Management System", "IS 694 Cable", "EMI Suppression Wiring", "Automation Shielded Wire"],
// };

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabBmsCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Application Class", val: "BMS Automation" },
    { label: "Compliance Model", val: "IS 694 Guideline" },
    { label: "Core Processing", val: "Contirod Plain Copper" },
    { label: "Noise Protection", val: "Metallic Shielding" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "High Conductivity Annealed Plain Bunched/Stranded Copper Conductor",
      category: "Conductor Infrastructure",
      technicalDetails: "Formed with superior, high-conductivity annealed plain bunched or stranded copper elements. Processed completely in-house using an advanced, state-of-the-art Contirod line, these conductor bundles offer exceptional signal integrity and easy routing paths through complex interior structural grids."
    },
    {
      id: "spec-2",
      title: "In-House Developed High Insulation Resistance Thermoplastic PVC",
      category: "Dielectric Insulation Layer",
      technicalDetails: "Wrapped in a specialized, in-house formulated thermoplastic PVC compound optimized for excellent insulation resistance. This dielectric skin limits line-to-line current leaks, ensures uniform capacitance properties, and prevents premature voltage failure inside enclosed conduit networks."
    },
    {
      id: "spec-3",
      title: "Specially Formulated PVC Sheathing for Mechanical Protection",
      category: "External Jacket Extrusion",
      technicalDetails: "Constructed with insulated cores laid up in a clean, parallel horizontal layout. The exterior jacket is extruded from a custom-formulated PVC compound engineered to stand up to heavy on-site scraping and mechanical abrasion while remaining simple to strip back during field terminations."
    },
    {
      id: "spec-4",
      title: "Comprehensive Stage-by-Stage Quality Control Protocol",
      category: "Quality Assurance System",
      technicalDetails: "Polycab enforces strict testing protocols from raw incoming polymers and copper rods up to the final packed reel configurations. This robust check loop ensures full compliance with target specifications across all parameters, providing peace of mind on critical infrastructure installations."
    },
    {
      id: "spec-5",
      title: "Customized Configuration Conforming to IS 694 Parameters",
      category: "Manufacturing Standards",
      technicalDetails: "The absolute structural dimensions, wall thicknesses, and raw material selections are engineered to align seamlessly with application demands and structural parameter criteria set forth within the IS 694 Indian Standard framework."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab BMS Cables" description="Polycab BMS Cables. Featuring EMI suppression shielding and high-insulation resistance PVC conforming to IS 694 guidelines." />
      <div className="min-h-screen bg-white text-slate-800 py-16 lg:py-28 xl:py-36 selection:bg-cyan-100 selection:text-slate-900">
        {/* Container scaled up to 1600px for ultra-large desktop clarity */}
        <div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-[1600px]">

          {/* ─── HERO BRAND / DETAILS SECTION ──────────────────── */}
          <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 xl:gap-20 items-center mb-24 xl: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-[450px] xl:max-w-[550px] aspect-square rounded-3xl overflow-hidden bg-white border border-slate-200 p-8 shadow-sm group">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/BMS-CABLE-1.png"
                    alt="Polycab Metallic Screened Shielded Building Management System BMS Cable"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500"
                    sizes="(max-width: 768px) 100vw, (max-width: 1280px) 450px, 550px"
                  />
                </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 xl:text-sm font-bold tracking-wider text-cyan-400 uppercase border border-slate-800">
                Building Automation • Integrated System Interconnection Grid
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab BMS Cables <br />
                <span className="text-cyan-600 font-extrabold text-xl md:text-2xl xl:text-3xl block mt-3">
                  Metallic Screened Signal Infrastructure for Intelligent Building Control
                </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">
                <p>
                  Modern automated architecture relies on intelligent controllers to monitor and manage key utilities like high-volume air conditioning, complex ventilation layout channels, interior lighting banks, and heavy structural hydraulics.
                </p>
                <p>
                  To turn separate pieces of equipment into a fully responsive, integrated network, clean communication pathways are vital. These integrated setups need specialized, reliable <strong className="text-slate-900">BMS interconnect cables</strong> to prevent dropouts between equipment units.
                </p>
                <p>
                  Polycab BMS cables feature built-in <strong className="text-slate-900">EMI suppression through a dense metallic screen</strong>. This shielding structure blocks surrounding electrical noise, providing clean data transmission and making them the preferred choice for modern Building Management Systems.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-slate-50 border border-slate-200/80 p-5 rounded-2xl shadow-2xs">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-white border border-slate-200 p-4 rounded-xl text-center flex flex-col justify-center min-h-[80px]">
                    <span className="text-[10px] xl:text-xs text-slate-400 font-bold uppercase tracking-wider block mb-1">
                      {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/instrumentation-cable/pdf/BMS-CABLE-1.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 BMS Cable 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 xl:mb-32">
            <div className="flex items-center gap-4 mb-10 border-b border-slate-200 pb-5">
              <div className="p-3 bg-slate-100 border border-slate-200 text-slate-700 rounded-xl">
                <LuLayers className="w-6 h-6" />
              </div>
              <div>
                <h2 className="text-xl xl:text-2xl font-black text-slate-900">Technical Specifications &amp; Material Profile</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium mt-0.5">
                  Select a structural component category below to evaluate insulation profiles, tracking metrics, and shielding properties of Polycab's automation 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-slate-900 text-white border-slate-950 shadow-md"
                      : "bg-slate-50 text-slate-700 border-slate-200 hover:bg-slate-100"
                      }`}
                  >
                    <span className="truncate pr-4">{spec.title}</span>
                    <FaChevronRight className={`w-2.5 h-2.5 shrink-0 opacity-70 group-hover:translate-x-0.5 transition-transform ${activeSpecId === spec.id ? "text-cyan-400" : "text-slate-400"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Details Information Block */}
              <div className="lg:col-span-7 bg-slate-50 border border-slate-200 rounded-2xl p-6 md:p-8 xl:p-10 min-h-[260px] flex flex-col justify-between shadow-2xs">
                {(() => {
                  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.5">
                            {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">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-8 pt-4 border-t border-slate-200 flex 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 End-to-End Quality Checks
                        </span>
                        <span>IS 694 Guideline Compliant</span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── SYSTEM UTILITY & APPLICATION OVERVIEW CARDS ────── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 xl:gap-8 mb-24 xl:mb-32">
            <div className="bg-slate-50 border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-2xs flex items-start gap-4">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuBuilding2 className="w-6 h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Building Utility Integration</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Connects individual climate, lighting, ventilation, and plumbing systems into a single integrated automation loop.
                </p>
              </div>
            </div>
            <div className="bg-slate-50 border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-2xs flex items-start gap-4">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuRadio className="w-6 h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Active EMI Suppression</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  The continuous metallic screen blocks high-frequency noise from adjacent power lines, keeping automated controls running reliably.
                </p>
              </div>
            </div>
            <div className="bg-slate-50 border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-2xs flex items-start gap-4">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-600 shrink-0">
                <LuHammer className="w-6 h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-xs xl:text-sm font-black text-slate-900">Abrasion-Resistant Outer Sheath</h4>
                <p className="text-[11px] xl:text-xs text-slate-500 font-medium leading-relaxed">
                  Protected by a durable, easy-strip PVC outer compound that resists scratching and physical wear inside tight raceways and cable trays.
                </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>
    </>
  );
}