import React from 'react';
import { Card } from './Card';

interface StatCardProps {
  title: string;
  value: string | number;
  icon?: React.ReactNode;
  trend?: { value: number; label: string };
}

export function StatCard({ title, value, icon, trend }: StatCardProps) {
  return (
    <Card className="flex flex-col hover:-translate-y-1 transition-transform duration-300">
      <div className="flex items-center justify-between mb-4">
        <h3 className="text-xs font-semibold text-rima-muted uppercase tracking-wider">{title}</h3>
        {icon && <div className="text-rima-primary p-2 bg-rima-primary/10 rounded-xl">{icon}</div>}
      </div>
      <div className="text-3xl font-bold text-rima-text mb-2">{value}</div>
      {trend && (
        <div className={`text-xs mt-auto font-medium ${trend.value >= 0 ? 'text-rima-success' : 'text-rima-danger'}`}>
          {trend.value >= 0 ? '↑' : '↓'} {Math.abs(trend.value)}% <span className="text-rima-muted ml-1 font-normal">{trend.label}</span>
        </div>
      )}
    </Card>
  );
}
