If there was ever a chance for a total Soviet victory in Afghanistan, that chance went away with the invasion of Iran. Now with a hostile Shia population and aid to Afghan insurgents by the west increasing, saying that Afghanistan was a lost cause would not be an odd opinion, rather that opinion was becoming more and more common among observers in the West. The best the Soviet Union could have done was delay the inevitable. The plan to have troops stationed in Iran go to Afghanistan was probably the best decision yet in order to accomplish this, as Bamyan was captured and enemy lines collapsed at Farah. Despite this, the Afghan insurgents regrouped some months after and the situation went back to normal. As Shia militants were growing in size in Afghanistan, the formerly peaceful region of Hazarajat became a part of the fighting. Because of this, the Soviet Union sent thousands of more troops to Afghanistan, which in turn led to the growing popularity of the insurgents. When the war in Afghanistan began on December of 1979, there were still parts of Afghanistan that were peaceful. Now, all of Afghanistan was in a state of total anarchy. The Afghan communist government controlled only 10% of Afghanistan, and that control was lessening at a moderate pace. Still, the USSR was determined to remain in Afghanistan, lest a pro-US government takes controls which it will if the Soviets withdraw.
The situation in Afghanistan was made worse with the assassination of Babrak Karmal on June 28th, 1981 by an insurgent, which led to a military coup and the installation of Shahnawaz Tanai as President of Afghanistan. Tanai was quick to suck up to the Soviet Union lest there be another attempt by the USSR to overthrow the hardline Khalq faction, of which he was a part of, and re-install the moderate Parcham one. Tanai's support of the USSR and the Soviets believing that another assassination could lead to even more violence had no such coup be carried out, and Tanai would remain in control until the end of communist rule in Afghanistan. Tanai's accession into power had made many Parchamis believe that Karmal's assassination was ordered by the Khalq faction. This exacerbated intra-party strife, and some Parchamis in the army began to believe that maybe an Islamist Afghanistan might be a lesser evil than a Stalinist Afghanistan, and defections began to occur. Pakistan intelligence tried to increase intra-party tensions, maybe even getting a top Parcham leader to defect to the Islamists or just create there own army, but their attempts were sloppy and failed in the end.
The assassination of Karmal also led to 5,000 more Soviet troops being sent to Afghanistan. In return, more and more Afghans joined the Mujahideen and there were more foreigners going to Afghanistan to fight the Soviet Union and the communist Afghans. The swelling of both sides led to the fighting become even more intense. The use of suicide attacks and child soldiers by the insurgents against the Soviets did not help matters either. The place in Afghanistan that went through the most fighting was the Panjshir Valley in north-central Afghanistan. Panjshir was strategically important as it connected Kabul to the rest of Afghanistan. Currently, the valley was controlled by Mujahideen groups led by the Tajik Ahmad Shah Massoud. As Massoud was from Panjshir, he knew how fighting worked there and was keen on making sure that the Soviet Union would not even get an inch of land in Panjshir. However, Massoud was not an idiot - when Soviet troops entered Panjshir on April of 1981 they were stronger and better equipped than his men, and as such Massoud ordered his men to blend in with the local population until they could muster enough strength to fight back. On August 7th, they launched an attack against Soviet positions in Panjshir. Soviet vehicles trying to transport Soviet troops were blown up by the same mines they set, which made the capture of Panjshir even easier. Massoud managed to penetrate a third of the Panjshir Valley before retiring. It would be until the summer of 1982 that the USSR decided to embark on a counter-attack against Massoud, but for now he had accomplished a victory in his place of origin.
Much as how in Iran there was a Maoist movement, so there was in Afghanistan. However, Afghanistan's Maoists were better organized, had better success in getting people to defect and their Chinese allies were closer. Alongside that, they were allied with Islamists and wanted to be a part of a new government in Afghanistan. The largest Maoist organization was called the Afghanistan Liberation Organization led by Faiz Ahmad. The ALO managed to get a lot of Afghan communist soldiers to defect to the Maoist cause in 1981, but their alliance with the Mujahideen led to defections to them becoming smaller as time went on. There were Maoist groups opposed to Islamists, the largest of them being the Liberation Organization of the People of Afghanistan, or LOPA. LOPA managed to get the communists who would defect to the ALO to defect to them, and ended up fighting as a third front against the USSR and the Islamists. There was an agreement, though, with the ALO to not engage in any sort of combat against each other, but LOPA leaders loathed the ALO, believing them to be traitors to the cause for their alliance with the Islamists. If the LOPA managed to get their way, ALO leaders along with Islamists and Afghan Marxist-Leninists would be purged. LOPA initially made ties with Ashraf Dehghani's Fedai Guerillas in Iran, but their unwillingness to share Chinese weaponry (their rationale being "we need every bullet we can get") led to an estrangement between the two.
1981 started and ended on a low note for Afghanistan. Thousands being killed, the Afghan government being run by Stalinists and a growing Maoist movement did not help matters. Soviet leadership had hoped that when the situation is at rock bottom there was no where to go but up, but every year would turn out to be bloodier than the last. Thankfully for Afghanistan, the carnage would not last to 1990.