interface ToolProgressTints {
  ink: string;
  neon: string;
}

export function ToolProgress({
  percentage,
  message,
  onCancel,
  dark,
  tints
}: {
  percentage: number;
  message?: string;
  onCancel?: () => void;
  dark?: boolean;
  tints?: ToolProgressTints;
}) {
  const isDark = dark ?? false;

  return (
    <div className="flex flex-col gap-3 p-4 rounded-[14px] border border-[var(--p-border)] bg-[var(--p-surface-2)]">
      <div className="flex items-center justify-between">
        <span className="font-sans text-[13px] text-[var(--p-text)] font-medium">
          {message || "Processing..."}
        </span>
        <span className="font-mono text-[11px] text-[var(--p-muted)]">
          {Math.round(percentage)}%
        </span>
      </div>
      
      <div className="h-1.5 w-full bg-[var(--p-border)] rounded-full overflow-hidden">
        <div 
          className="h-full transition-all duration-300 ease-out"
          style={{ 
            width: `${percentage}%`,
            background: isDark ? (tints?.neon || 'var(--p-accent)') : (tints?.ink || 'var(--p-accent)')
          }}
        />
      </div>

      {onCancel && (
        <div className="flex justify-end mt-1">
          <button
            onClick={onCancel}
            className="px-3 py-1.5 rounded-lg bg-[var(--p-chip)] text-[var(--p-muted)] font-sans text-xs hover:text-[var(--p-text)] transition-colors cursor-pointer"
          >
            Cancel
          </button>
        </div>
      )}
    </div>
  );
}
