Measurements of Higgs boson production and couplings in the four-lepton channel in $pp$ collisions at center-of-mass energies of 7 and 8 TeV with the ATLAS detector