Honda Civic Coupe 2003 Overheats on idle. What would be the cause?

I just bought a Honda Civic Coupe 2003 on Monday and been driving it to make sure its good (used car, dealer) It was going a bit passed half way which is normal but I drove it yesterday and was stopped on a red light a while and it went all the way up to the red line.
After that I U-turned back to my parking lot structure at my office and drove in and out to get flow going. It then went back down half way then 1 line less than half way. I kept driving down the street and would not heat back up unless I idled too long.
I stopped ate at an In N Out and drove home and didn't heat back up again since it cooled down.
I'm took a picture and will take it to dealer today but want to see if anyone has an answer to what it could be so when I show him the pic I can let him know what he might want to check so they can fix it. I have 30 day warranty or 1000 miles.

Please help will be going in about 4 hours. Thanks everyone!

Added (1). More info on car:
81,000 Miles (zeros are some numbers)
Tried with AC on and off both went little over half way.

Added (2). I will be closing this issue in 4 hours. Any more answer with more info or advices is much appreciated.
Thanks everyone!

Added (3). Thank you for all the advice on my question, Heading to dealer now and have this fixed.

Could be the thermostat, or the fans, it could be the head gasket. If the engine has a lot of miles then the HG is suspect, check the coolant, then check the compression.

Lots of reasons it might be - let the shop sort it

Check the coolant level, change the thermostat, flush the radiator.

Assuming that coolant level is not low, it could be an intermittent sticky thermostat on the coolant line that sometimes lags before popping open. Or it could be a problem with electric fan thermostat or corroded wiring if the radiator fan does not turn on when warm.

Once after I had a car repaired from an accident, my car worked fine until I got stuck in rush hour traffic and my engine temperature went way up even though it was near freezing. Opening the windows and running the heater on high cooled down its small engine. It turns out that they forgot to reconnect something for the electric radiator fan.

Big step… OPEN HOOD check coolant, YOGI sez " you can see a lot by looking "

The fan isn't coming on. Next time when your temp gauge is high check to see if the fan is running. DON't check if there's any antifreeze in the radiator when its hot!

If it is only overheating at idle, but is fine when you are driving then the cooling fan(s) are probably not working and need to be replaced.

A cat stuck in the radiator fan.