import type { ComponentProps } from 'react';
import { cn } from '@/lib/utils';

function Card({ className, ref, ...props }: ComponentProps<'div'>) {
  return (
    <div
      ref={ref}
      className={cn(
        'rounded-xl border border-border/75 bg-card/95 text-card-foreground shadow-sm shadow-black/10 backdrop-blur-sm transition-shadow hover:shadow-md hover:shadow-black/10',
        className,
      )}
      {...props}
    />
  );
}

function CardHeader({ className, ref, ...props }: ComponentProps<'div'>) {
  return <div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />;
}

function CardTitle({ className, ref, ...props }: ComponentProps<'div'>) {
  return (
    <div
      ref={ref}
      className={cn('font-semibold leading-tight text-foreground', className)}
      {...props}
    />
  );
}

function CardDescription({ className, ref, ...props }: ComponentProps<'div'>) {
  return (
    <div
      ref={ref}
      className={cn('text-sm font-medium leading-relaxed text-muted-foreground', className)}
      {...props}
    />
  );
}

function CardContent({ className, ref, ...props }: ComponentProps<'div'>) {
  return <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />;
}

function CardFooter({ className, ref, ...props }: ComponentProps<'div'>) {
  return <div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />;
}

export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };
