I have been wondering, reading online and discussing with friends over this German expression for a long time. I want to know if German speakers, Austrian males especially, feel that by saying "Es tut mir leid" they are expressing guilt and apologizing for a mistake they made. Is that its only meaning? Or can it also be used to express with empathy that you are sorry about something that is ABSOLUTELY not your fault? (by that I mean the "I'm sorry" we use in English such as "I am sorry you had a bad day" or "I'm sorry for your loss").
I am wondering if you feel you could react to the following situations by saying "Es tut mir leid, dass..." to express empathy and feelings of understanding towards another person, who might feel sad, angry, frustrated etc...
Someone's grandma dies, you go to visit the person --> "Es tut mir leid, dass du traurig bist" or "Es tut mir für dich und deine Familie leid"
Your girlfriend is sad because she had a bad day --> "Es tut mir leid, dass du einen schlechten Tag gehabt hast."
A friend is down because he was criticized at work and has just told you --> "Es tut mir leid, dass es passiert ist"
Your sister lost her connecting flight and calls you to complain and express frustration --> "Es tut mir leid, was passiert ist"
A friend did not pass the most important exam of his Bachelor's degree and now has to wait a year to take the same exam again --> "Es tut mir sehr leid, dass du Pech gehabt hast".
If these expressions are not appropriate would you please let me know what kind of expressions could be used in German to react to them with empathy and understanding?
I want to be able to express feelings in German but I am seriously having a hard time finding the right way.