import React from 'react';
import { Loader2 } from 'lucide-react';

interface GlobalLoadingProps {
  isLoading: boolean;
  text?: string;
}

const GlobalLoading: React.FC<GlobalLoadingProps> = ({
  isLoading,
  text = 'Loading...',
}) => {
  if (!isLoading) return null;

  return (
    <div
      className="fixed inset-0 z-50 flex items-center justify-center bg-white bg-opacity-75 backdrop-blur-sm"
      role="status"
      aria-label="Loading"
    >
      <div className="flex flex-col items-center gap-4">
        <Loader2 className="w-8 h-8 text-indigo-600 animate-spin" />
        <p className="text-sm font-medium text-gray-700">{text}</p>
      </div>
    </div>
  );
};

export default GlobalLoading;

