'use client';

import { usePathname } from 'next/navigation';
import Image from 'next/image';
import { WHATSAPP_URL } from '@/lib/config/whatsapp';

export default function WhatsAppFloatingButton() {
  const pathname = usePathname();
  const isAdminPage = pathname?.startsWith('/admin');

  if (isAdminPage) {
    return null;
  }

  return (
    <a
      href={WHATSAPP_URL}
      target="_blank"
      rel="noopener noreferrer"
      className="fixed bottom-6 right-6 z-50 inline-flex items-center gap-2 rounded-full bg-[#25D366] px-4 py-3 text-sm font-semibold text-white shadow-lg transition-transform hover:scale-105 hover:bg-[#1eb255]"
      aria-label="Chat on WhatsApp"
    >
      <div className="relative h-5 w-5">
        <Image
          src="/assets/whatsapp.png"
          alt="WhatsApp"
          fill
          sizes="20px"
          priority
        />
      </div>
      <span>Chat on WhatsApp</span>
    </a>
  );
}

