"use client";
import { useState } from 'react';
import {
  ChevronDown,
  ShoppingCart,
  HeartPulse,
  Wallet,
  GraduationCap,
  Home,
  Plane,
  Scale,
  Megaphone
} from 'lucide-react';

const verticals = [
  {
    icon: <ShoppingCart className="w-5 h-5" />,
    title: "Retail & E-commerce",
    description: "Enhance customer service with real-time chat support, personalized shopping experiences, and seamless order tracking.",
    gradient: "from-pink-500/20 to-purple-500/20"
  },
  {
    icon: <HeartPulse className="w-5 h-5" />,
    title: "Healthcare & Wellness",
    description: "Improve patient care through virtual consultations, appointment scheduling, and instant access to health resources.",
    gradient: "from-blue-500/20 to-cyan-500/20"
  },
  {
    icon: <Wallet className="w-5 h-5" />,
    title: "Finance & Banking",
    description: "Empower customers with financial insights, automated account management, and personalized advisory services.",
    gradient: "from-green-500/20 to-emerald-500/20"
  },
  {
    icon: <GraduationCap className="w-5 h-5" />,
    title: "Education & eLearning",
    description: "Revolutionize learning with interactive tutoring, course guidance, resource recommendations, and performance tracking.",
    gradient: "from-orange-500/20 to-yellow-500/20"
  },
  {
    icon: <Home className="w-5 h-5" />,
    title: "Real Estate & Property Management",
    description: "Streamline property listings, offer virtual tours, schedule viewings, and provide detailed market insights.",
    gradient: "from-purple-500/20 to-indigo-500/20"
  },
  {
    icon: <Plane className="w-5 h-5" />,
    title: "Travel & Hospitality",
    description: "Enhance guest experiences with AI-driven booking assistance, itinerary management, and personalized recommendations.",
    gradient: "from-cyan-500/20 to-blue-500/20"
  },
  {
    icon: <Scale className="w-5 h-5" />,
    title: "Legal & Consulting",
    description: "Simplify client communications, document management, and consultation scheduling for faster service delivery.",
    gradient: "from-violet-500/20 to-purple-500/20"
  },
  {
    icon: <Megaphone className="w-5 h-5" />,
    title: "Creative & Marketing",
    description: "Boost engagement through dynamic content creation, campaign management, and customer insights analytics.",
    gradient: "from-rose-500/20 to-pink-500/20"
  }
];

export default function BusinessVerticals() {
  const [expandedIndex, setExpandedIndex] = useState<number | null>(null);

  return (
    <div className="w-full py-32">
      <div className="container mx-auto px-4">
        <div className="text-center mb-16">
          <h2 className="text-4xl md:text-6xl text-white mb-8">
            Transform Your Business Verticals
          </h2>
          <p className="text-xl text-gray-400 max-w-3xl mx-auto">
            Our platform isn't one-size-fits-all—each industry can harness the power of AI to improve efficiency and drive growth.
          </p>
        </div>

        <div className="max-w-6xl mx-auto space-y-4">
          {verticals.map((vertical, index) => (
            <div 
              key={index}
              className="group"
            >
              {/* Main row - always visible */}
              <div 
                className={`
                  relative overflow-hidden
                  px-6 py-4 rounded-xl
                  cursor-pointer
                  transition-all duration-300
                  border border-purple-500/10
                  ${expandedIndex === index ? 'bg-purple-900/20' : 'hover:bg-purple-900/10'}
                `}
                onClick={() => setExpandedIndex(expandedIndex === index ? null : index)}
              >
                <div className="flex items-center gap-6">
                  {/* Icon */}
                  <div className={`
                    w-10 h-10 rounded-lg
                    flex items-center justify-center
                    bg-gradient-to-br ${vertical.gradient}
                    transition-transform duration-300 text-white
                    ${expandedIndex === index ? 'rotate-3' : 'group-hover:scale-105'}
                  `}>
                    {vertical.icon}
                  </div>

                  {/* Title */}
                  <h3 className="flex-1 text-xl text-white">{vertical.title}</h3>

                  {/* Expand/Collapse icon */}
                  <ChevronDown 
                    className={`
                      w-5 h-5 text-purple-400
                      transition-transform duration-300
                      ${expandedIndex === index ? 'rotate-180' : ''}
                    `}
                  />
                </div>

                {/* Expanded content */}
                <div className={`
                  grid grid-rows-[0fr]
                  transition-all duration-300
                  ${expandedIndex === index ? 'grid-rows-[1fr] mt-4' : ''}
                `}>
                  <div className="overflow-hidden">
                    <div className="pl-16 text-gray-400 leading-relaxed">
                      {vertical.description}
                    </div>
                    
                    {/* Action button */}
                    <div className="pl-16 mt-4">
                      <button className="
                        px-4 py-2 rounded-lg
                        bg-purple-500/20 hover:bg-purple-500/30
                        text-purple-300 text-sm
                        transition-colors duration-300
                      ">
                        Explore Solutions
                      </button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          ))}
        </div>

        {/* Bottom gradient line */}
        <div className="relative mt-16 flex justify-center">
          <div className="w-32 h-px bg-gradient-to-r from-transparent via-purple-500/30 to-transparent" />
        </div>
      </div>
    </div>
  );
}