I experienced this same issue with my daughter when she was 12/13 years old. This is truly and age of rebellion for any child...male, female, present times and 20 years ago. So don't feel too bad about that part.
Here is what we did. We finally pulled everything. No threats, no negotiations. We had her shut down and cancel all accounts. She gets her phone and that has to be put away on the community charger by 10pm each night. If this does not happen. We enforce pre-set consequences.
Examples: If she doesn't meet the deadline for putting her phone up she gets grounded...and we are all grounded BTW because that's the only way to make grounding work. How long? This is dependent on how she reacts to being grounded.
Once she complied with this for a period of time we let her choose ONE social media outlet to use.
She is now 16 and has lost most of her interest in social media at all. She sleeps better, is much nicer to be around and isn't being pulled into all of that teen drama she used to be wrapped up in.
TIPS: YOU ARE THE PARENTS!!! She is a child and these things are PRIVILEGES, not rights. NEVER allow a child to engage you in a fight, yelling or threats. They know how and when to push your buttons. Don't let her engage you in a back and forth argument about any issue you have made a final decision on. Walk away. It's okay to tell her "this is the end of the conversation" and step away. Keep your sanity.
Use of any electronics in her room require and OPEN DOOR. She is only 12. She should not be doing anything on the internet that requires "privacy".
Allow her to participate in setting limits & consequences and keep them simple, to the point and realistic. This gives her a sense of control and then later it's easier to enforce what she herself agreed to (this is a good life lesson in setting personal boundaries as well). Write it down, post it on her wall and leave it at that. Never threaten or remind her. Simply implement as soon as there is a violation. NO NEGOTISTIONS!!! The worst thing you can do is make her feel harassed or wear her down with empty threats and back and forth.
Reward her and complement her when she responds well and follows through with consequences. Tell her when she handles things well emotionally. Point out the good things.
One key thing I've learned is that it's all in the TIMING...if she violates an agreed upon rule don't throw it out there right away. Wait for a calm, private time and place to deal with it. Sometimes my daughter simply finds her phone missing and now knows exactly why. She doesn't even ask, because she knows what she's done. They know what they're doing when they push you.
Finally: BREATHE, BREATHE, BREATHE. This takes time. The biggest issue I see is when parents give up too soon. It took almost 2 months to see a true change in her but it was worth every minute. She turned back into that nice, lovable girl we love so much. There are still issues, but they're much more manageable and we are all happier. CHILDREN FIND SECURITY IN CONSISTENCY...we all do.
I hope this helps a bit...because this is a life time battle. It doesn't end at 18, it just changes.
Good LUCK!