import React from "react";

interface LoaderProps {
  size?: "sm" | "md" | "lg";
  className?: string;
  fullScreen?: boolean;
}

const sizeClasses = {
  sm: "w-4 h-4",
  md: "w-8 h-8",
  lg: "w-12 h-12",
};

export const Loader: React.FC<LoaderProps> = ({
  size = "lg",
  className = "",
  fullScreen = true,
}) => {
  if (fullScreen) {
    return (
      <div className="fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50">
        <div className={`${sizeClasses[size]} ${className}`}>
          <div className="w-full h-full border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin" />
        </div>
      </div>
    );
  }

  return (
    <div className={`inline-block ${sizeClasses[size]} ${className}`}>
      <div className="w-full h-full border-4 border-gray-200 border-t-blue-600 rounded-full animate-spin" />
    </div>
  );
};

export default Loader;
