The party has flipped key seats in Republican strongholds, as voters rebuked Trump.