'use client'

import { useState } from 'react'
import Link from 'next/link'
import { Header } from '@/components/layout/header'
import { Footer } from '@/components/layout/footer'
import { ScrollReveal } from '@/components/ui/scroll-reveal'
import { CTASection } from '@/components/sections/cta'
import { StatsSection } from '@/components/sections/stats'
import { IndustriesSection } from '@/components/sections/industries'
import { Target, Eye, CheckCircle2, Lightbulb, BarChart3, Users, Rocket, Handshake, Quote, Plus, Minus, ArrowRight } from 'lucide-react'
import { Button } from '@/components/ui/button'

function AboutFAQ() {
  const [openIndex, setOpenIndex] = useState<number | null>(0)
  const faqs = [
    { q: 'How is TwoTwentyTwo different from other consulting firms?', a: 'We combine strategic thinking with hands-on execution. Unlike traditional consultants who hand off reports, we stay engaged through implementation to ensure measurable results.' },
    { q: 'What sizes of businesses do you work with?', a: 'We primarily serve mid-market to enterprise businesses with annual revenues of $10M+, but we selectively work with high-growth startups preparing for rapid scaling.' },
    { q: 'Do you work with specific industries only?', a: 'We serve 25+ industries including FinTech, SaaS, Healthcare, Manufacturing, Retail, and Logistics. Our cross-industry perspective is actually a key differentiator.' },
    { q: 'What is your team structure?', a: 'Our team includes senior strategists, data analysts, industry specialists, and project managers. Each engagement is staffed with the right mix of expertise for your specific needs.' },
  ]
  return (
    <div className="space-y-3">
      {faqs.map((faq, index) => (
        <div key={index} className="rounded-xl border border-slate-100 bg-white overflow-hidden hover:border-blue-100 transition-colors">
          <button onClick={() => setOpenIndex(openIndex === index ? null : index)} className="w-full p-6 flex items-center justify-between text-left group">
            <h3 className="text-base font-semibold text-[#081B33] group-hover:text-blue-600 transition-colors pr-4">{faq.q}</h3>
            <div className={`flex-shrink-0 w-8 h-8 rounded-lg flex items-center justify-center transition-all duration-300 ${openIndex === index ? 'bg-blue-500 shadow-md shadow-blue-500/20' : 'bg-slate-50 group-hover:bg-blue-50'}`}>
              {openIndex === index ? <Minus className="w-4 h-4 text-white" /> : <Plus className="w-4 h-4 text-slate-400 group-hover:text-blue-500 transition-colors" />}
            </div>
          </button>
          {openIndex === index && <div className="px-6 pb-6"><p className="text-sm text-slate-500 leading-relaxed">{faq.a}</p></div>}
        </div>
      ))}
    </div>
  )
}

