This question is more about social interaction than language use.
Think about how you'd express your "real sympathy" in your native language. There are socially accepted formulas in every language and every society and culture, but your "true feelings" are expressed more by the tone of voice and the body language that you use rather than the words (unless the words are obviously inappropriate for the occasion).
If someone else's mother's been hospitalized for an illness, That's too bad isn't the best expression. I'm really sorry to hear that plus, perhaps, I hope she'll recover quickly is much better. Stick to the formulaic if you can't come up with a spontaneously appropriate expression.
My son, a native speaker of Chinese, not really a native Anglophone, says too bad all the time. I find it annoying, but I think he learned it from me. I use it for stuff like having to work two weeks straight without any time off and other unpleasantries of everyday life, but never to express sympathy for sickness or death or anything else that's serious.
Although it's difficult to say "Too bad" without sounding sarcastic, it's possible. I wouldn't advise it, though, because it's too terse, too curt, to be sympathetic. "That's too bad" is a little better, but, depending on your tone of voice and body language, it can express sympathy, but it's not the best way to be taken seriously by someone who's grieving about a loss or an ill relative.
Both are okay, but they might or might not mean something different depending on how you look at it.
Generally, "Whenever X, Y" means that X happened/happens/is supposed to happen many times, and each and every time Y also happens (or in this case, you're told to make it happen). So your sentence would read as a general rule - "you'll have many chances to hold onto happiness in your life, and each time that happens, make sure to do so".
"When X, Y" can mean a single occurence - X happened/will happen, and Y happened/will happen at the same time. So you'd rather say "...when you get the chance" if there's a particular chance to be had - for example, you know your friend is getting a new job, and he's being anxious for it, so you're telling him to hold onto that once he gets the chance (and that job). Compare "When you get that job, you'll be out of trouble" vs (technically grammatical, but making no sense). !"Whenever you get that job, you'll be out of trouble"
Now, what @Man_From_India said also holds - if the context or grammar already estabilishes that you're talking about a repeating occurence, you can use "when" in place of "whenever". For example, "Check your locks when you leave your house" can be placed in a health and safety guide, and it would mean the same as "...whenever you leave...".
Best Answer
In that particular sentence it would be more normal to say "And you were." This is because being with someone is a continuous event so you would use "were" which is the past progressive tense of the verb "to be". "Did" is the past tense of "to do" so would be used for an action completed in the past like "you did the shopping yesterday." If you need to refer to an ongoing action in the past, the past progressive of "to do" would be "you were doing" in which case you might use "so" or "just that" afterwards although it it's often redundant (which doesn't mean you shouldn't use it or it is incorrect, just not necessary).