The dance of heating and cooling in galaxy clusters: three-dimensional simulations of self-regulated active galactic nuclei outflows