Solar Energy in Buildings: Thermal Balance for Efficient Heating and Cooling