What factors contributed to the decline of the Spanish Empire in the Americas?