"use client";

import { motion } from "framer-motion";
import type { LucideIcon } from "lucide-react";
import { Card } from "@/components/ui/card";

export function MetricCard({ icon: Icon, label, value, detail, index = 0 }: { icon: LucideIcon; label: string; value: string; detail?: string; index?: number }) {
  return (
    <motion.div initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} transition={{ delay: index * 0.04, duration: 0.35 }}>
      <Card className="h-full p-4 sm:p-5">
        <div className="flex items-center gap-2 text-xs font-medium uppercase tracking-[0.14em] text-muted">
          <Icon className="size-4 text-accent" />
          {label}
        </div>
        <p className="mt-4 text-xl font-semibold tracking-tight">{value}</p>
        {detail && <p className="mt-1 text-xs text-muted">{detail}</p>}
      </Card>
    </motion.div>
  );
}
