"use client";
import { Container } from "@/components/container";
import { Heading } from "@/components/heading";
import { Footer } from "@/components/footer";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { Label } from "@/components/ui/label";
import { MessageCircle, Mail, MapPin } from "lucide-react";
import { useState } from "react";

export default function ContactPage() {
  const [formData, setFormData] = useState({
    name: "",
    city: "",
    budget: "",
    destination: "",
    travelDate: "",
    message: ""
  });

  const handleWhatsAppClick = () => {
    window.open("https://wa.me/919999999999?text=Hi, I need help planning my trip", "_blank");
  };

  const handleSubmit = async (e: React.FormEvent) => {
    e.preventDefault();
    
    // Create WhatsApp message with form data
    const message = `Hi, I need travel consultation:\n\nName: ${formData.name}\nCity: ${formData.city}\nBudget: ${formData.budget}\nDestination: ${formData.destination}\nTravel Date: ${formData.travelDate}\n\nMessage: ${formData.message}`;
    
    window.open(`https://wa.me/919999999999?text=${encodeURIComponent(message)}`, "_blank");
  };

  return (
    <main className="min-h-screen">
      <section className="py-20 md:py-32 bg-gradient-to-b from-neutral-50 to-white">
        <Container>
          <div className="max-w-4xl mx-auto">
            <div className="text-center mb-12">
              <Heading className="text-4xl md:text-5xl font-bold text-neutral-900 mb-6">
                Get Free Consultation
              </Heading>
              <p className="text-lg text-neutral-600">
                Ready to plan your trip? Reach out to us and we'll help you find the perfect travel option.
              </p>
            </div>
            
            <div className="grid grid-cols-1 md:grid-cols-2 gap-8 mb-12">
              <div className="bg-green-700 text-white p-8 rounded-lg">
                <h3 className="text-2xl font-bold mb-6">Contact Us on WhatsApp</h3>
                <p className="mb-6">
                  The fastest way to get in touch. We're available to answer your questions and help you plan your trip.
                </p>
                <Button 
                  size="lg" 
                  className="bg-white text-green-700 hover:bg-neutral-100 w-full"
                  onClick={handleWhatsAppClick}
                >
                  <MessageCircle className="mr-2 h-5 w-5" />
                  Chat on WhatsApp
                </Button>
                
                <div className="mt-8 space-y-4">
                  <div className="flex items-start gap-3">
                    <Mail className="h-5 w-5 mt-1" />
                    <div>
                      <div className="font-semibold">Email</div>
                      <div className="text-green-100">contact@badnaamsafar.com</div>
                    </div>
                  </div>
                  <div className="flex items-start gap-3">
                    <MapPin className="h-5 w-5 mt-1" />
                    <div>
                      <div className="font-semibold">Location</div>
                      <div className="text-green-100">India</div>
                    </div>
                  </div>
                </div>
              </div>
              
              <div className="bg-white p-8 rounded-lg border border-neutral-200">
                <h3 className="text-2xl font-bold text-neutral-900 mb-6">Send Us Your Details</h3>
                <form onSubmit={handleSubmit} className="space-y-4">
                  <div>
                    <Label htmlFor="name">Name *</Label>
                    <Input 
                      id="name" 
                      required 
                      value={formData.name}
                      onChange={(e) => setFormData({...formData, name: e.target.value})}
                      placeholder="Your full name"
                    />
                  </div>
                  
                  <div>
                    <Label htmlFor="city">City *</Label>
                    <Input 
                      id="city" 
                      required 
                      value={formData.city}
                      onChange={(e) => setFormData({...formData, city: e.target.value})}
                      placeholder="Your city"
                    />
                  </div>
                  
                  <div>
                    <Label htmlFor="budget">Budget *</Label>
                    <Input 
                      id="budget" 
                      required 
                      value={formData.budget}
                      onChange={(e) => setFormData({...formData, budget: e.target.value})}
                      placeholder="e.g., ₹15,000 - ₹20,000"
                    />
                  </div>
                  
                  <div>
                    <Label htmlFor="destination">Destination *</Label>
                    <Input 
                      id="destination" 
                      required 
                      value={formData.destination}
                      onChange={(e) => setFormData({...formData, destination: e.target.value})}
                      placeholder="Where do you want to go?"
                    />
                  </div>
                  
                  <div>
                    <Label htmlFor="travelDate">Travel Date *</Label>
                    <Input 
                      id="travelDate" 
                      type="date"
                      required 
                      value={formData.travelDate}
                      onChange={(e) => setFormData({...formData, travelDate: e.target.value})}
                    />
                  </div>
                  
                  <div>
                    <Label htmlFor="message">Additional Details (Optional)</Label>
                    <Textarea 
                      id="message" 
                      value={formData.message}
                      onChange={(e) => setFormData({...formData, message: e.target.value})}
                      placeholder="Any specific preferences or questions?"
                      rows={4}
                    />
                  </div>
                  
                  <Button 
                    type="submit" 
                    size="lg" 
                    className="w-full bg-green-700 hover:bg-green-800 text-white"
                  >
                    Get Free Consultation
                  </Button>
                  <p className="text-xs text-neutral-500 text-center">
                    This will open WhatsApp with your details pre-filled
                  </p>
                </form>
              </div>
            </div>
          </div>
        </Container>
      </section>
      <Footer />
    </main>
  );
}
