It's okay to be "the bad guy". They're your kids, not your friends. Too many parents want to be buddies with their kids these days. That's just setting everyone up for failure.
My wife and I have a loving relationship with our kids but they are quite clear on the fact that we are not equals. The distinction will lessen as they reach adulthood and prove their responsibility.
I know that I have a great friendship as an adult with my parents, in part because they were parents while I was growing up. I had a friend ask what I would do in a situation and I wanted to yell be a parent! Said something nicer, but basically gently pointed out that sometimes that means giving up things you may want to do to show a good example. For instance, if you are always on social media then of course they will want to be too. Right now, you are the biggest influence on your children's life, even when they do not like something now that does not mean they will not thank you later. Anyway, I was debating building a house that wouldn't allow radio waves in so that everything has to be approved. One of the quotes I like is, "It is not the things that I had as a child that makes me the man I am today, but the things I did not." Went on a bit of a tangent, but I just wanted to encourage that for most of history it was considered good for children to learn to interact well not with their peers but with their elders. This helps firm realistic expectations of what the majority of life will be like, the opposite of social media and much of the internet. Also, remember that if you address a topic with your child first you are the trusted expert, rather than someone else, in their minds.
Pretty much this. My farther was strict on on the kind of behavior he did not tolerate (and made them explicit early). No compromises. We were aware of the lines and the closer we tread to them, the more he took on the role of authority. But after we became adult and there was no need for that authority role, we became quite good friends with each other. My mother rarely had to take up on that role, but there was still clear separation between children and parents.