Let's see. Let's break it down. You have essentially 12 days and you'd like to see the following in those 12 days:
Madrid, Segovia, Toledo, Córdoba, Granada/Alhambra, Barcelona.
That's 6 cities in 12 days. Of course it's very possible but....... Sheesh! I HOPE it's not like you'll ever be returning to Spain again and so you're trying to "do it all" this time around. WOW!
MANY people try to do what you're planning above but I can't recommend it. You have LESS than two weeks. My recommendation is to spend SIX DAYS in Central Spain and SIX DAYS in Southern Spain and skip Barcelona alltogether. Barcelona requires a MINIMUM of three days just as Madrid requires a MINIMUM of three days as you've already planned.
You could always SKIP southern Spain and spend 6 days in/around Barcelona but... wow.. there's SO MUCH to see in Andalucía and, in my controversial opinion,
less to see in Barcelona and Cataluña. (uh-oh... I can see people's faces turning red now..
) Andalucía is PACKED with historical, OLD SPAIN sights to see what with Granada, Córdoba, Sevilla. Even if you only visited these three in Andalucía it would be tough as Sevilla probably requires
almost 3 days to do it justice but Córdoba and Granada
could be forced into single-day visits.
As for central Spain, accounting for 3-days in Madrid itself....or 2.5 if your plane is late and you don't get to your hotel until after noon.... you can do justice to Madrid with 3-days. Daytrips to Segovia and Toledo are well planned. So there's 5 days so far. You have one more day where you could visit rural Castilla or visit some of he smaller villages or even Avila or El Escorial or La Granja or places like this.
Admittedly, I don't know Cataluña very well at all - I liked Barcelona, of course. You could also do well.. maybe even better.. to spend half the time in/around Madrid and the other half in the Basque Country (it's SO beautiful) on the north coast, cross over into France for a daytrip to Saint-Jean-de-la-Luz or Biarritz, and visit Bilbao's Guggenheim Museum on the way up/back.
It's going to be tough no matter how you cut it up but I can't recommend trying to "throw in" Barcelona just to say you were there. Save Barcelona for the next trip and do all of northern Spain on that trip, visiting Cataluña, Basque Country, and Galicia (NW Spain).. Mmmm... Galicia... I loved it.
Anyone else? Saludos, MadridMan