I used to live in Barcelona, there are several neighborhoods with lots of cool bars and small restaurants
El Born is hipster, organic tapas, fancy wine bars, in a medieval part of town
Barceloneta is next to the beach, for seafood and cocktails
Old town around Las Ramblas to mix with the crowds, although most places are a rip off.
Gracia, more authentital with narrow streets and little squares with trees and shade where you can have a drink while people watching
and Tibidabo, overlooking the city, ideal at night or on a clear day.
A few hotels have pools on the top with bars that you can access as well.
July is pretty hot, especially in Madrid.