RICHMOND — As Virginia election returns rolled in Tuesday night, Republican campaign manager Daniella Propati quickly realized two things: Her candidate for the House of Delegates, GayDonna Vandergriff, would lose, and calling their opponent a “socialist” hadn’t worked.

North Richmond and the tony suburbs of Henrico County had once been a dependable backstop for the GOP, a place where statewide candidates found votes to offset Arlington and Alexandria. But the suburbs have undergone a metamorphosis in recent years — growing more socially liberal, more diverse, less interested in the red meat of the tea party and Donald Trump.

“Republicans — we’ve been running campaigns in Virginia the same way for 20 years,” Propati said. “We need to come together and say, ‘What do we need to do next time?’ ”

That’s a question Republicans around the country are wrestling with after Tuesday’s elections revealed new troubles in suburbs from Memphis to Philadelphia. Nowhere has the problem been more pronounced than in Virginia, where Republicans have been all but wiped from power in the past decade.

A GOP candidate hasn’t won statewide office in Virginia since 2009. On Tuesday, Democrats gained majorities in both houses of the General Assembly for the first time in a generation; the House of Delegates swung from a 66-34 Republican edge in 2017 to a 55-45 Democratic advantage for next year’s session.

In presidential elections, Virginia has moved so swiftly to the left in recent contests that it barely paused to be a swing state.

“This is the nightmare scenario for a lot of people in the Republican Party,” said Ruy Teixeira, a demographer at the liberal Center for American Progress. “Virginia is an example of a possible future for some of the states that are now part of the Republican coalition.”

Virginia now stands as a fearful avatar for Republicans of what the nation’s unrelenting demographic and cultural changes mean for the party, as the moderate-to-liberal urban and suburban areas grow and more conservative rural areas lose ground. Similar shifts are starting to hit such states as North Carolina, Arizona, Georgia and Texas, as minority populations increase and white college-educated voters continue to turn away from the Republican brand.

“It ought to be a concern everywhere,” said former congressman Tom Davis (R-Va.), whose Northern Virginia district has been swept of GOP power. “These demographic changes are happening everywhere. They are not unique to Virginia.”

The changes could play a pivotal role elsewhere in the 2020 presidential race, according to a recent analysis of changing demographics in key swing states by Teixeira and John Halpin. They found that if turnout and voter preferences by demographic group in 2020 remain the same as in 2016, the Democratic presidential candidate would win the electoral votes in Michigan, Pennsylvania and Wisconsin because of the growing share of nonwhite and college-educated white voters. Victories in those three states in 2016 gave Donald Trump the White House.

Such an outcome is by no means certain, given Republican inroads since 2016 among non-college white voters. But the shift against Trump in the suburbs has informed his campaign’s focus on increasing margins and voter turnout among non-college white and rural voters.

Former House majority leader Eric Cantor lost a Republican primary in the Richmond suburbs in 2014 to a tea party challenger, who went on to lose the seat to a Democrat after two terms. He now says Republicans have a window to retake the suburbs in 2020 given the leftward tilt of Democrats embracing ideas like a wealth tax.

“The commonwealth is a great microcosm for the rest of the country,” he said. “The answer for our party is to make sure we are offering the solution to the problems of these voters.”

Down ballot, the shifts in support carry implications far beyond the presidential contest. Tuesday’s results in Arizona were so jarring for Kelli Ward, the state Republican Party chair, that she took to Twitter to propose an electoral college “type system” on the state level to give rural areas disproportionate power.

“As a rural AZ resident, it is frustrating that the state’s population centers, Phoenix and Tucson, could control politics in this conservative state,” she tweeted, suggesting that the solution was finding a way around majority rule.

A spokesman for the state GOP, Zach Henry, said the state has different challenges than other states.

“Arizona is not Virginia,” he said. “Arizona is not Mississippi.”

Leaders in other states argue that it is not the rules that have to change but the party’s approach to elections and the candidates they choose.

“We need candidates who can run strong campaigns with a conservative agenda that actually people are attracted to and not repelled by,” said Dick Wadhams, the former state party chair in Colorado who has also worked in Virginia. “That may sound trite, but I’d swear sometimes people act like they have never heard such a thing.”

