I have to respond to your post because, 16 years ago, I was where you are now.
I had an awful relationship with my mother, who prefers boys. (She is still a horrible person now and I hardly ever see her.)
I had my son first and loved him very much. Then when I was pregnant with my second child, we had a scan and found out she was a girl. This absolutely horrified me. I wasn't expecting to have this reaction at all - obviously anyone knows that it's a 50/50 chance!! - but somehow, knowing that she was a girl just made me so sad and scared and worried. I thought of daughters as manipulative and competitive, not like sons who love their mothers. Obviously this is stupid, but all these feelings kept coming up from my own childhood and my own mother's attitudes. The baby was healthy but I didn't want to have her at all, I was frightened that I would be a bad mother to a girl and that she would resent me.
I went to my GP and told her I was really having problems. I made a big fuss about it because I knew I needed help. She referred me to a psychiatrist and I had therapy. (I had already had therapy for depression when I was younger, but somehow this pregnancy and expecting a girl had brought up lots of problems.)
Eventually I got to feel that it wasn't the baby's fault that it was a girl. (I know this isn't exactly a good way of thinking about it, but it was a bit of an improvement.) I felt that the baby was tiny and vulnerable and would depend on me, and I could take good care of her just like I took care of her older brother.
When my daughter was born, I felt like she was more self-sufficient than her brother had been (her brother was a very high needs baby). In the early days and months, I took good care of her, although looking back I don't think I felt as close with her as I did with her brother. I was still getting used to things, but I worked very hard to be a good mother to her and cuddle her and play with her.
But as she got to be a toddler and a little kid then she became the light of my life. Honestly, she was a joy, so funny and cute and kind. She looked up to me as the wonderful mummy who cared for her and could do anything. She wanted to please me and make me happy. Even now, as a teenager, she is a complete joy (and you can't say that about many teenagers!). There is no feeling of competition or envy between us. I am so proud that she is clever and talented, and so beautiful. I want to build her confidence and give her opportunities. She will do great things and I want her to have a wonderful life.
Now I realise that my own mother is a very bitter and weird woman with her own big set of problems. Her way of thinking was twisted and this is not what mother/daughter relationships are like.
So this is my story. I honestly think it will be yours as well, if you have a daughter. I can understand that you feel unhappy and scared now, but this is because of your own upbringing with someone who didn't value you the way that you value your own children. Please go to your GP and ask for help with these feelings. Make a big fuss if you have to. Talking to a therapist will be helpful. You are a good mother to your children and you will be a good mother to this one as well.