"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,
  LuShieldCheck,
  LuVideo,
  LuPlug,
  LuEye,
  LuCpu
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";
interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabCctvClient() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Cable Profiles", val: "3+1 & 4+1 Options" },
    { label: "Video Carrier", val: "Solid Bare Copper" },
    { label: "Power Carrier", val: "3-Core / 4-Core Grid" },
    { label: "Outer Protection", val: "UV Resistant PVC" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Electrical Grade 99.97% Pure Solid Bare Copper Conductor",
      category: "Conductor Core",
      technicalDetails: "The primary video signal carrier is manufactured from electrical grade 99.97% pure solid bare copper. This high-purity metal core maximizes video signal fidelity across long cable lengths with minimal signal drop or resistance."
    },
    {
      id: "spec-2",
      title: "Superior Quality High-Density Polyethylene Physical Foam",
      category: "Dielectric Insulation",
      technicalDetails: "Insulated with a specialized high-density polyethylene physical foam skin. This gas-expanded structural layer isolates the high-frequency video feed, keeping capacitive losses low to prevent ghosting or blurring on monitoring screens."
    },
    {
      id: "spec-3",
      title: "Bonded Aluminium Foil Composite Electromagnetic Shielding",
      category: "Primary Screen Wrapper",
      technicalDetails: "Wrapped in a high-stability bonded Aluminium foil wrap. This continuous layer forms a reliable shield against high-frequency radio waves and nearby electromagnetic noise from parallel structural power wires."
    },
    {
      id: "spec-4",
      title: "High-Tensile Strength Aluminium Alloy Wire Braiding Mesh",
      category: "Secondary Armor Shielding",
      technicalDetails: "Reinforced with a woven mesh of high-tensile aluminium alloy wire braiding. This layer absorbs mechanical stress during cable pulling while providing grounding and protection against low-frequency electromagnetic interference."
    },
    {
      id: "spec-5",
      title: "Moisture-Repellent Volumetric Jelly Flooding Matrix",
      category: "Internal Core Flooding",
      technicalDetails: "Flooded internally with a high-stability thixotropic protective jelly. This moisture block prevents water tracking and core oxidation inside the shielding layers when the cable is installed in damp outdoor environments."
    },
    {
      id: "spec-6",
      title: "In-House Formulated UV & Abrasion Resistant Thermoplastic Outer Jacket",
      category: "Exterior Casing Extrusion",
      technicalDetails: "Enclosed within a specially engineered, in-house developed thermoplastic PVC compound sheath. This durable jacket protects the composite video and power lines from harsh UV rays, rain, and mechanical scraping during installation."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab CCTV Cable" description="Polycab CCTV Cable" />
      <div className="min-h-screen bg-slate-50 text-slate-800 py-16 lg:py-24 xl:py-32 selection:bg-cyan-100 selection:text-cyan-900">
        {/* Container max-width raised to 7xl and 2xl breakpoint properties scaled up */}
        <div className="container mx-auto px-4 max-w-7xl 2xl:max-w-[1536px]">

          {/* ─── 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 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-[420px] xl:max-w-[480px] 2xl:max-w-[560px] aspect-square rounded-3xl overflow-hidden bg-white border border-slate-200 p-8 shadow-sm group transition-all duration-300 hover:shadow-md">
                <div className="relative w-full h-full">
                  <Image
                    src="/images/polycab/CCTV-1.png"
                    alt="Polycab 3+1 and 4+1 Professional Composite CCTV Surveillance Cable"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-500"
                    sizes="(max-width: 768px) 100vw, (max-width: 1280px) 420px, 560px"
                  />
                </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-white px-4 py-1.5 text-xs font-bold tracking-wider text-cyan-600 uppercase border border-cyan-200 shadow-2xs">
                Composite Surveillance Architecture • Combined Video &amp; Power
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl 2xl:text-6xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab CCTV Cables <br />
                <span className="text-cyan-500 font-extrabold text-xl md:text-2xl xl:text-3xl 2xl:text-4xl block mt-3">
                  Professional 3+1 &amp; 4+1 Composite Wiring for Low-Loss Video Networks
                </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>
                  Polycab offers premium composite **CCTV Cables** engineered specifically to transmit full-bandwidth video frequencies with minimum distortion or signal attenuation over extended runs.
                </p>
                <p>
                  To simplify system installation, this cable range is supplied in two main varieties: **3+1 CCTV Cable** and **4+1 CCTV Cable**. The core consists of a high-performance coaxial line that acts as the dedicated carrier for the video signal, layered alongside a distinct 3-core or 4-core insulated power wire bundle to deliver clean power directly to the camera hardware.
                </p>
                <p>
                  The advanced construction of the primary coaxial video element ensures clear, noise-free monitoring feeds. This composite layout eliminates the need to run separate, messy video lines and power wires to each camera location.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-white border border-slate-200 p-5 rounded-2xl shadow-xs">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-slate-50 border border-slate-100 p-3.5 rounded-xl text-center flex flex-col justify-center transition-colors hover:bg-cyan-50/30">
                    <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/cctv-cable/pdf/CCTV-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 xl:px-8 py-3.5 xl: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 CCTV Cable 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 xl:px-8 py-3.5 xl: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-3 mb-10 border-b border-slate-200/60 pb-5">
              <div className="p-2.5 bg-white border border-slate-200 text-cyan-500 rounded-xl shadow-xs">
                <LuLayers className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div>
                <h2 className="text-lg xl:text-xl font-black text-slate-900">Technical Specifications &amp; Internal Layers</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium">
                  Select an engineering layer or shielding component below to review material details, shielding protection, and insulation specs.
                </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-sm"
                      : "bg-white 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 xl:w-3 xl:h-3 opacity-75 group-hover:translate-x-0.5 transition-transform shrink-0 ${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-[260px] 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-500 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-100">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-8 pt-4 border-t border-slate-100 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" /> High Frequency Coaxial Optimization
                        </span>
                        <span>Security Grade Network Matrix</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-white border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all duration-300 hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-500 shrink-0">
                <LuVideo className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-black text-slate-900">Distortion-Free Video</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  The high-purity copper core and physical foam insulation prevent signal drops, delivering clean video feeds free from horizontal scan lines.
                </p>
              </div>
            </div>
            <div className="bg-white border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all duration-300 hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-500 shrink-0">
                <LuPlug className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-black text-slate-900">Unified 3+1 / 4+1 Layout</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  Combines high-frequency coaxial video lines and power cores into one shared cable jacket to simplify multi-camera runs.
                </p>
              </div>
            </div>
            <div className="bg-white border border-slate-200 rounded-2xl p-6 xl:p-8 shadow-xs flex items-start gap-4 transition-all duration-300 hover:shadow-sm">
              <div className="p-3 bg-cyan-50 border border-cyan-100 rounded-xl text-cyan-500 shrink-0">
                <LuEye className="w-5 h-5 xl:w-6 xl:h-6" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-black text-slate-900">All-Weather Monitoring</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  The protective inner jelly flooding and UV-resistant outer shield defend the cable against outdoor wear, rain, and temperature swings.
                </p>
              </div>
            </div>
          </div>

          {/* ─── COMMERCIAL INQUIRY BLOCK ──────────────────────── */}
          <div className="flex flex-wrap gap-4 pt-2">
            <Link
              href="https://realswitchgears.com/assets/images/products/polycab-cable/coaxial-cable/pdf/COAXIAL-CABLE-1.pdf"
              target="_blank"
              className="inline-flex items-center gap-2 bg-slate-900 hover:bg-slate-800 text-white text-xs 2xl:text-sm font-bold px-6 py-4 rounded-xl transition-all group"
            >
              <FaDownload className="w-3.5 h-3.5 group-hover:translate-y-0.5 transition-transform" />
              Download Co-axial Cable Catalog
            </Link>
            <Link
              href="/contact"
              className="inline-flex items-center gap-2 bg-cyan-500 hover:bg-cyan-600 text-white text-xs 2xl: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>
    </>
  );
}