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.


yeah i included manufacturing because i was like “most big factories are in or close to big cities, because that’s where the workforce lives, so it makes sense to build factories there. and factories need energy.”
ofc small variations in power are a given, because you have things like electricity being more efficient than oil, so you need fewer kWh, and such.