Cosmic inflation and dark energy from the electroweak phase transition