Yes, i did think about this in the shower.

Just to put things into proportion:

This is vienna. Vienna has an area of around 400 km².

And the blue area is the area that would have to be covered by solar panels to produce enough energy for the whole city:

Source: I did the maths myself. I assumed that per person around 30 MWh of energy/year are needed. Data for this: our world in data, energy usage per person. It’s well known that 1 m² of solar panel produces around 200 Wp and that’s 200 kWh/year. So you need about 150 m² of solar cells per person. Vienna has about a million inhabitants, so that makes 150 km² of solar panels approximately.