import { useEffect, useState } from "react";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { 
  Phone, 
  Mail, 
  MapPin, 
  Clock, 
  AlertCircle,
  Send 
} from "lucide-react";

const Contact = () => {
  const [scrollY, setScrollY] = useState(0);

  useEffect(() => {
    const handleScroll = () => setScrollY(window.scrollY);
    window.addEventListener('scroll', handleScroll);
    return () => window.removeEventListener('scroll', handleScroll);
  }, []);
  const contactInfo = [
    {
      icon: Phone,
      title: "Emergency Line",
      details: "+1 (555) 123-4567",
      subtitle: "Available 24/7 for urgent inspections"
    },
    {
      icon: Mail,
      title: "Email",
      details: "info@nqsinspection.com",
      subtitle: "Response within 24 hours"
    },
    {
      icon: MapPin,
      title: "Location",
      details: "Corpus Christi, Texas",
      subtitle: "Serving all of Texas"
    },
    {
      icon: Clock,
      title: "Business Hours",
      details: "Mon-Fri: 7:00 AM - 6:00 PM",
      subtitle: "Emergency services available 24/7"
    }
  ];

  return (
    <section id="contact" className="light-section diagonal-cut-top py-24">
      <div 
        className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 parallax-element"
        style={{ transform: `translateY(${scrollY * 0.05}px)` }}
      >
        {/* Section Header */}
        <div className="text-center mb-16">
          <h2 className="text-4xl md:text-5xl font-bold mb-6">
            Get In <span className="text-glow">Touch</span>
          </h2>
          <p className="text-xl max-w-2xl mx-auto">
            Ready to schedule an inspection? Contact our certified professionals today.
          </p>
        </div>

        {/* Emergency Alert */}
        <div className="bg-primary/10 border border-primary/30 rounded-lg p-4 mb-12 max-w-3xl mx-auto">
          <div className="flex items-center space-x-3">
            <AlertCircle className="w-5 h-5 text-primary flex-shrink-0" />
            <div>
              <h3 className="font-semibold text-primary">24/7 Emergency Support</h3>
              <p className="text-sm">For urgent inspection needs, call our hotline immediately.</p>
            </div>
          </div>
        </div>

        <div className="grid grid-cols-1 lg:grid-cols-2 gap-12">
          {/* Contact Information */}
          <div className="space-y-8">
            <div>
              <h3 className="text-2xl font-bold text-foreground mb-6">Contact Information</h3>
              <div className="grid grid-cols-1 sm:grid-cols-2 gap-6">
                {contactInfo.map((info, index) => {
                  const IconComponent = info.icon;
                  return (
                    <Card key={index} className="industrial-card">
                      <CardContent className="p-6">
                        <div className="flex items-start space-x-4">
                          <div className="w-10 h-10 bg-primary/10 rounded-lg flex items-center justify-center flex-shrink-0">
                            <IconComponent className="w-5 h-5 text-primary" />
                          </div>
                          <div>
                            <h4 className="font-semibold text-foreground mb-1">{info.title}</h4>
                            <p className="text-primary font-medium mb-1">{info.details}</p>
                            <p className="text-sm text-muted-foreground">{info.subtitle}</p>
                          </div>
                        </div>
                      </CardContent>
                    </Card>
                  );
                })}
              </div>
            </div>

            {/* Service Areas */}
            <div>
              <h3 className="text-xl font-bold text-foreground mb-4">Service Areas</h3>
              <p className="text-muted-foreground mb-4">
                We provide comprehensive inspection services throughout Texas, including:
              </p>
              <div className="grid grid-cols-2 gap-2 text-sm text-muted-foreground">
                <div>• Houston</div>
                <div>• Corpus Christi</div>
                <div>• Austin</div>
                <div>• Dallas</div>
                <div>• San Antonio</div>
                <div>• Beaumont</div>
                <div>• Port Arthur</div>
                <div>• And surrounding areas</div>
              </div>
            </div>
          </div>

          {/* Contact Form */}
          <div>
            <Card className="industrial-card">
              <CardHeader>
                <CardTitle className="text-2xl font-bold text-foreground">
                  Schedule an Inspection
                </CardTitle>
              </CardHeader>
              <CardContent className="space-y-6">
                <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                  <div>
                    <Label htmlFor="firstName" className="text-foreground">First Name</Label>
                    <Input 
                      id="firstName" 
                      className="bg-background border-border focus:border-primary"
                      placeholder="John"
                    />
                  </div>
                  <div>
                    <Label htmlFor="lastName" className="text-foreground">Last Name</Label>
                    <Input 
                      id="lastName" 
                      className="bg-background border-border focus:border-primary"
                      placeholder="Doe"
                    />
                  </div>
                </div>
                
                <div>
                  <Label htmlFor="email" className="text-foreground">Email Address</Label>
                  <Input 
                    id="email" 
                    type="email" 
                    className="bg-background border-border focus:border-primary"
                    placeholder="john.doe@company.com"
                  />
                </div>
                
                <div>
                  <Label htmlFor="phone" className="text-foreground">Phone Number</Label>
                  <Input 
                    id="phone" 
                    type="tel" 
                    className="bg-background border-border focus:border-primary"
                    placeholder="+1 (555) 123-4567"
                  />
                </div>

                <div>
                  <Label htmlFor="service" className="text-foreground">Service Required</Label>
                  <Input 
                    id="service" 
                    className="bg-background border-border focus:border-primary"
                    placeholder="e.g., Pipeline Inspection, Welding Testing"
                  />
                </div>
                
                <div>
                  <Label htmlFor="message" className="text-foreground">Project Details</Label>
                  <Textarea 
                    id="message" 
                    className="bg-background border-border focus:border-primary min-h-[100px]"
                    placeholder="Please describe your inspection requirements, timeline, and any specific standards or certifications needed..."
                  />
                </div>
                
                <Button className="btn-orange-glow w-full">
                  <Send className="w-4 h-4 mr-2" />
                  Submit Request
                </Button>
                
                <p className="text-sm text-muted-foreground text-center">
                  We'll respond to your inquiry within 24 hours. For emergency services, please call our hotline.
                </p>
              </CardContent>
            </Card>
          </div>
        </div>
      </div>
    </section>
  );
};

export default Contact;