The Afghans have never been beaten at home - period. If NATO could fight them in Northern Europe, or the Canadian Bush or the US mid-west (for example) it might be different. At home - they're unbeatable.
I saw an interview with a Russian General who was there in the 80s. When asked if he had any advice for NATO he simply said "go home - now".