export default function AboutPage() {
  const values = [
    { icon: Lightbulb, title: 'Strategic Thinking', description: 'We approach every challenge with rigorous strategic analysis, ensuring recommendations are grounded in data and market realities.' },
    { icon: CheckCircle2, title: 'Transparency', description: 'Open communication, honest assessments, and clear reporting — we keep you informed and aligned every step of the way.' },
    { icon: BarChart3, title: 'Data-Driven', description: 'Every recommendation is backed by analytics, market research, and performance metrics. We let the data guide the strategy.' },
    { icon: Rocket, title: 'Execution Excellence', description: 'Strategy without execution is just a document. We help implement and deliver measurable results.' },
    { icon: Users, title: 'Partnership', description: 'We build long-term strategic partnerships, not transactional engagements. Your sustained growth is our measure of success.' },
    { icon: Handshake, title: 'Impact', description: 'We measure our impact by the tangible business outcomes our strategies drive — revenue growth, market share, and competitive advantage.' },
  ]

  const timeline = [
    { year: '2020', title: 'Founded', description: 'TwoTwentyTwo was founded with a mission to help businesses navigate growth through strategic consulting.' },
    { year: '2021', title: 'First Enterprise Client', description: 'Delivered our first enterprise market expansion strategy, helping a FinTech client enter 3 Asian markets.' },
    { year: '2022', title: 'Service Expansion', description: 'Expanded to include operational optimization, brand positioning, and data-driven analytics consulting.' },
    { year: '2023', title: 'Global Reach', description: 'Started serving clients globally across 25+ industries including FinTech, SaaS, and Healthcare.' },
    { year: '2024', title: '150+ Markets', description: 'Helped clients successfully enter over 150 new markets with a 94% client retention rate.' },
    { year: '2025', title: 'Innovation Lab', description: 'Launched our Strategic Intelligence Lab to leverage AI-powered analytics for market research.' },
  ]

  const testimonials = [
    { quote: "TwoTwentyTwo has been our strategic partner for 3 years. They've helped us enter 5 new markets and grow revenue by 340%. Their depth of expertise is unmatched.", author: 'Sarah Chen', title: 'CEO', company: 'GlobalPay Inc', result: '340% Revenue Growth' },
    { quote: "The operational transformation they delivered saved us $4.2M annually. But more importantly, they built a culture of continuous improvement within our team.", author: 'James Rodriguez', title: 'COO', company: 'Apex Manufacturing', result: '$4.2M Annual Savings' },
  ]

  const leadership = [
    { name: 'Alex Morgan', title: 'Managing Partner', bio: 'Former McKinsey strategist with 15+ years in growth consulting across Fortune 500 companies.' },
    { name: 'Sarah Kim', title: 'Head of Analytics', bio: 'PhD in Data Science from MIT. Previously led analytics at a top-tier management consulting firm.' },
    { name: 'David Chen', title: 'Director, Market Expansion', bio: 'Expert in international market entry with successful engagements across 30+ countries.' },
  ]

  return (
    <main className="min-h-screen bg-background text-foreground">
      <Header />

      {/* 1. Hero */}
      <section className="relative bg-[#081B33] pt-28 pb-20 overflow-hidden">
        <div className="absolute inset-0 -z-0">
          <div className="absolute top-0 right-0 w-[500px] h-[500px] bg-blue-500/10 rounded-full blur-[120px]" />
          <div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-purple-500/10 rounded-full blur-[100px]" />
        </div>
        <div className="max-w-7xl mx-auto px-6 lg:px-8 relative z-10">
          <div className="max-w-3xl">
            <p className="text-sm font-semibold text-blue-400 uppercase tracking-wider mb-3">About Us</p>
            <h1 className="text-4xl sm:text-5xl lg:text-6xl font-bold text-white mb-6">About <span className="text-blue-400">TwoTwentyTwo</span></h1>
            <p className="text-lg text-slate-300 leading-relaxed">Strategic vision meets data-driven execution.</p>
          </div>
        </div>
      </section>

      {/* 2. Mission & Vision */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-slate-50">
          <div className="max-w-7xl mx-auto px-6 lg:px-8">
            <div className="grid grid-cols-1 md:grid-cols-2 gap-8">
              <div className="p-8 rounded-2xl bg-white border border-slate-100 hover:shadow-xl hover:shadow-blue-50 transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-blue-50 border border-blue-100 flex items-center justify-center mb-5"><Target className="w-5.5 h-5.5 text-blue-600" /></div>
                <h2 className="text-2xl font-bold text-[#081B33] mb-4">Our Mission</h2>
                <p className="text-slate-500 leading-relaxed">To empower businesses with strategic consulting that drives measurable, sustainable growth. We bridge the gap between ambition and execution, helping companies expand into new markets, optimize operations, and build enduring competitive advantages.</p>
              </div>
              <div className="p-8 rounded-2xl bg-white border border-slate-100 hover:shadow-xl hover:shadow-blue-50 transition-all duration-300">
                <div className="w-12 h-12 rounded-xl bg-purple-50 border border-purple-100 flex items-center justify-center mb-5"><Eye className="w-5.5 h-5.5 text-purple-600" /></div>
                <h2 className="text-2xl font-bold text-[#081B33] mb-4">Our Vision</h2>
                <p className="text-slate-500 leading-relaxed">To be the world's most trusted strategic growth partner — the firm that ambitious businesses turn to when they need to break through to the next level.</p>
              </div>
            </div>
          </div>
        </section>
      </ScrollReveal>

      {/* 3. Stats */}
      <StatsSection stats={[
        { value: '150+', label: 'Markets Entered', description: 'Across 25+ industries' },
        { value: '80+', label: 'Enterprise Clients', description: 'Trusted partnerships' },
        { value: '94%', label: 'Client Retention', description: 'Long-term relationships' },
        { value: '3.2x', label: 'Average ROI', description: 'Measurable impact' },
      ]} />

      {/* 4. Core Values */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-white">
          <div className="max-w-7xl mx-auto px-6 lg:px-8">
            <div className="text-center max-w-2xl mx-auto mb-14">
              <p className="text-sm font-semibold text-blue-600 uppercase tracking-wider mb-3">Our Values</p>
              <h2 className="text-3xl sm:text-4xl font-bold text-[#081B33]">Core <span className="gradient-text">Values</span></h2>
            </div>
            <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
              {values.map((value, i) => { const Icon = value.icon; return (
                <ScrollReveal key={i} delay={i * 80}>
                  <div className="p-7 rounded-2xl border border-slate-100 bg-white hover:border-blue-100 hover:shadow-xl hover:shadow-blue-50 transition-all duration-300 h-full">
                    <div className="w-12 h-12 rounded-xl bg-blue-50 border border-blue-100 flex items-center justify-center mb-4"><Icon className="w-5.5 h-5.5 text-blue-600" /></div>
                    <h3 className="text-lg font-bold text-[#081B33] mb-2">{value.title}</h3>
                    <p className="text-sm text-slate-500 leading-relaxed">{value.description}</p>
                  </div>
                </ScrollReveal>
              )})}
            </div>
          </div>
        </section>
      </ScrollReveal>

      {/* 5. Timeline */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-slate-50">
          <div className="max-w-4xl mx-auto px-6 lg:px-8">
            <div className="text-center mb-14">
              <p className="text-sm font-semibold text-blue-600 uppercase tracking-wider mb-3">Our Journey</p>
              <h2 className="text-3xl sm:text-4xl font-bold text-[#081B33]">Company <span className="gradient-text">Timeline</span></h2>
            </div>
            <div className="relative">
              <div className="absolute left-4 md:left-1/2 top-0 bottom-0 w-px bg-slate-200 -translate-x-1/2" />
              {timeline.map((item, i) => (
                <div key={i} className={`relative flex items-start gap-8 mb-12 ${i % 2 === 0 ? 'md:flex-row' : 'md:flex-row-reverse'}`}>
                  <div className="hidden md:block md:w-1/2" />
                  <div className="absolute left-4 md:left-1/2 w-3 h-3 bg-blue-500 rounded-full border-4 border-white shadow -translate-x-1/2 mt-1.5 z-10" />
                  <div className="pl-12 md:pl-0 md:w-1/2">
                    <span className="text-sm font-bold text-blue-500">{item.year}</span>
                    <h3 className="text-lg font-bold text-[#081B33] mt-1 mb-2">{item.title}</h3>
                    <p className="text-sm text-slate-500 leading-relaxed">{item.description}</p>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </section>
      </ScrollReveal>

      {/* 6. Leadership */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-white">
          <div className="max-w-7xl mx-auto px-6 lg:px-8">
            <div className="text-center max-w-2xl mx-auto mb-14">
              <p className="text-sm font-semibold text-blue-600 uppercase tracking-wider mb-3">Our Team</p>
              <h2 className="text-3xl sm:text-4xl font-bold text-[#081B33]">Leadership <span className="gradient-text">Team</span></h2>
            </div>
            <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
              {leadership.map((person, i) => (
                <ScrollReveal key={i} delay={i * 100}>
                  <div className="p-7 rounded-2xl border border-slate-100 bg-white hover:border-blue-100 hover:shadow-xl hover:shadow-blue-50 transition-all duration-300 text-center">
                    <div className="w-20 h-20 rounded-full bg-gradient-to-br from-[#081B33] to-[#0d2444] flex items-center justify-center mx-auto mb-5 shadow-lg shadow-[#081B33]/20">
                      <span className="text-lg font-bold text-white">{person.name.split(' ').map(n => n[0]).join('')}</span>
                    </div>
                    <h3 className="text-lg font-bold text-[#081B33] mb-1">{person.name}</h3>
                    <p className="text-sm font-semibold text-blue-600 mb-3">{person.title}</p>
                    <p className="text-sm text-slate-500 leading-relaxed">{person.bio}</p>
                  </div>
                </ScrollReveal>
              ))}
            </div>
          </div>
        </section>
      </ScrollReveal>

      {/* 7. Industries */}
      <ScrollReveal delay={0}>
        <IndustriesSection />
      </ScrollReveal>

      {/* 8. Testimonials */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-slate-50">
          <div className="max-w-7xl mx-auto px-6 lg:px-8">
            <div className="max-w-2xl mb-14">
              <p className="text-sm font-semibold text-blue-600 uppercase tracking-wider mb-3">Testimonials</p>
              <h2 className="text-3xl sm:text-4xl font-bold text-[#081B33] mb-4">What Our <span className="gradient-text">Clients Say</span></h2>
            </div>
            <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
              {testimonials.map((t, i) => (
                <div key={i} className="p-8 rounded-2xl border border-slate-200/80 bg-white hover:border-blue-100 hover:shadow-xl hover:shadow-blue-50 transition-all duration-300">
                  <Quote className="w-8 h-8 text-blue-100 mb-4" />
                  <blockquote className="text-sm text-slate-600 leading-relaxed mb-5">&ldquo;{t.quote}&rdquo;</blockquote>
                  <div className="inline-flex items-center px-3 py-1 bg-blue-50 text-blue-700 rounded-full text-xs font-semibold mb-5 border border-blue-100">{t.result}</div>
                  <div className="flex items-center gap-3 pt-5 border-t border-slate-100">
                    <div className="w-10 h-10 rounded-full bg-gradient-to-br from-[#081B33] to-[#0d2444] flex items-center justify-center flex-shrink-0"><span className="text-[11px] font-bold text-white">{t.author.split(' ').map(n => n[0]).join('')}</span></div>
                    <div><p className="text-sm font-bold text-[#081B33]">{t.author}</p><p className="text-xs text-slate-400">{t.title}, {t.company}</p></div>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </section>
      </ScrollReveal>

      {/* 9. FAQ */}
      <ScrollReveal delay={0}>
        <section className="py-20 bg-white">
          <div className="max-w-3xl mx-auto px-6 lg:px-8">
            <div className="text-center mb-14"><p className="text-sm font-semibold text-blue-600 uppercase tracking-wider mb-3">FAQs</p><h2 className="text-3xl sm:text-4xl font-bold text-[#081B33] mb-5">About <span className="gradient-text">TwoTwentyTwo</span></h2></div>
            <AboutFAQ />
          </div>
        </section>
      </ScrollReveal>

      {/* 10. CTA */}
      <CTASection />
      <Footer />
    </main>
  )
}
