'use client'

import { useState } from 'react'
import { Header } from '@/components/layout/header'
import { Footer } from '@/components/layout/footer'
import { Mail, Phone, MapPin, Clock, Send, CheckCircle2 } from 'lucide-react'

export default function ContactPage() {
  const [submitted, setSubmitted] = useState(false)
  const [formData, setFormData] = useState({
    name: '',
    company: '',
    email: '',
    phone: '',
    services: '',
    budget: '',
    timeline: '',
    message: '',
  })

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault()
    setSubmitted(true)
  }

  const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => {
    setFormData({ ...formData, [e.target.name]: e.target.value })
  }

  const contactInfo = [
    { icon: Mail, label: 'Email', value: 'rsingh@consult222.com', href: 'mailto:rsingh@consult222.com' },
    { icon: Phone, label: 'Phone (US)', value: '+1 (331) 212-1828', href: 'tel:+13312121828' },
    { icon: Phone, label: 'Phone (India)', value: '+91 9041144683', href: 'tel:+919041144683' },
    { icon: MapPin, label: 'Office', value: 'San Francisco, CA', href: '#' },
    { icon: Clock, label: 'Hours', value: 'Mon - Fri, 9:00 AM - 6:00 PM PST', href: '#' },
  ]

  return (
    <main className="min-h-screen bg-background text-foreground">
      <Header />

      {/* 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">Get in Touch</p>
            <h1 className="text-4xl sm:text-5xl lg:text-6xl font-bold text-white mb-6">
              Let's Accelerate <span className="text-blue-400">Your Growth</span>
            </h1>
            <p className="text-lg text-slate-300 leading-relaxed">
              Ready to expand your markets, optimize operations, and build competitive advantages? Let's talk.
            </p>
          </div>
        </div>
      </section>

      {/* Contact Form & Info */}
      <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 lg:grid-cols-5 gap-12">
            {/* Form */}
            <div className="lg:col-span-3">
              <div className="bg-white rounded-2xl border border-slate-200 p-8 shadow-sm">
                <h2 className="text-2xl font-bold text-[#081B33] mb-6">Send Us a Message</h2>

                {submitted ? (
                  <div className="text-center py-12">
                    <div className="w-16 h-16 bg-blue-50 rounded-full flex items-center justify-center mx-auto mb-4">
                      <CheckCircle2 className="w-8 h-8 text-blue-500" />
                    </div>
                    <h3 className="text-xl font-bold text-[#081B33] mb-2">Message Sent!</h3>
                    <p className="text-slate-500">We'll get back to you within 24 hours.</p>
                  </div>
                ) : (
                  <form onSubmit={handleSubmit} className="space-y-5">
                    <div className="grid grid-cols-1 sm:grid-cols-2 gap-5">
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Name *</label>
                        <input
                          type="text"
                          name="name"
                          required
                          value={formData.name}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                          placeholder="Your name"
                        />
                      </div>
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Company</label>
                        <input
                          type="text"
                          name="company"
                          value={formData.company}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                          placeholder="Company name"
                        />
                      </div>
                    </div>
                    <div className="grid grid-cols-1 sm:grid-cols-2 gap-5">
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Email *</label>
                        <input
                          type="email"
                          name="email"
                          required
                          value={formData.email}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                          placeholder="you@company.com"
                        />
                      </div>
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Phone</label>
                        <input
                          type="tel"
                          name="phone"
                          value={formData.phone}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                          placeholder="+1 (331) 212-1828"
                        />
                      </div>
                    </div>
                    <div className="grid grid-cols-1 sm:grid-cols-3 gap-5">
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Services Needed</label>
                        <select
                          name="services"
                          value={formData.services}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                        >
                          <option value="">Select service</option>
                          <option value="market-expansion">Market Expansion Strategies</option>
                          <option value="operations">Streamlining Operations</option>
                          <option value="data-insights">Data-Driven Insights</option>
                          <option value="brand-positioning">Brand & Competitive Positioning</option>
                          <option value="client-retention">Client Retention & Growth</option>
                        </select>
                      </div>
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Budget Range</label>
                        <select
                          name="budget"
                          value={formData.budget}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                        >
                          <option value="">Select budget</option>
                          <option value="10k-25k">$10K - $25K</option>
                          <option value="25k-50k">$25K - $50K</option>
                          <option value="50k-100k">$50K - $100K</option>
                          <option value="100k+">$100K+</option>
                        </select>
                      </div>
                      <div>
                        <label className="block text-sm font-medium text-[#081B33] mb-1.5">Timeline</label>
                        <select
                          name="timeline"
                          value={formData.timeline}
                          onChange={handleChange}
                          className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all"
                        >
                          <option value="">Select timeline</option>
                          <option value="asap">ASAP</option>
                          <option value="1month">Within 1 month</option>
                          <option value="3months">Within 3 months</option>
                          <option value="6months">Within 6 months</option>
                          <option value="flexible">Flexible</option>
                        </select>
                      </div>
                    </div>
                    <div>
                      <label className="block text-sm font-medium text-[#081B33] mb-1.5">Message *</label>
                      <textarea
                        name="message"
                        required
                        rows={5}
                        value={formData.message}
                        onChange={handleChange}
                        className="w-full px-4 py-3 rounded-xl border border-slate-200 bg-slate-50 text-sm text-[#081B33] focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition-all resize-none"
                        placeholder="Tell us about your business goals and challenges..."
                      />
                    </div>
                    <button
                      type="submit"
                      className="w-full sm:w-auto bg-[#081B33] hover:bg-[#0d2444] text-white font-semibold px-8 py-3.5 rounded-xl transition-all duration-300 shadow-lg shadow-[#081B33]/15 hover:shadow-[#081B33]/25 flex items-center justify-center gap-2"
                    >
                      <Send className="w-4 h-4" />
                      Send Message
                    </button>
                  </form>
                )}
              </div>
            </div>

            {/* Contact Info */}
            <div className="lg:col-span-2 space-y-6">
              <div className="bg-white rounded-2xl border border-slate-200 p-8 shadow-sm">
                <h3 className="text-lg font-bold text-[#081B33] mb-6">Contact Details</h3>
                <div className="space-y-5">
                  {contactInfo.map((info, i) => {
                    const Icon = info.icon
                    return (
                      <div key={i} className="flex items-start gap-4">
                        <div className="w-10 h-10 rounded-xl bg-blue-50 border border-blue-100 flex items-center justify-center flex-shrink-0">
                          <Icon className="w-4.5 h-4.5 text-blue-600" />
                        </div>
                        <div>
                          <p className="text-xs font-semibold text-slate-400 uppercase tracking-wider mb-0.5">{info.label}</p>
                          <a href={info.href} className="text-sm text-[#081B33] font-medium hover:text-blue-600 transition-colors">
                            {info.value}
                          </a>
                        </div>
                      </div>
                    )
                  })}
                </div>
              </div>

              <div className="bg-[#081B33] rounded-2xl p-8 text-white">
                <h3 className="text-lg font-bold mb-3">Schedule a Strategy Call</h3>
                <p className="text-sm text-slate-300 leading-relaxed mb-2">
                  Prefer to talk directly? Book a free 30-minute strategy consultation with our CEO, Ripujit Singh.
                </p>
                <p className="text-sm text-slate-300 leading-relaxed mb-6">
                  Or call us directly at <a href="tel:+13312121828" className="text-white font-medium hover:underline">+1 (331) 212-1828</a> or <a href="tel:+919041144683" className="text-white font-medium hover:underline">+91 9041144683</a>.
                </p>
                <a
                  href="tel:+13312121828"
                  className="inline-flex items-center gap-2 bg-white text-[#081B33] font-semibold px-6 py-3 rounded-xl text-sm hover:bg-slate-100 transition-colors"
                >
                  Book a Call
                </a>
              </div>
            </div>
          </div>
        </div>
      </section>

      <Footer />
    </main>
  )
}
