Iran undoubtedly has the capability to produce nuclear weapons today. Period. They have the centrifuge capability and capacity and they even have enough on hand enriched Uranium to make the process much faster, if and when they do decide to make a nuclear weapon.

As for why it has taken them so long, there are many reasons. One is that development of nuclear weapons was not a priority for them for a long time. The other is that centrifuge technology is actually very, very difficult. It took until that technology was disseminated (by way of the AQ Khan network in the '90s) for Iran to have a reasonable shot at producing nuclear weapons. And it took longer for them to perfect the technology and then begin increasing the capacity.

More so, Iran has been tiptoeing through the geopolitical minefield of acquiring nuclear weapons very, very carefully. If they had wanted they could have tested a nuclear weapon perhaps years ago, but there would be so many negative consequences of that it would be questionably worth it. Instead they've deftly manipulated public perception and international politics to their favor. Today they have a greater capacity to produce nuclear weapons than the US did in 1945, and yet they are not considered a nuclear power, and they do not face the serious repercussions that, say, North Korea or even Libya have faced from their nuclear program. Part of this comes down to the fact that the public at large and high level politicians are rather ignorant of scientific and technological issues, let alone advanced topics like nuclear weapons manufacture, so it is far easier for them to believe the lie that Iran is nowhere near producing nuclear weapons.

But make no mistake, as I mentioned, Iran is a nuclear capable state. They could field a weapon in a matter of at most months, perhaps as little as days. They've been allowed to stockpile 5% and 20% enriched Uranium and to maintain a vast infrastructure of Uranium enrichment centrifuge cascades. 5% and 20% may seem like a very, very far distance from the 80-95% enrichment needed for making bombs, but that is due to ignorance of the process. It takes 75% of the isotopic separative work to enrich natural Uranium to 5% as it does to reach weapon's grade HEU, and 95% of the work to get to 20% enrichment. Which means that starting with a stockpile of 20% enriched Uranium one can produce HEU with only 1/20th the amount of work as it would take using natural Uranium, and from 5% only 1/4 of the work.

Given Iran's known enrichment facilities they could send their known stockpiles through them and have bomb grade material in a very short amount of time. Moreover, there is no guarantee that they do not have secret facilities as well. Such facilities are shockingly easy to hide, the world discovered North Korea's facilities only when the state itself revealed them.

Every other component for making a nuclear bomb is comparatively trivial to engineer. Iran could quite easily be testing such components without any outside knowledge they are doing so, such activities are enormously easy to hide because at most they amount to the explosion of a small amount of high explosives, which can be done underground, for example. It would be easy for them to have already practiced making the fissile cores of bomb designs using natural Uranium metal. All it would take is Iran's leaders to say "go for it" and then not long after they would have run their Uranium stockpiles through their enrichment facilities, then formed and installed their cores and have their weapons waiting for use.

Iran has been very sophisticated in their pursuit of nuclear weapons, since they now have the ability to field them should the situation arise and yet are facing almost none of the consequences of having a weapons program.