Yeah... What you did was obviously wrong. Now you have to earn her trust back, which could be a long, treacherous road. She most likely used to seek comfort in you and used to be able to come to you with any issues, but you totally obliterated that by engaging in obviously inappropriate behavior.
Give her some time to allow the initial wounds to heal, then try and talk to her. Tell her you were weak and that you made a terrible, terrible mistake and you'll do anything to salvage your relationship with her. Actions speak louder than words, so SHOW her you feel terrible and that she is your top priority.