It was good there you didn't immediately panick or run immediately you saw the bear. 30 to 40 feet away is a ridiculously close range to be with a bear, especially considering he's fact that they can run over 20 miles an hour. Also, the first instinct was safety, so, great to see it was a safe experience for you.
I've been out very sick for a few days now, so I didn't check to see the bear experience post..
Yes, all I did was pick up my pace, I knew running would have been a bad move.
Hope you are feeling better!