import * as React from "react";

import { cn } from "@/lib/utils";

function Input({ className, type, ...props }: React.ComponentProps<"input">) {
  return (
    <input
      type={type}
      data-slot="input"
      className={cn(
        // Base styles with outlined appearance
        "flex h-9 w-full min-w-0 rounded-md px-3 py-1 text-base transition-[color,box-shadow] outline-none",
        // Outlined default state - 2px border with grey-3
        "border-2 border-grey-3 bg-grey-5",
        // Text and placeholder colors
        "text-grey-0 placeholder:text-grey-3",
        // Focus state - primary border with ring
        "focus-visible:border-[var(--primary-main)] focus-visible:ring-[var(--primary-main)]/20 focus-visible:ring-[3px]",
        // Error state
        "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
        // Disabled state
        "disabled:border-grey-4 disabled:bg-background-light-grey disabled:text-grey-2 disabled:cursor-not-allowed disabled:pointer-events-none",
        // File input specific
        "file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
        // Selection
        "selection:bg-primary selection:text-primary-foreground",
        "md:text-sm",
        className,
      )}
      {...props}
    />
  );
}

export { Input };