Plus one for LupineChemist. I was going to suggest either San Sebastián or Barcelona. I'd also say maybe stay one extra day in Madrid for relax/sightseeing (Museums Prado and Reina Sofia, Parque del Retiro, great shopping in Salamanca-upscale and Chueca/Fuencarral-more alternative).
You mentioned eating well, which is 1 reason I thought of San Sebastián. It has highest per capita Michelin stars on restaurants in the world, but you can also eat extremely well in casual places. Gorgeous beaches. If you fly out of Bilbao (one hour away), you can see the Guggenheim Museum. Less shopping than Madrid/Barcelona.
Barcelona also has amazing places to eat, and there are several 3-star Michelin restaurants in surrounding area of Cataluña. Great shopping - upscale/Fifth Avenue-esque along Passeig de Gracia and more hip/small designers in boutiques in Born area. There are beaches in Barcelona, of course, but if you go outside the city a little bit, there are some really spectacular ones. Plenty of entertainment - music of all kinds, theater if you speak Spanish or Catalan, museums, nightclubs.
Enjoy wherever you go!