import { cn } from '@/lib/utils';

interface StatCardProps {
  label: string;
  value: string | number;
  icon: React.ReactNode;
  change?: string;
  trend?: 'up' | 'down' | 'neutral';
  iconClassName?: string;
  className?: string;
}

export function StatCard({
  label,
  value,
  icon,
  change,
  trend = 'neutral',
  iconClassName = 'text-blue-600 bg-blue-50',
  className,
}: StatCardProps) {
  return (
    <div
      className={cn(
        'bg-white rounded-2xl p-5 border border-gray-100 hover:shadow-md transition-shadow',
        className
      )}
    >
      <div className="flex items-center justify-between mb-4">
        <div
          className={cn(
            'w-10 h-10 rounded-xl flex items-center justify-center',
            iconClassName
          )}
        >
          {icon}
        </div>
        {change && (
          <span
            className={cn(
              'text-xs font-semibold px-2 py-1 rounded-full',
              trend === 'up' && 'text-green-700 bg-green-50',
              trend === 'down' && 'text-red-700 bg-red-50',
              trend === 'neutral' && 'text-gray-600 bg-gray-100'
            )}
          >
            {change}
          </span>
        )}
      </div>
      <p className="text-2xl font-black text-gray-900">{value}</p>
      <p className="text-gray-500 text-sm mt-0.5">{label}</p>
    </div>
  );
}
