Nonlinear coupled-mode theory for periodic plasmonic waveguides and metamaterials with loss and gain.