'use client';

import { useState } from 'react';
import { motion } from 'framer-motion';

export default function Contact() {

  const [formData, setFormData] = useState({
    firstName: '',
    lastName: '',
    email: '',
    phone: '',
    message: '',
  });

  const handleSubmit = (e: React.FormEvent) => {
    e.preventDefault();
    // Handle form submission here
    console.log('Form submitted:', formData);
    alert('Thank you for your message! We will get back to you soon.');
    setFormData({
      firstName: '',
      lastName: '',
      email: '',
      phone: '',
      message: '',
    });
  };

  const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {
    setFormData({
      ...formData,
      [e.target.name]: e.target.value,
    });
  };

  return (
    <section id="contact" className="py-20 md:py-32 bg-white">
      <div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8">
        <motion.div
          initial={{ opacity: 0, y: 30 }}
          whileInView={{ opacity: 1, y: 0 }}
          viewport={{ once: true, margin: '-100px' }}
          transition={{ duration: 0.8, ease: [0.25, 0.1, 0.25, 1] }}
          className="text-center mb-12"
        >
          <h2 style={{ color: '#00171F' }} className="text-3xl md:text-4xl lg:text-5xl font-bold mb-4">
            Contact Me
          </h2>
          <p style={{ color: '#00171F' }} className="text-lg md:text-xl">
            I&apos;m here for you!
          </p>
          <p style={{ color: '#00171F' }} className="mt-2">
             I'm available for both private sessions as well as public speaking arrangements and tailored workshops. Contact me directly for more detailed information and a non-commitment quote.
          </p>
        </motion.div>

        <motion.div
          initial={{ opacity: 0, y: 30 }}
          whileInView={{ opacity: 1, y: 0 }}
          viewport={{ once: true, margin: '-100px' }}
          transition={{ duration: 0.8, delay: 0.2, ease: [0.25, 0.1, 0.25, 1] }}
        >
          <form
            onSubmit={handleSubmit}
            className="space-y-6"
          >
          <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
            <div>
              <label htmlFor="firstName" className="block text-sm font-medium mb-2" style={{ color: '#00171F' }}>
                First name <span className="text-red-500">*</span>
              </label>
              <input
                type="text"
                id="firstName"
                name="firstName"
                required
                value={formData.firstName}
                onChange={handleChange}
                className="w-full px-4 py-3 border rounded-lg outline-none transition-all"
                style={{ borderColor: '#EED2CC', color: '#00171F' }}
              />
            </div>
            <div>
              <label htmlFor="lastName" className="block text-sm font-medium mb-2" style={{ color: '#00171F' }}>
                Last name <span className="text-red-500">*</span>
              </label>
              <input
                type="text"
                id="lastName"
                name="lastName"
                required
                value={formData.lastName}
                onChange={handleChange}
                className="w-full px-4 py-3 border rounded-lg outline-none transition-all"
                style={{ borderColor: '#EED2CC', color: '#00171F' }}
              />
            </div>
          </div>

          <div>
            <label htmlFor="email" className="block text-sm font-medium mb-2" style={{ color: '#00171F' }}>
              Email <span className="text-red-500">*</span>
            </label>
            <input
              type="email"
              id="email"
              name="email"
              required
              value={formData.email}
              onChange={handleChange}
              className="w-full px-4 py-3 border rounded-lg outline-none transition-all"
              style={{ borderColor: '#EED2CC', color: '#00171F' }}
            />
          </div>

          <div>
            <label htmlFor="phone" className="block text-sm font-medium mb-2" style={{ color: '#00171F' }}>
              Phone
            </label>
            <input
              type="tel"
              id="phone"
              name="phone"
              value={formData.phone}
              onChange={handleChange}
              className="w-full px-4 py-3 border rounded-lg outline-none transition-all"
              style={{ borderColor: '#EED2CC', color: '#00171F' }}
            />
          </div>

          <div>
            <label htmlFor="message" className="block text-sm font-medium mb-2" style={{ color: '#00171F' }}>
              Message
            </label>
            <textarea
              id="message"
              name="message"
              rows={6}
              value={formData.message}
              onChange={handleChange}
              className="w-full px-4 py-3 border rounded-lg outline-none transition-all resize-none"
              style={{ borderColor: '#EED2CC', color: '#00171F' }}
            />
          </div>

          <button
            type="submit"
            style={{ backgroundColor: '#00171F' }}
            className="w-full text-white px-8 py-4 rounded-full text-lg font-semibold hover:opacity-90 transition-all transform hover:scale-105 shadow-lg hover:shadow-xl"
          >
            Send
          </button>
        </form>
        </motion.div>
      </div>
    </section>
  );
}

