Confidence is not something anyone gets magically. This is not a some people have it and some don’t sort of skill. You just have to practice it. And you do that by liking yourself enough that other people’s negativity just doesn’t bother you. And they way you get to the point you like yourself enough to not be bothered by negative people, is by doing the things that bring you joy.
If you found yourself tongue tied and afterwards, thought of all the cool “comebacks” you could have and should have said later, great. Make note of them. Choose the one that is the nicest and a compliment, and practice it. Say it out loud.