Temperature dependence of collective states in the random-phase approximation