"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,
  LuRadio,
  LuActivity,
  LuEyeOff,
  LuCpu
} from "react-icons/lu";
import Breadcrumb from "@/components/Common/Breadcrumb";
interface TechnicalSpec {
  id: string;
  title: string;
  category: string;
  technicalDetails: string;
}

export default function PolycabOfcCable() {
  const [activeSpecId, setActiveSpecId] = useState<string>("spec-1");

  const engineeringMetrics = [
    { label: "Transmission Core", val: "Glass / Plastic Fiber" },
    { label: "Interference", val: "100% EMI/RFI Immune" },
    { label: "Security Level", val: "Anti-Tap Protected" },
    { label: "Media Weight", val: "Ultra-Lightweight" }
  ];

  const technicalSpecifications: TechnicalSpec[] = [
    {
      id: "spec-1",
      title: "Dielectric Optical Fiber Core Transmission Medium",
      category: "Signal Infrastructure",
      technicalDetails: "Constructed with premium dielectric optical fiber filaments. By sending signals via light pulses rather than electrical currents, it provides massive bandwidth capacity and carries critical data over immense geographical distances without attenuation."
    },
    {
      id: "spec-2",
      title: "Complete Immunity to Radiated & Conducted Interference",
      category: "Dielectric Performance",
      technicalDetails: "Because the core elements are composed strictly of dielectric insulating material, the cable matrix is completely immune to Electromagnetic Interference (EMI), Radio Frequency Interference (RFI), and conducted high-voltage line surges."
    },
    {
      id: "spec-3",
      title: "Anti-Tamper & High Security Data Shielding",
      category: "Information Security",
      technicalDetails: "Optical fiber paths do not emit electromagnetic signatures, making it nearly impossible to tap or intercept the transmission externally. This establishes a highly secure data layer for enterprise networking, defense, and banking facilities."
    },
    {
      id: "spec-4",
      title: "Comprehensive Stage-by-Stage Quality Control Protocol",
      category: "Quality Assurance System",
      technicalDetails: "Polycab ensures the highest quality standard in every product by having stringent quality control with requisite testing which are applied at every single stage from raw material selection to finished fiber-spool signal testing."
    },
    {
      id: "spec-5",
      title: "Optimized Construction Tailored to Application Requirements",
      category: "Manufacturing Standards",
      technicalDetails: "The structural layering, outer sheath jacketing material, and mechanical armoring configurations are built directly around the specific field application and environmental requirements of the end-user."
    }
  ];

  return (
    <>
      <Breadcrumb pageName="Polycab OFC Cables" description="Polycab Optical Fiber Cables. Engineered with high-speed transmission capacity and immunity to electromagnetic interference." />
      <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">
        {/* Expanded to scale beautifully up to 2K/4K large screens */}
        <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/OPTICAL-FIBER-CABLES.png"
                    alt="Polycab High Performance High Speed Optical Fiber 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">
                High Transmission Capacity • Secure Dielectric Network Medium
              </span>

              <h1 className="text-3xl md:text-4xl xl:text-5xl 2xl:text-6xl font-black tracking-tight text-slate-900 leading-tight">
                Polycab Optical Fiber Cables <br />
                <span className="text-cyan-500 font-extrabold text-xl md:text-2xl xl:text-3xl 2xl:text-4xl block mt-3">
                  High-Speed Long-Distance OFC Data Transmission 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">
                <p>
                  Optical Fiber is a unique transmission medium that offers distinctive advantages over conventional communication media such as copper wires, microwave links, or coaxial cables. Its major advantage is its exceptionally <strong>high transmission capacity</strong>, enabling it to carry vast information data streams at higher transmission rates over long distances.
                </p>
                <p>
                  Since fibers are engineered completely out of specialized dielectric materials, they are <strong>inherently immune to radiated and conducted electromagnetic interference</strong>. Furthermore, it is nearly impossible to tap an optical fiber line safely, rendering optical data transmissions highly secure for sensitive infrastructures.
                </p>
                <p>
                  The small outer dimensions and lightweight profile make fiber optics ideal for applications where total weight and bulk are practical limitations. Fiber optics stands as the least expensive, most reliable method available for high-speed and long-distance digital communications.
                </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/optical-fiber-cable/pdf/OPTICAL-FIBER-CABLES.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 OFC 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 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; Transmission Properties</h2>
                <p className="text-xs xl:text-sm text-slate-500 font-medium">
                  Select an engineering parameter or manufacturing category block below to review bandwidth benefits, interference shielding, and quality parameters.
                </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-Fidelity Signal Integrity Audits
                        </span>
                        <span>Premium Grade Telecommunication Wire</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">
                <LuRadio 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">Zero EMI Degradation</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  Perfect for dense industrial switchyards or power rooms where heavy motors and high-voltage links generate severe magnetic interference.
                </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">
                <LuActivity 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">High-Bandwidth Scaling</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  Supports exceptionally rapid transmission data rates over prolonged industrial routes without requiring intermediate signal boosters.
                </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">
                <LuEyeOff 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">Secure Network Topology</h4>
                <p className="text-xs xl:text-sm text-slate-500 font-medium leading-relaxed">
                  Completely prevents data signal leakage and stops remote electromagnetic tracking hooks from reading internal operations.
                </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>
    </>
  );
}