import { cn } from '@/lib/utils';
import { cva, type VariantProps } from 'class-variance-authority';
import { HTMLAttributes } from 'react';

const badge = cva('inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium leading-none', {
    variants: {
        variant: {
            default: 'border-border bg-secondary text-secondary-foreground',
            accent: 'border-primary/30 bg-primary/12 text-primary',
            glass: 'glass border-border text-foreground',
            outline: 'border-border text-muted-foreground',
            success: 'border-emerald-500/25 bg-emerald-500/12 text-emerald-400',
            warning: 'border-amber-500/25 bg-amber-500/12 text-amber-400',
            danger: 'border-red-500/25 bg-red-500/12 text-red-400',
        },
    },
    defaultVariants: { variant: 'default' },
});

export function Badge({ className, variant, ...p }: HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badge>) {
    return <span className={cn(badge({ variant }), className)} {...p} />;
}
