So, I have read that change in Gibbs free energy is defined under constant pressure and temperature, i.e $$\Delta G= \Delta H -T \Delta S $$
but for an ideal gas change in entropy of system can be written as $$\Delta S= nC_pln(T_2/T_1) + nRln(p_1/p_2)$$ this formula implies that change in entropy at constant temperature and pressure is 0. Also for an ideal gas change in enthalpy is only a function of temperature so for an ideal gas at constant temperature and pressure change in enthalpy would be 0. But as I said above $\Delta G$ is defined at constant temperature and pressure, so wouldn't change in gibbs free enregy for an ideal gas always be 0?
PS I have read some related answers but they have not helped me solve this query. Some Read answers - https://physics.stackexchange.com/questions/716364/how-can-the-gibbs-free-energy-equation-be-at-constant-temperature-and-pressure
Why at constant pressure and temperature Gibbs energy change of a process can be negative?