Chipotle Mexican Grill (NYSE:CMG) has had a rough six months as multiple foodborne illness outbreaks have cast doubt on the company's food safety. While Chipotle has completely overhauled its food handling protocols in the past few months, sales levels have remained depressed.

Nevertheless, I think the company will recover from this setback and earnings will rise to new record levels within a couple of years. Chipotle can still be a winner for long-term investors -- and that's why I bought the stock for my retirement portfolio last week.

First-quarter results will be ugly
In the past few weeks, analysts have been debating about just how bad Chipotle's performance was last quarter. Some think that comp sales dropped 28% year over year -- others argue that comp sales may have plunged a full 30%.

Consumer Goods Restaurants Chipotle Restaurant Cmg

Comparable-restaurant sales plunged at Chipotle last quarter.

Chipotle already filled in most of the blanks through an investor update issued in mid-March. The company stated that comparable-restaurant sales fell 36.4% in January and 26.1% in February, with February getting a 2.6 percentage point lift from the leap day. Comp sales then fell 21.5% and 27.3% in the first and second weeks of March, respectively.

Due to these sales declines, higher costs related to Chipotle's new food safety protocols, legal costs, and an increase in promotional expenses, the company expects to incur a loss of at least $1.00 per share for the first quarter.

What about the sales trend?
Investors shouldn't worry too much about exactly how much Chipotle's comp sales declined last quarter. The trend in its sales performance is a far more important metric for understanding how the company is doing.

For example, in January, Chipotle's sales plummeted because the original E. coli and norovirus outbreaks were still fresh in customers' minds and the CDC investigation was ongoing. It wasn't until the beginning of February that the CDC declared the E. coli outbreak to be over.

Shortly thereafter, Chipotle began an aggressive marketing campaign to get customers back in the habit of visiting its restaurants. These efforts worked -- by the first week of March, the comp sales trend had improved by 15 percentage points relative to January. Obviously, a 21.5% comp sales decline is still a big drop, but it's a whole lot better than the 30%-plus declines Chipotle faced in December and January.

The sales trend worsened in the second week of March, following an incident on March 8 where Chipotle closed a Boston-area restaurant after employees reported norovirus-like symptoms. This news clearly made some customers nervous. Yet Chipotle's food safety procedures worked -- the restaurant was fully sanitized as a precaution and no customers became ill.

Looking ahead to the future
There haven't been any health scares at Chipotle since the March 8 incident. As a result, I expect Chipotle to report next week that the sales trend has been steadily improving since mid-March.

Consumer Goods Restaurants Chipotle Line Cmg

Customers are starting to return to Chipotle.

As long as Chipotle can keep itself out of the news, sales trends should continue to improve (and comp sales declines will moderate) as the year progresses. By Q4, when Chipotle will face much easier year-over-year sales comparisons, comp sales should return to strong growth.

It may take two or three years for Chipotle's sales per restaurant to return to last year's peak level of $2.5 million. But in the meantime, Chipotle will be steadily adding new locations -- in recent years it has grown its restaurant count 10%-13% annually. The company also expects profit margins to gradually return to historical levels, except that food costs will be slightly higher than before.

As a result, Chipotle should be back to earning record profits relatively soon, most likely by 2018. It has plenty of upside beyond that, too. Chipotle has ample room to expand in the U.S., new growth opportunities in international markets, and promising growth seeds in the form of its small ShopHouse Southeast Asian Kitchen and Pizzeria Locale chains. It is even looking at a move into the burger business.

The near-term picture at Chipotle may be gloomy, but the company still has huge potential. With the stock marked down nearly 40% from the all-time high reached last summer, this could be a great buying opportunity for long-term investors.

Adam Levine-Weinberg owns shares of Chipotle Mexican Grill. The Motley Fool owns shares of and recommends Chipotle Mexican Grill. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.