I'm sure that your relationship with your daughter is based on far more than your being the "bad guy" and her testing your limits. I hope that, throughout her childhood, you have developed a relationship based on unconditional love, trust, appreciation, and mutual respect. If that's the case, your current relationship will continue to grow, regardless of which parent she lives with until she graduates high school.
Given the strain within your family, I think that it might be useful for you and your daughter to see a counselor together and to focus on your desire to maintain a loving relationship with her. It's very important that she know that she's a priority in your life. Working with a family counselor as a family -- you, your daughter, and your husband -- would be a sensible use of counseling at this pivotal time in your family life.
Your daughter is fortunate to have had a parent who knew that limits and rules needed to be set. You did not treat parenting as a popularity contest with your child. Kids tell me all the time in therapy that they were grateful that their parents cared enough to set limits and to have family rules. They never told their parents, but they were made to feel more secure as a result of that concern for their safety.