"use client";

import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider";
import ReactLenis from "lenis/react";
import NavbarLayoutFloatingOverlay from '@/components/navbar/NavbarLayoutFloatingOverlay/NavbarLayoutFloatingOverlay';
import ProductCardTwo from '@/components/sections/product/ProductCardTwo';
import FooterMedia from '@/components/sections/footer/FooterMedia';

const productData = [
  {
    id: "p1",    brand: "Classic Tailors",    name: "Charcoal Business Suit",    price: "$799",    rating: 4.5,
    reviewCount: "120",    imageSrc: "https://img.b2bpic.net/free-photo/men-s-suit-hanger_107420-101414.jpg",    imageAlt: "Charcoal Business Suit"},
  {
    id: "p2",    brand: "Modern Fits",    name: "Navy Slim Fit Tuxedo",    price: "$1200",    rating: 4.8,
    reviewCount: "85",    imageSrc: "https://img.b2bpic.net/free-photo/stylish-man-in-suit_158595-3561.jpg",    imageAlt: "Navy Slim Fit Tuxedo"},
  {
    id: "p3",    brand: "Elegant Wear",    name: "Grey Plaid Formal Suit",    price: "$899",    rating: 4.2,
    reviewCount: "95",    imageSrc: "https://img.b2bpic.net/free-photo/black-classic-suit-blue-background_23-2147772659.jpg",    imageAlt: "Grey Plaid Formal Suit"},
  {
    id: "p4",    brand: "Gentleman's Choice",    name: "Brown Tweed Casual Blazer",    price: "$450",    rating: 4.0,
    reviewCount: "60",    imageSrc: "https://img.b2bpic.net/free-photo/business-gentleman-wearing-suit_158595-4560.jpg",    imageAlt: "Brown Tweed Casual Blazer"},
  {
    id: "p5",    brand: "Trendsetter",    name: "Light Blue Summer Suit",    price: "$720",    rating: 4.3,
    reviewCount: "110",    imageSrc: "https://img.b2bpic.net/free-photo/man-fitting-suit-store_107420-101416.jpg",    imageAlt: "Light Blue Summer Suit"},
  {
    id: "p6",    brand: "Exclusive Tailoring",    name: "Black Tie Evening Suit",    price: "$1500",    rating: 4.9,
    reviewCount: "75",    imageSrc: "https://img.b2bpic.net/free-photo/fashion-men-suits_1203-9121.jpg",    imageAlt: "Black Tie Evening Suit"}
];

// Placeholder for client-side filtering component logic
function ProductFilters() {
  return (
    <div className="w-full lg:w-1/4 p-4 lg:pr-8 border-b lg:border-r border-gray-200 lg:border-b-0">
      <h3 className="text-2xl font-semibold mb-6 text-foreground">Filter Products</h3>
      <div className="mb-6">
        <h4 className="text-lg font-medium text-foreground mb-3">Size</h4>
        <div className="flex flex-wrap gap-2">
          {['XS', 'S', 'M', 'L', 'XL', 'XXL'].map(size => (
            <button key={size} className="px-4 py-2 text-sm bg-card text-foreground rounded-full border border-accent hover:bg-primary-cta hover:text-primary-cta-text transition-colors">
              {size}
            </button>
          ))}
        </div>
      </div>
      <div className="mb-6">
        <h4 className="text-lg font-medium text-foreground mb-3">Color</h4>
        <div className="flex flex-wrap gap-2">
          {['Blue', 'Black', 'Grey', 'Brown', 'Navy'].map(color => (
            <button key={color} className="px-4 py-2 text-sm bg-card text-foreground rounded-full border border-accent hover:bg-primary-cta hover:text-primary-cta-text transition-colors">
              {color}
            </button>
          ))}
        </div>
      </div>
      <div className="mb-6">
        <h4 className="text-lg font-medium text-foreground mb-3">Price Range</h4>
        <input type="range" min="0" max="2000" defaultValue="1000" className="w-full accent-primary-cta" />
        <div className="flex justify-between text-sm text-foreground mt-2">
          <span>$0</span>
          <span>$2000+</span>
        </div>
      </div>
      <button className="w-full py-3 bg-primary-cta text-primary-cta-text rounded-lg hover:opacity-90 transition-opacity font-medium">
        Apply Filters
      </button>
    </div>
  );
}

export default function ProductCatalogPage() {
  return (
    <ThemeProvider
      defaultButtonVariant="bounce-effect"
      defaultTextAnimation="background-highlight"
      borderRadius="soft"
      contentWidth="compact"
      sizing="largeSmallSizeLargeTitles"
      background="floatingGradient"
      cardStyle="gradient-bordered"
      primaryButtonStyle="flat"
      secondaryButtonStyle="layered"
      headingFontWeight="bold"
    >
      <ReactLenis root>
        <div id="nav" data-section="nav">
          <NavbarLayoutFloatingOverlay
            navItems={[
              { name: "Home", id: "#home" },
              { name: "About", id: "#about" },
              { name: "Services", id: "#services" },
              { name: "Team", id: "#team" },
              { name: "Testimonials", id: "#testimonials" },
              { name: "FAQ", id: "#faq" },
              { name: "Contact", id: "#contact" },
              { name: "Product Catalog", id: "/product-catalog" }
            ]}
            brandName="FCplus Center"
          />
        </div>

        <div id="product-catalog" data-section="product-catalog" className="min-h-screen py-24 lg:py-32 flex flex-col items-center bg-background text-foreground">
          <div className="container mx-auto px-4 max-w-[var(--width-content-width)]">
            <h1 className="text-5xl md:text-6xl font-extrabold text-center mb-16 leading-tight">
              Our Exquisite Suit Collections
            </h1>
            <div className="flex flex-col lg:flex-row gap-8">
              <ProductFilters />
              <div className="lg:w-3/4">
                <ProductCardTwo
                  title="Discover Your Perfect Suit"
                  description="Browse our curated selection of fine man suits, tailored for every occasion and style preference."
                  products={productData}
                  gridVariant="three-columns-all-equal-width"
                  animationType="slide-up"
                  useInvertedBackground={false}
                  textboxLayout="default"
                  className="!p-0"
                  containerClassName="!px-0"
                />
              </div>
            </div>
          </div>
        </div>

        <div id="footer" data-section="footer">
          <FooterMedia
            imageSrc="http://img.b2bpic.net/free-photo/blue-suit-hangers-dark-background_107420-101413.jpg"
            imageAlt="Blue suits on hangers in a dark setting"
            logoText="FCplus Center"
            columns={[
              {
                title: "Quick Links",                items: [
                  { label: "Home", href: "#home" },
                  { label: "About Us", href: "#about" },
                  { label: "Services", href: "#services" },
                  { label: "Team", href: "#team" },
                  { label: "Product Catalog", href: "/product-catalog"}
                ],
              },
              {
                title: "Resources",                items: [
                  { label: "FAQ", href: "#faq" },
                  { label: "Contact Us", href: "#contact" },
                  { label: "Privacy Policy", href: "#" },
                  { label: "Terms of Service", href: "#" },
                ],
              },
              {
                title: "Connect",                items: [
                  { label: "info@fcplus.com", href: "mailto:info@fcplus.com" },
                  { label: "+1 (555) 123-4567", href: "tel:+15551234567" },
                  { label: "456 Gentleman's Way", href: "#" },
                  { label: "Fashion District, NY 10018", href: "#" },
                ],
              },
            ]}
            copyrightText="© 2024 FCplus Center. All rights reserved."
          />
        </div>
      </ReactLenis>
    </ThemeProvider>
  );
}
