"use client";

import { Mail, Phone, MapPin, Clock } from "lucide-react";
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
import { config } from "@/lib/config";

export default function ContactSection() {
  const contact = config.contact;

  return (
    <Card className="bg-secondary">
      <CardHeader>
        <CardTitle>Nous contacter</CardTitle>
      </CardHeader>
      <CardContent className="space-y-4">
        {contact.phone && (
          <div className="flex items-start gap-3">
            <div className="bg-primary/10 p-2 rounded-xl">
              <Phone className="h-5 w-5 text-primary" />
            </div>
            <div className="flex-1">
              <p className="text-sm text-gray-600 mb-1">Téléphone</p>
              <a
                href={`tel:${contact.phone.replace(/\s/g, "")}`}
                className="text-primary font-semibold hover:underline"
              >
                {contact.phone}
              </a>
            </div>
          </div>
        )}

        {contact.whatsapp && (
          <div className="flex items-start gap-3">
            <div className="bg-green-100 p-2 rounded-xl">
              <Phone className="h-5 w-5 text-green-600" />
            </div>
            <div className="flex-1">
              <p className="text-sm text-gray-600 mb-1">WhatsApp</p>
              <a
                href={`https://wa.me/${contact.whatsapp.replace(/[^\d]/g, "")}`}
                target="_blank"
                rel="noopener noreferrer"
                className="text-green-600 font-semibold hover:underline"
              >
                {contact.whatsapp}
              </a>
            </div>
          </div>
        )}

        {contact.email && (
          <div className="flex items-start gap-3">
            <div className="bg-primary/10 p-2 rounded-xl">
              <Mail className="h-5 w-5 text-primary" />
            </div>
            <div className="flex-1">
              <p className="text-sm text-gray-600 mb-1">Email</p>
              <a
                href={`mailto:${contact.email}`}
                className="text-primary font-semibold hover:underline break-all"
              >
                {contact.email}
              </a>
            </div>
          </div>
        )}

        {contact.address && (
          <div className="flex items-start gap-3">
            <div className="bg-primary/10 p-2 rounded-xl">
              <MapPin className="h-5 w-5 text-primary" />
            </div>
            <div className="flex-1">
              <p className="text-sm text-gray-600 mb-1">Adresse</p>
              <p className="text-gray-700 font-medium">{contact.address}</p>
            </div>
          </div>
        )}

        {contact.hours && (
          <div className="flex items-start gap-3">
            <div className="bg-primary/10 p-2 rounded-xl">
              <Clock className="h-5 w-5 text-primary" />
            </div>
            <div className="flex-1">
              <p className="text-sm text-gray-600 mb-1">Horaires</p>
              <p className="text-gray-700 font-medium">{contact.hours}</p>
            </div>
          </div>
        )}
      </CardContent>
    </Card>
  );
}

