import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"

const badgeVariants = cva(
  "inline-flex items-center gap-1 font-mono text-xs font-bold uppercase tracking-widest px-2.5 py-0.5 border",
  {
    variants: {
      variant: {
        default:  "bg-[var(--surface)] text-[var(--text)] border-[var(--border)]",
        accent:   "bg-[var(--accent)] text-white border-transparent",
        outline:  "bg-transparent text-[var(--text)] border-[var(--border-subtle)]",
        drop:     "bg-[var(--accent)] text-white border-transparent animate-pulse",
        sold:     "bg-[var(--surface-raised)] text-[var(--text-muted)] border-[var(--border)] line-through",
        new:      "bg-[var(--gray-50)] text-[var(--black)] border-transparent",
        upcoming: "bg-transparent text-[var(--accent)] border-[var(--accent)]",
      },
      rounded: {
        none: "rounded-none",
        sm:   "rounded-[var(--radius-sm)]",
        full: "rounded-full",
      },
    },
    defaultVariants: {
      variant: "default",
      rounded: "none",
    },
  }
)

export interface BadgeProps
  extends React.HTMLAttributes<HTMLSpanElement>,
    VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, rounded, ...props }: BadgeProps) {
  return (
    <span className={cn(badgeVariants({ variant, rounded, className }))} {...props} />
  )
}

export { Badge, badgeVariants }
