import { useState } from "react"
import { ChevronDown, ChevronUp, Search, Zap, MessageCircle } from "lucide-react"

const FAQS = [
  { q: "Are the subscriptions genuine and legal?", a: "Yes. We provide 100% authentic subscriptions through official channels. All licenses are genuine with zero ban risk. We have served 10,000+ customers since 2023 with a 99.8% success rate." },
  { q: "How fast will I receive my subscription?", a: "Instant delivery! Most orders are fulfilled within 2 to 10 minutes via WhatsApp or email. You will receive clear setup instructions and direct access credentials." },
  { q: "What payment methods do you accept?", a: "We accept UPI (Google Pay, PhonePe, Paytm), PayPal for international orders, and Cryptocurrency (Bitcoin, Ethereum, USDT). All payments are secure and encrypted." },
  { q: "Can I get a refund if something doesn't work?", a: "Absolutely! We offer a 24-hour money-back guarantee. If we cannot resolve any issue within 24 hours, you get a full refund — no questions asked." },
  { q: "Will my subscription work on multiple devices?", a: "Yes, most subscriptions support multi-device access. After purchase, you will receive detailed instructions on how to activate on all your devices." },
  { q: "How do I contact support?", a: "Our support team is available 24/7 via WhatsApp at +91 7038146526, Telegram @mfatool, or through our Contact page. Average response time is under 5 minutes." },
  { q: "How do I place an order?", a: "Simply add products to your cart, proceed to checkout, and complete your order via WhatsApp or Telegram. Our team will process your order instantly." },
  { q: "Do you offer discounts for bulk orders?", a: "Yes! Use coupon code HERO20 for 20% OFF on orders above $10. We also offer special pricing for bulk/team orders. Contact us for details." },
  { q: "Is my payment information secure?", a: "Yes. All payments are processed through secure encrypted channels. We never store your payment details. We accept UPI, PayPal, and Crypto for maximum security." },
  { q: "What happens after I purchase?", a: "After payment confirmation, you'll receive your subscription details via WhatsApp or email within 2-10 minutes, along with step-by-step activation instructions." },
  { q: "Can I upgrade my subscription later?", a: "Yes, you can upgrade most subscriptions. Contact our support team and they'll help you transition to a higher plan with any applicable discounts." },
  { q: "Do you offer warranties or replacements?", a: "Yes, most products come with a replacement warranty. The warranty period varies by product (typically 1 month to 1 year). Check the product page for specific details." },
]

export default function Faq() {
  const [open, setOpen] = useState<number | null>(0)
  const [search, setSearch] = useState("")
  const filtered = search ? FAQS.filter(f => f.q.toLowerCase().includes(search.toLowerCase()) || f.a.toLowerCase().includes(search.toLowerCase())) : FAQS

  return (
    <div className="min-h-screen pt-28 pb-16 px-4">
      <div className="max-w-3xl mx-auto">
        <div className="text-center mb-12">
          <div className="inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#f97316]/10 border border-[#f97316]/20 mb-6"><Zap className="w-4 h-4 text-[#f97316]" /><span className="text-sm text-[#f97316]">FAQ</span></div>
          <h1 className="text-4xl md:text-5xl font-bold mb-3">Frequently Asked Questions</h1>
          <p className="text-slate-400">Everything you need to know about Subscription Hero</p>
        </div>
        <div className="relative mb-8"><Search className="absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-slate-500" /><input type="text" placeholder="Search questions..." value={search} onChange={e => setSearch(e.target.value)} className="w-full pl-12 pr-4 py-3 rounded-xl bg-white/5 border border-white/10 focus:outline-none focus:border-[#f97316] transition-colors" /></div>
        <div className="space-y-3">
          {filtered.map((faq, i) => (
            <div key={i} className="glass-card overflow-hidden">
              <button onClick={() => setOpen(open === i ? null : i)} className="w-full flex items-center justify-between p-5 text-left"><span className="font-medium pr-4">{faq.q}</span>{open === i ? <ChevronUp className="w-5 h-5 text-slate-400 flex-shrink-0" /> : <ChevronDown className="w-5 h-5 text-slate-400 flex-shrink-0" />}</button>
              {open === i && <div className="px-5 pb-5 text-slate-400 text-sm leading-relaxed animate-fade-in">{faq.a}</div>}
            </div>
          ))}
        </div>
        {filtered.length === 0 && <div className="text-center py-12 text-slate-400">No questions found matching your search.</div>}
        <div className="glass-card p-8 mt-12 text-center"><h3 className="text-xl font-bold mb-2">Still have questions?</h3><p className="text-slate-400 mb-4">Our support team is available 24/7 to help you.</p><a href="https://wa.me/917038146526" target="_blank" rel="noopener noreferrer nofollow" className="btn-primary inline-flex items-center gap-2"><MessageCircle className="w-4 h-4" />Chat on WhatsApp</a></div>
      </div>
    </div>
  )
}
