in 1985 it was the 2nd largest economy but after 1991 it wasn't even in top 10
First, you are probably looking at GDP of the entire USSR, whereas the decline between the RSFR to the Russian federation was precipitous, but not as large as that slightly misleading comparison. The GDP of the RSFR was nowhere near 2nd place in 1985.
There are a lot of reasons though as to why the economy was hit so hard however, if we just look at the former RSFR. First, as most people already are aware the economy had a lot of cracks beneath surface to begin with, which a crisis suddenly brought to the forefront, but which had been recognized long beforehand.
Since its birth the Soviet Union had focused on centralization and heavy industry, at the expense of developing lighter industries, and especially consumer goods. The theory was that heavy industry was industry that made industry, so it was the fastest way to grow an economy. With more steel factories you could make more factories, and that logic held true fairly well throughout the first half of the 20th century, especially for countries that lacked a lot of heavy industry like post-tsarist Russia to begin with. In an astonishingly short period of time from the end of the civil war an agricultural nation of peasants began to have tractors, trucks, and modern concrete buildings, greatly contributing to Soviet economic prestige.
The trouble, however, that most of the world began to grapple with as early as the 1960s was that beyond a certain point this type of heavy industrial production was actually not particularly helpful economically. There are only so many trucks, steamshovels, and steel factories you can build before there is no longer any practical need for these sorts of things. In the west, especially in GB and USA during the 60's 70's and 80's steel factories, car companies, and many other types of heavy industrial organizations began to scale back significantly. Partly this was due to global production beginning to finally compete and increased efficiency requiring less workers, but the other side of this was that demand for these goods was plateauing compared to the growth of the rest of their economies. In the west, lighter industries requiring greater technological finesse such as electronics or even just more consumer oriented things like refrigerators, t-shirts, and beer took on a larger share than they had before. In the Soviet Union, efforts were made to combat the economic stagnation starting around the 70's by attempting to pivot in the same way, but the rigidness of the command economy, corruption, and innefficient use of labor prevented the success of these attempts. Since the economy was less structured around consumer feedback, a lot of the innefficiencies and outdated production practices never really failed however, as they were still subsidized by state planning structures, becoming ossified in. The result was that the Soviet economy by the 1980's carried a lot of economic deadweight.
The Soviets were not alone in this predicament, though, Japanese economic bubble of the 1990's was in many ways similar. A bunch of "zombie banks" invested in incredibly overvalued industries, which were suddenly revealed to be obsolete. Japan was and is a market economy, but in some ways this situation was comparable in that the Japanese economy is dominated by several key industrial giants. These massive monopolies had perhaps become too rigid in their economic outlooks after the roaring successes of the Japanese post-war boom.
When the Soviet Union collapsed however, on top of the now obvious economic flaws building up over the last century, the highly decentralized Soviet internal economic trade system broke down very fast. Parts made in the Ukraine might rely on suppliers and Siberia, but now there were suddenly border customs these parts had to move through, and the suppliers might no longer be artificially subsidized. In this way even theoretically profitable industries became paralyzed by the sudden inability to source and distribute goods through the old avenues. At the same time, the political currents of the time called for rapid, perhaps too rapid, liberalization of the national economies, the so called economic "shock therapy." State industries quickly were auctioned off, and in the absence of any significant capital held by the civilian population, they were largely given away through corruption and nepotism. This largely led to the oligarchy of today, though some would likely say that is also due to the very resource-extractive nature of the Russian economy. Depending on who you ask, much of the economic turmoil during this period of liberalization was either a necessary removal of inefficient economic slack, or just simply too jarring a transition beneficent of nothing. But even beyond this, there was also a great amount of military and political turmoil during the 90's for the Russian populace, the sort that makes economic decisions based on long term stability difficult. Russia was involved in several wars, demobilization of its military, ethnic and civil unrest. The rigidness of the system falling apart greatly exacerbated all of these issues.
So really, there are many reasons for the depth of the economic collapse, hopefully I was at least able to provide some background that might offer a decent picture.