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: "Phone",
      details: "(361) 438-6807",
      subtitle: "Main business line"
    },
    {
      icon: Phone,
      title: "Additional Phone",
      details: "(760) 908-2269",
      subtitle: "Alternative contact"
    },
    {
      icon: Mail,
      title: "Email",
      details: "shugger@nqsltd.com",
      subtitle: "Primary contact email"
    },
    {
      icon: Mail,
      title: "General Inquiries",
      details: "tward@nqsltd.com",
      subtitle: "General inquiries email"
    },
    {
      icon: MapPin,
      title: "Location",
      details: "1906 Suntide Rd, Corpus Christi, TX 78409",
      subtitle: "Our office location"
    },
    {
      icon: Clock,
      title: "Business Hours",
      details: "Monday – Friday: 8AM – 4PM",
      subtitle: "Saturday: By Appointment Only, Sunday: Closed"
    }
  ];

  return (
    <section id="contact" className="light-section pt-16 pb-64">
      <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-12">
          <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-16">
          {/* Contact Information */}
          <div className="space-y-12">
            <div>
              <h3 className="text-2xl font-bold text-foreground mb-8">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 className="min-w-0 flex-1">
                            <h4 className="font-semibold text-foreground mb-1">{info.title}</h4>
                            <p className="text-primary font-medium mb-1 break-words">{info.details}</p>
                            <p className="text-sm text-muted-foreground break-words">{info.subtitle}</p>
                          </div>
                        </div>
                      </CardContent>
                    </Card>
                  );
                })}
              </div>
            </div>

            {/* Service Areas */}
            <div className="mt-12 mb-8">
              <h3 className="text-2xl font-bold text-foreground mb-8">Service Areas</h3>
              <p className="text-gray-600 mb-10 text-lg">
                We provide comprehensive inspection services in the Coastal Bend area, including:
              </p>
              <div className="grid grid-cols-1 sm:grid-cols-3 gap-6 text-sm text-gray-700">
                <div className="flex items-center">
                  <div className="w-2 h-2 bg-primary rounded-full mr-3 flex-shrink-0"></div>
                  <span>Corpus Christi</span>
                </div>
                <div className="flex items-center">
                  <div className="w-2 h-2 bg-primary rounded-full mr-3 flex-shrink-0"></div>
                  <span>Port Aransas</span>
                </div>
                <div className="flex items-center">
                  <div className="w-2 h-2 bg-primary rounded-full mr-3 flex-shrink-0"></div>
                  <span>Rockport</span>
                </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-8">
                <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-white text-black border-gray-300 focus:border-primary"
                      placeholder="John"
                    />
                  </div>
                  <div>
                    <Label htmlFor="lastName" className="text-foreground">Last Name</Label>
                    <Input 
                      id="lastName" 
                      className="bg-white text-black border-gray-300 focus:border-primary"
                      placeholder="Doe"
                    />
                  </div>
                </div>
                
                <div>
                  <Label htmlFor="email" className="text-foreground">Email Address</Label>
                  <Input 
                    id="email" 
                    type="email" 
                    className="bg-white text-black border-gray-300 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-white text-black border-gray-300 focus:border-primary"
                    placeholder="+1 (555) 123-4567"
                  />
                </div>

                <div>
                  <Label htmlFor="service" className="text-foreground">Service Required</Label>
                  <Input 
                    id="service" 
                    className="bg-white text-black border-gray-300 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-white text-black border-gray-300 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 mt-6">
                  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;