Barcelona is fabulous for an architecture-lover, as is Andalucia. There are three fabulous side-trips from Madrid that you'd probably enjoy: Toledo, Segovia and Cuenca. The first two can be arranged late in the game at not too high a cost. Cuenca requires use of the AVE (fast train), which will probably be very expensive if not booked far ahead of time. Toledo is even better if you can spend a night or two there.
If Andalucia makes the final cut, remember that it will probably be the warmest place you visit, so I'd schedule it late in your trip.
The Sicily beginning is, frankly, kind of a shame. Wonderful, wonderful destination, but 4 days there is grossly inadequate. If you're not committed to Sicily, I'd do something else. With so little time available, if forced to choose, I'd go with the Palermo end of the island. There are nearly uncountable interesting religious buildings in Palermo proper, plus the basilica at Monreale (perhaps the best sight on the island). Time permitting, you could visit Cefalu (former fishing village, now a beach town), Trapani/Erice (the latter a medieval hill town), and/or Segesta (Greek ruins). Other than Monreale and Cefalu, I'm not sure any of those suggestions is viable as a day-trip from Palermo via public transportation.
Check train times to your potential Italian destinations. In some cases rail will be much faster than using a car. The Deutsche Bahn website is easiest to use for checking schedules. You can go to Trenitalia to look up fares when you progress to that stage of your planning.
I think Ventimiglia, much less Nice, is too far to go for a weekend. Other Italian destinations you might consider are Torino, Padua/Vicenza (located on the rail line between Verona and Venice), Ferrara, Ravenna (stunning town, stunning mosaics), Bologna, Orvieto, and any number of Tuscan and Umbrian hilltowns within an easy drive of Florence. I'd definitely devote at least one weekend to seeing some of those nearby hill towns by car. But do read up on driving in Italy. Don't be one of those travelers who just hops in the car and spends the next year dealing with late-arriving notices of fraffic violations.