Thanks to an influx of new, younger voters to the Denver suburbs, only one Republican has won statewide in Colorado since 2002, Sen. Cory Gardner (R), who is expected to face one of the toughest battles for reelection in the country next year.

The problems have also filtered down to legislators at the state level, where the Republican advantage built up over the Obama presidency has been whittled away over the last three elections.

“No doubt about it, Republicans have a suburban problem. Anyone who looks at the data can see that,” said Austin Chambers, head of the Republican State Leadership Committee, which supports the party’s candidates around the country.

But Chambers doesn’t think the problem is a matter of substance for Republicans — it’s a matter of packaging. “I don’t think you have to moderate your politics and beliefs in politics to win in the suburbs, you just need to do a much better job communicating,” he said.

Republicans have come back before, under different circumstances. In the early 1990s they ended a century of Democratic dominance in Virginia by offering conservative politicians who led with promises of smaller government, economic expansion and lower taxes, not the social issues that are standard in their appeals now. In his successful 1993 gubernatorial run, Republican George Allen was described by his campaign manager as “not pro-life or pro-choice” on abortion.

Demographic changes were already roiling Virginia at the time, bringing a more ethnically diverse and well-educated population into the Washington suburbs. For a while, GOP campaign strategists could use the more stable Richmond suburbs to offset losses in the north.

But that formula became harder to maintain. The population jumped in Loudoun, Fairfax and Prince William counties by 152 percent from 1990 to 2018, compared with 59 percent statewide, according to the Weldon Cooper Center for Public Service at the University of Virginia.

As the numbers became more challenging for Republicans, the party became more reactive in its approach, alienating many of the newest residents. By 2012 the party was known nationally for opposition to abortion and other conservative social positions that ran counter to the views of its expanding suburbs. Trump pulled the party further to the right on immigration and other matters.

Instead of keeping pace with change, the GOP has “moved farther and farther to the right, and become more rigid and vitriolic in its ideology and rhetoric,” former Republican lieutenant governor Bill Bolling lamented last week on Facebook. Bolling was edged out for his party’s gubernatorial nomination in 2012 by the hard-right Ken Cuccinelli, who went on to lose the election to Democrat Terry McAuliffe.

“The GOP is simply out of touch with suburban voters who now control the outcome of critical elections,” Bolling wrote.

Virginia Republicans need to focus “on what works here and stop thinking what they see on Fox News is going to be successful here, because it clearly isn’t,” said former longtime GOP strategist and adviser Tucker Martin. “We’ve got to get back to that big-tent effort.”

Democrats like McAuliffe and Gov. Ralph Northam, meanwhile, were able to reclaim the mantle of jobs and economic development. It’s a message that McAuliffe, who has not ruled out another run for governor in 2021, plans to preach this week when he attends a policy retreat hosted by North Carolina Gov. Roy Cooper (D).

“You can’t just want to fight on the social issues, you have to have an economic message,” McAuliffe said. “We became the party of jobs and economic development, and they became the party of divisive social legislation.”

This year Virginia Republicans may have severely miscalculated on the issue of gun control. After a May 31 mass shooting in Virginia Beach in which a gunman killed 12 people, Northam called a special legislative session to consider gun restrictions. The Republicans in charge of the General Assembly adjourned after 90 minutes without debating a single bill.

That, said Republican strategist Chris Jankowski, was not a way to win in the suburbs.

“You cannot look at a mom who just bought her daughter a Kevlar backpack and say, ‘I’m sorry, but because we don’t think anything can be done about it we’re not going to try.’ That is a losing message,” he said.

For House of Delegates candidate Vandergriff, it was a struggle to find a winning message this cycle. The horseshoe-shaped 72nd House District she tried to win touches working-class neighborhoods in Richmond’s North Side and then arcs out through the affluent western part of Henrico County.

At the start of the race, her campaign looked like a Democratic bid, with light blue signs and a website that did not mention her party affiliation. She posted a series of videos online about “what matters,” from schools to health care to local neighborhoods.

But late in the race, she shifted to the right in an attempt to energize the Republican base, calling her opponent — a high school civics teacher elected as a delegate in 2017 — a socialist and abortion enthusiast who favored illegal immigrants.

It wasn’t a winning formula. “We need to find a way to rebrand that socialist message,” her campaign manager Propati said. “Calling someone a socialist isn’t enough anymore.”