My question involves criminal law for the state of: CA

So last sunday i was not having a good day and for whatever reason decided to go take a stroll through the local walmart around the corner from where i live.
I'm not sure what came over me, it was completely out of character but i tried to pocket a 40 cell phone case but was caught by security as i was walking out.
i realize what i did was foolish and i now have to deal with my mistake but this is the first time something like this that has happened to me, so i come to you guys hoping for some guidance.

the security guards took me to a room on the side of the store and gave me a piece of paper, saying walmart was going to mail me a fine they want me to pay. then 2 police officers showed up and gave me a court date next month on the 18th.

What do i need to do to prepare myself for court? ive never been before.
and how much is this going to cost me? im a full time college student barely getting by and this whole situation has me stressed out, i cant believe how stupid i was being.