Sorry, but this is not a new problem. We call it learned behaviour. She was not born that way. It has likely been going on for years and you put up with it. Now she is big and her desire for idependence is stronger than ever. Basically, she is unhappy and really wants you to help her regain control of her life. But this problem did not start yesterday, and it will not be solved tomorrow.
First off, do not let her grandstand in front of her friends. This is a power struggle and you are losing. Take her aside when things are calm and ask her what the issues are. She will have some things to tell you that you do not want to hear so let her talk. From here on down, you must maintain control of the situation. You are the parent and you are in charge, but that does not mean that you are always right. IF you show some respect to her, you will hpefully get the same back. If you cannot come to terms with her on your own, get family counselling soon. It is your job as a parent to get her on a positive track for the rest of her life. CLearly right now, she is headed in the wrong direction.
Good luck.