'use client';

import { ButtonHTMLAttributes, ReactNode } from 'react';

interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
  variant?: 'primary' | 'secondary' | 'outline' | 'action';
  size?: 'sm' | 'md' | 'lg';
  leftIcon?: ReactNode;
  children: ReactNode;
}

export function Button({
  variant = 'primary',
  size = 'md',
  leftIcon,
  children,
  className = '',
  ...props
}: ButtonProps) {
  const baseStyles = 'font-medium transition-all duration-200 inline-flex items-center justify-center cursor-pointer';

  const variants = {
    primary: 'bg-[#f5a623] text-white hover:bg-[#e09620] active:bg-[#c98a1c] rounded-lg',
    secondary: 'bg-[#00293d] text-white hover:bg-[#003a57] active:bg-[#001f2e] rounded-lg',
    outline: 'border-2 border-[#00293d] text-[#00293d] hover:bg-[#00293d] hover:text-white rounded-lg',
    action: 'bg-[#e58625] text-white border-[0.1px] border-[#00293d] rounded-[15px] hover:bg-[#d47920] active:bg-[#c26e1b]',
  };

  const sizes = {
    sm: 'px-4 py-2 text-sm',
    md: 'px-6 py-3 text-base',
    lg: 'px-8 py-4 text-lg',
  };

  return (
    <button
      className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${className}`}
      {...props}
    >
      {leftIcon && <span className="mr-2">{leftIcon}</span>}
      {children}
    </button>
  );
}
