import React from 'react';

interface ActionButtonProps {
  onClick: () => void;
  variant?: 'primary' | 'secondary';
  size?: 'sm' | 'md';
  disabled?: boolean;
  children: React.ReactNode;
  className?: string;
  type?: 'button' | 'submit';
}

export const ActionButton: React.FC<ActionButtonProps> = ({
  onClick,
  variant = 'secondary',
  size = 'md',
  disabled = false,
  children,
  className = '',
  type = 'button',
}) => {
  const baseClass =
    'font-mono transition-all duration-200 border disabled:cursor-not-allowed disabled:opacity-40';

  const sizeClasses = {
    sm: 'px-3 py-1.5 text-[11px]',
    md: 'px-4 py-2 text-xs',
  };

  const variantClasses = {
    primary:
      'bg-info border-info text-term-bg hover:brightness-110 active:scale-[0.98]',
    secondary:
      'bg-term-surface border-term-border text-term-text-tertiary hover:border-info hover:text-term-text active:scale-[0.98]',
  };

  return (
    <button
      type={type}
      className={`${baseClass} ${sizeClasses[size]} ${variantClasses[variant]} ${className}`.trim()}
      onClick={onClick}
      disabled={disabled}
    >
      {children}
    </button>
  );
};

interface ButtonGroupProps {
  children: React.ReactNode;
  className?: string;
}

export const ButtonGroup: React.FC<ButtonGroupProps> = ({ children, className = '' }) => {
  return <div className={`flex flex-wrap gap-2 ${className}`.trim()}>{children}</div>;
};
