This thread is for asking any questions that might seem obvious, tangential, silly or what-have-you. Don't be shy, everyone has holes in their knowledge, though the fewer and the smaller we can make them, the better.
Please be respectful of other people's admitting ignorance and don't mock them for it, as they're doing a noble thing.
To any future monthly posters of SQ threads, please remember to add the "stupid_questions" tag.
Not "when the sun becomes a red giant", because red giants are variable on a much too short time scale, but, as others mentioned, we can probably keep the earth in a habitable zone for another 5 billion years or so. We have more than enough hydrogen on earth to provide the necessary potential energy increase with fusion-based propulsion, though building something like a 100 petaWatt engine is problematic at this point, (for comparison, it is a significant fraction of the total solar radiation hitting the earth).
EDIT: I suspect that terraforming Mars (and/or cooling down the Earth more efficiently when the Sun gets brighter) would require less energy than moving the Earth to the Mars orbit. My calculations could be off, though, hopefully someone can do them independently.
Only major problem I know of with terraforming Mars is how to give it a magnetic field. We'd have to somehow re-melt the interior of the planet. Otherwise, we could just put up with constant intense solar radiation, and atmosphere off-gassing into space. Maybe if we built a big fusion reactor in the middle of the planet...?