Short answer: Family courts are notoriously biased towards females (I won't say mothers... a buddy of mind couldn't get his kids back from his drug addicted ex-wife until she was busted for screwing a 14 year old). It's not fair, it sucks, but it's the world in which we live. DO NOT LET THIS DESTROY YOUR SPIRIT.
My first caveat would be: Beware of worthless lawyers. Locally, there is one attorney among God knows how many that I actually trust. First and foremost, find legal representation worth the ridiculous sum you are likely going to pay. If you have a lawyer who does nothing more than stroke your ego and make empty promises to you, fire him/her. You can give your money to a whore and get better results.
Secondly, know your rights and contact advocacy groups. I can't remember the name of the group that advocates for divorced fathers (do a search), but I know there is at least one that appears to be reputable.
I've been in your position. My son finally came to me after years of dealing with a biased family court system. The boy is involved in sports and other social activities, doing better in school, and states he in no way has any desire to ever return to his mother's home. Unfortunately, the only thing that mattered was when my boy was actually able to speak for himself. I would say just continue to do your best to be a good parent. Have faith in your child. If your wife and others are shallow and vindictive, kids who aren't corrupted by this will pick up on it and they do know who has their best interests in mind. I wish you and your daughter the best.