We are going to begin by suggesting that you cut off service to your 12-year-old daughter's phone. Second, we suggest that she lose access to all electronics and social media, especially ones that allow her to connect to the Internet. Let her know that she will have to show better judgment and use more socially acceptable behaviors in order to regain your trust, and that meeting those expectations is directly connected to regaining her phone and electronics privileges.
It’s not unusual for a child her age to choose friends over family, but it is not okay. She should be included in family functions of all kinds. If she earns the privilege of being with her friends, her friends should come to your home so you can monitor their interactions and make sure they are not having inappropriate conversations (and she is not using their electronic devices). If she violates these rules, she loses the privilege of spending time with her friends.
It is possible that her unacceptable behaviors are related to peer pressure to engage in risky behaviors such as stealing, sneaking out, having sex or other similar activities.
Since she will not “let you in,” scheduling an appointment with a doctor for a complete checkup and then a counselor or therapist would be in order. She has to talk to someone who can guide her to make choices that will keep her safe, both physically and emotionally.
As for the physical changes you are noticing, her entire body chemistry is changing too, and that directly affects her emotional makeup and her ability to handle stressful situations in her life.
Try to keep your daughter engaged with the family. When you say something and she begins to argue, do not “cooperate” with her. It takes two to argue, and if you don’t, there won’t be an argument. When she talks back, tell her immediately that the behavior is unacceptable and give her chores that will benefit the person she talked back to. You also should contact your daughter’s school and schedule an appointment with the counselor to discuss making a plan for improving her grades. At home, make sure her schoolwork comes first and that she has a designated time to work on it or other school-related activities.
Boyfriends and sex are a whole other issue. “Having a boyfriend” can mean a variety of different things, ranging from the relatively innocent (talking to a boy at school or attending events on weekends with groups of friends) to the not-so-innocent (intimate touching, sharing naked pictures or actually having sex).
Boys her age are naturally preoccupied with girls and thoughts of sex. If the girls’ bodies are changing, that of course gets their attention even more. Also, many older boys with more experience often target the younger, more innocent girls and groom them for sexual favors. Make sure that your daughter is aware that it can happen to her, and make sure she has a plan to deal with it. We cannot remove all the dangers from our children's world; we can only teach them how to handle them.
You have got a lot of teaching and relationship-building to do. But remember, it is when our children are the hardest to love that they need our love the most. Good luck!