"use client";

import React, { useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { FaEnvelope, FaChevronRight, FaDownload, FaArrowRight } from "react-icons/fa6";
import {
  LuLayers,
  LuShieldCheck,
  LuDroplets,
  LuMaximize,
  LuHardHat,
  LuCpu
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";

interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabSubmersibleCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Standard Class", val: "IS 694 (BIS)" },
    { label: "Voltage Rating", val: "1100 V Grade" },
    { label: "Thermal Limits", val: "70°C to 85°C" },
    { label: "Core Geometry", val: "3-Core Parallel Flat" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Contirod Annealed Plain Copper Conductor",
      category: "Conductor Core Architecture",
      technicalDetails: "Engineered with high-conductivity annealed plain bunched or stranded copper wires produced entirely in-house using Polycab's advanced Contirod manufacturing lines. This technique optimizes path continuity, ensuring raw current efficiency under tight power demands."
    },
    {
      id: "spec-2",
      title: "High-Resistance Thermoplastic PVC Insulation",
      category: "Dielectric Layering",
      technicalDetails: "Coated with an in-house developed, high insulation resistance thermoplastic PVC compound. The material is formulated to provide complete electrical insulation and repel moisture transmission, remaining stable during long-term immersion scenarios."
    },
    {
      id: "spec-3",
      title: "Abrasion-Resistant Formulated PVC Outer Sheath",
      category: "Mechanical Protection Shell",
      technicalDetails: "The insulated cores are laid perfectly flat and parallel, encapsulated within a specially formulated PVC outer sheath. This structural wrap simplifies onsite wire stripping while maximizing resistance against abrasive scraping down deep well casings."
    },
    {
      id: "spec-4",
      title: "Indefinite Hydrostatic Immersion Guarding",
      category: "Environmental Defense System",
      technicalDetails: "Specifically built to withstand high fluid pressure during indefinite submersed operations. The non-porous outer casing blocks moisture ingress, rainwater washouts, and small foreign particulate hazards from compromising internal copper segments."
    },
    {
      id: "spec-5",
      title: "Stage-by-Stage Bureau of Indian Standards Auditing",
      category: "Quality Assurance Framework",
      technicalDetails: "Strict quality control matrices are applied across every independent manufacturing phase, tracking raw polymer elements to finished goods. Built in strict alignment with IS 694 parameters to guarantee long-term operation under deep-well conditions."
    }
  ];

  return (
    <>
      <Breadcrumb
        pageName="Polycab Submersible Cable"
        description="Polycab 1100 V heavy duty submersible pump cables built to IS 694 standards. Designed for indefinite water immersion with premium annealed copper tracks."
      />

      <div className="min-h-screen bg-slate-950 text-slate-100 py-16 lg:py-28 selection:bg-cyan-500/20 selection:text-cyan-300 antialiased">
        <div className="container mx-auto px-4 max-w-7xl xl:max-w-(screen-2xl)">

          {/* ─── HERO BRAND / DETAILS SECTION ──────────────────── */}
          <div className="grid grid-cols-1 lg:grid-cols-12 gap-12 xl:gap-20 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-[460px] aspect-square rounded-3xl overflow-hidden bg-slate-900 border border-slate-800 p-8 shadow-2xl shadow-cyan-950/20 group backdrop-blur-xs">
                <div className="absolute inset-0 bg-gradient-to-br from-cyan-500/5 to-transparent pointer-events-none" />
                <div className="relative w-full h-full filter drop-shadow-[0_10px_20px_rgba(6,182,212,0.15)]">
                  <Image
                    src="/images/polycab/3-Core-Flat-Cable.png"
                    alt="Polycab 3-Core Flat Submersible Pump Power Cable"
                    fill
                    priority
                    className="object-contain group-hover:scale-105 transition-transform duration-700 ease-out"
                    sizes="(max-width: 768px) 100vw, 460px"
                  />
                </div>
              </div>
            </div>

            {/* Right Frame: Text Narrative Content */}
            <div className="lg:col-span-7 space-y-8 order-1 lg:order-2">
              <div>
                <span className="inline-flex items-center gap-1.5 rounded-full bg-cyan-950/60 px-4 py-1.5 text-xs font-semibold tracking-wider text-cyan-400 uppercase border border-cyan-800/50 backdrop-blur-xs mb-5">
                  <span className="w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse" />
                  IS 694 Compliant • Heavy Duty Submersible Energy Lines
                </span>

                <h1 className="text-3xl md:text-4xl xl:text-5xl font-black tracking-tight text-white leading-none">
                  Polycab Submersible Cables
                  <span className="text-cyan-400 font-extrabold text-lg md:text-xl xl:text-2xl block mt-3 tracking-normal text-slate-300">
                    1100 V Grade 3-Core Flat Waterproof Pump Motor Power Infrastructure
                  </span>
                </h1>
              </div>

              <div className="space-y-4 text-slate-400 text-sm md:text-base leading-relaxed font-normal max-w-3xl">
                <p>
                  Polycab’s high-performance <strong className="text-slate-200 font-medium">Submersible Power Cables</strong> are designed to meet demanding space constraints and environmental challenges, fully conforming to the official <strong className="text-cyan-400 font-medium">IS 694 Bureau of Indian Standards (BIS)</strong>.
                </p>
                <p>
                  Engineered specifically for deep borewells and demanding pumping installations, these <strong className="text-slate-200 font-medium">1100 V grade</strong> lines offer comprehensive defense against continuous immersion in water, heavy downpours, and particulate ingress.
                </p>
                <p>
                  Constructed using an in-house developed, high insulation resistance thermoplastic PVC matrix, they are available in a space-saving <strong className="text-slate-200 font-medium">3-core parallel flat layout</strong>. These lines effortlessly support sustained operations inside challenging liquid zones within a <strong className="text-cyan-400 font-medium">70°C to 85°C thermal threshold</strong>.
                </p>
              </div>

              {/* Parameter Cards Summary Layout */}
              <div className="grid grid-cols-2 sm:grid-cols-4 gap-4 bg-slate-900/50 border border-slate-800/80 p-4 rounded-2xl shadow-xl backdrop-blur-xs">
                {engineeringMetrics.map((metric, index) => (
                  <div key={index} className="bg-slate-950/60 border border-slate-800/60 p-3.5 rounded-xl text-center flex flex-col justify-center transition-colors hover:border-cyan-500/30">
                    <span className="text-[10px] text-slate-500 font-bold uppercase tracking-widest block mb-1">
                      {metric.label}
                    </span>
                    <span className="text-xs md:text-sm font-bold text-cyan-400 leading-snug">
                      {metric.val}
                    </span>
                  </div>
                ))}
              </div>

              {/* Direct Brochure CTAs */}
              <div className="flex flex-wrap gap-4 pt-2">
                <Link
                  href="/contact"
                  className="inline-flex items-center gap-2.5 bg-cyan-500 hover:bg-cyan-400 text-slate-950 text-xs font-bold tracking-wider uppercase px-7 py-4 rounded-xl transition-all shadow-lg shadow-cyan-500/10 hover:shadow-cyan-500/20 active:scale-[0.98]"
                >
                  Send Enterprise 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 flex-col md:flex-row md:items-center gap-4 mb-10 border-b border-slate-800 pb-6">
              <div className="p-3 bg-slate-900 border border-slate-800 text-cyan-400 rounded-xl w-fit shadow-inner">
                <LuLayers className="w-6 h-6" />
              </div>
              <div>
                <h2 className="text-xl font-bold text-white tracking-tight">Technical Specifications &amp; Extrusion Blueprint</h2>
                <p className="text-xs md:text-sm text-slate-400 font-normal mt-0.5">
                  Select an engineering layer segment below to analyze the specialized mechanical compounds and insulation architecture.
                </p>
              </div>
            </div>

            <div className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg: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 md:text-sm font-semibold transition-all flex items-center justify-between group relative overflow-hidden ${activeSpecId === spec.id
                      ? "bg-cyan-500 text-slate-950 border-cyan-400 shadow-lg shadow-cyan-500/10 font-bold"
                      : "bg-slate-900 text-slate-300 border-slate-800/80 hover:bg-slate-850 hover:border-slate-700"
                      }`}
                  >
                    <span className="truncate relative z-10">{spec.title}</span>
                    <FaChevronRight className={`w-3 h-3 opacity-80 shrink-0 ml-4 group-hover:translate-x-0.5 transition-transform relative z-10 ${activeSpecId === spec.id ? "text-slate-950" : "text-slate-500"
                      }`} />
                  </button>
                ))}
              </div>

              {/* Right Details Information Block */}
              <div className="lg:col-span-7 bg-slate-900 border border-slate-800 rounded-2xl p-6 md:p-10 min-h-[260px] flex flex-col justify-between shadow-2xl relative overflow-hidden">
                <div className="absolute top-0 right-0 w-64 h-64 bg-cyan-500/5 rounded-full blur-3xl pointer-events-none" />
                {(() => {
                  const specMatch = technicalSpecifications.find((s) => s.id === activeSpecId)!;
                  return (
                    <>
                      <div className="space-y-4 relative z-10">
                        <div>
                          <span className="text-[10px] md:text-xs font-bold tracking-widest text-cyan-400 uppercase block mb-1.5">
                            {specMatch.category}
                          </span>
                          <h3 className="text-base md:text-lg font-bold text-white tracking-tight">
                            {specMatch.title}
                          </h3>
                        </div>
                        <p className="text-xs md:text-base text-slate-400 font-normal leading-relaxed pt-4 border-t border-slate-800">
                          {specMatch.technicalDetails}
                        </p>
                      </div>

                      <div className="mt-8 pt-5 border-t border-slate-800 flex flex-wrap gap-4 items-center justify-between text-xs text-slate-500 font-medium relative z-10">
                        <span className="flex items-center gap-2 text-slate-300">
                          <LuShieldCheck className="w-4 h-4 text-cyan-400" /> Stage-by-Stage BIS Structural Certification
                        </span>
                        <span className="bg-slate-950 px-3 py-1 rounded-md border border-slate-850 text-cyan-500 font-semibold">1100 V Hydro-Rated</span>
                      </div>
                    </>
                  );
                })()}
              </div>

            </div>
          </div>

          {/* ─── PUMP & MECHANICAL ENVIRONMENTAL UTILITY CARDS ──── */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-24 lg:mb-32">

            {/* Card 1 */}
            <div className="bg-slate-900/40 border border-slate-800/80 rounded-2xl p-6 shadow-xl flex items-start gap-4 hover:border-cyan-500/20 transition-all group">
              <div className="p-3 bg-cyan-950/80 border border-cyan-800/50 rounded-xl text-cyan-400 shrink-0 group-hover:bg-cyan-500 group-hover:text-slate-950 transition-colors duration-300">
                <LuDroplets className="w-5 h-5" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-bold text-white tracking-tight">Indefinite Fluid Immersion</h4>
                <p className="text-xs text-slate-400 font-normal leading-relaxed">
                  Specifically engineered to withstand long-term immersion inside high-pressure water systems without showing insulation decay or swelling.
                </p>
              </div>
            </div>

            {/* Card 2 */}
            <div className="bg-slate-900/40 border border-slate-800/80 rounded-2xl p-6 shadow-xl flex items-start gap-4 hover:border-cyan-500/20 transition-all group">
              <div className="p-3 bg-cyan-950/80 border border-cyan-800/50 rounded-xl text-cyan-400 shrink-0 group-hover:bg-cyan-500 group-hover:text-slate-950 transition-colors duration-300">
                <LuMaximize className="w-5 h-5" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-bold text-white tracking-tight">Compact Well Cavity Optimization</h4>
                <p className="text-xs text-slate-400 font-normal leading-relaxed">
                  The dense, flat multicore alignment minimizes total space requirements inside crowded borewell assemblies and adjacent pipe structures.
                </p>
              </div>
            </div>

            {/* Card 3 */}
            <div className="bg-slate-900/40 border border-slate-800/80 rounded-2xl p-6 shadow-xl flex items-start gap-4 hover:border-cyan-500/20 transition-all group">
              <div className="p-3 bg-cyan-950/80 border border-cyan-800/50 rounded-xl text-cyan-400 shrink-0 group-hover:bg-cyan-500 group-hover:text-slate-950 transition-colors duration-300">
                <LuHardHat className="w-5 h-5" />
              </div>
              <div className="space-y-1.5">
                <h4 className="text-sm font-bold text-white tracking-tight">Heavy Mechanical Protection</h4>
                <p className="text-xs text-slate-400 font-normal leading-relaxed">
                  The tough PVC composite jacket limits mechanical tearing and safeguards internal conductors during installation down rough well walls.
                </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>
    </>
  );
}