interface StatCardProps {
  title: string;
  value: string | number;
  icon: string;
  iconBg?: string;
  iconStyle?: React.CSSProperties;
  trend?: string;
  trendUp?: boolean;
  sub?: string;
}

export default function StatCard({ title, value, icon, iconBg, iconStyle, trend, trendUp, sub }: StatCardProps) {
  return (
    <div className="bg-white rounded-xl p-4 lg:p-5 shadow-sm border border-gray-100 hover:-translate-y-1 transition-transform">
      <div className="flex items-start justify-between mb-3">
        <div className={`w-10 h-10 lg:w-12 lg:h-12 rounded-xl flex items-center justify-center ${iconBg || ''}`} style={iconStyle}>
          <i className={`${icon} text-white text-lg lg:text-xl`}></i>
        </div>
        {trend && (
          <span className={`text-xs font-semibold px-2 py-1 rounded-full ${trendUp ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-600'}`}>
            <i className={`${trendUp ? 'ri-arrow-up-line' : 'ri-arrow-down-line'}`}></i> {trend}
          </span>
        )}
      </div>
      <p className="text-2xl lg:text-3xl font-bold text-gray-800">{value}</p>
      <p className="text-xs lg:text-sm text-gray-500 mt-1">{title}</p>
      {sub && <p className="text-xs mt-1 font-medium" style={{ color: '#b828a0' }}>{sub}</p>}
    </div>
  );
}
