"use client";

import Link from 'next/link';
import { Home } from 'lucide-react';
import { usePathname } from 'next/navigation';

export default function BackToHome() {
  const pathname = usePathname();

  // Don't show the button if we are already on the home page
  if (pathname === '/') {
    return null;
  }

  return (
    <Link 
      href="/"
      className="fixed bottom-6 right-6 z-[9999] bg-neutral-900 text-white p-4 rounded-full shadow-2xl hover:bg-yellow-500 hover:text-neutral-900 hover:-translate-y-1 transition-all duration-300 group flex items-center justify-center"
      aria-label="Back to Home"
    >
      <Home className="w-6 h-6" />
      {/* Optional: Expanding text on hover */}
      <span className="max-w-0 overflow-hidden whitespace-nowrap group-hover:max-w-xs group-hover:ml-2 transition-all duration-300 ease-in-out font-bold text-sm">
        Back to Home
      </span>
    </Link>
  );
}