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

interface StatCardProps {
  icon: LucideIcon;
  label: string;
  value: string | number;
  trend?: string;
  themeColor?: 'amber' | 'emerald' | 'violet' | 'blue';
  className?: string;
}

const themeConfig = {
  amber: { bg: 'bg-amber-50', icon: 'text-amber-600', border: 'border-amber-200' },
  emerald: { bg: 'bg-emerald-50', icon: 'text-emerald-600', border: 'border-emerald-200' },
  violet: { bg: 'bg-violet-50', icon: 'text-violet-600', border: 'border-violet-200' },
  blue: { bg: 'bg-blue-50', icon: 'text-blue-600', border: 'border-blue-200' },
};

export function StatCard({ icon: Icon, label, value, trend, themeColor = 'blue', className = '' }: StatCardProps) {
  const theme = themeConfig[themeColor];

  return (
    <div className={`rounded-xl border ${theme.border} ${theme.bg} p-4 ${className}`}>
      <div className="flex items-center gap-3">
        <div className={`p-2 rounded-lg bg-white/60`}>
          <Icon className={`w-5 h-5 ${theme.icon}`} />
        </div>
        <div className="flex-1 min-w-0">
          <p className="text-xs text-gray-500 truncate">{label}</p>
          <p className="text-xl font-bold text-gray-900 truncate">{value}</p>
        </div>
      </div>
      {trend && <p className="mt-2 text-xs text-gray-500">{trend}</p>}
    </div>
  );
}
