I have studied nail disorders to an extent, but I am not really an expert in this area. However, I can give you my opinion based on what you have told me.
The first thing you should question is whether or not the black lines are benign melanomas, which would need to be removed surgically. Please ask your doctor about this.
Nail infections are not always fungal. If anti-fungal treatments have not worked even after you have completed the full length of the treatment specified by the products you were using, then perhaps it is viral, for e.g. Herpes can develop beneath the nail in a similar way to a fungal infection, along with a number of other viral conditions. If you have ever contracted Herpes, your nail problem could just be another symptom.
Could it be something else like broken capillaries or broken veins beneath the nail? I am going on the idea of root-looking lines, without seeing them it's difficult to make a suggestion.
One thing that tends to change nails more than anything is stress and diet. If you have been under long term stress coupled with an unhealthy diet and a lack of sleep, then that can cause all sorts of problems to occur in the body. Also, nails often display signs that indicate ill health elsewhere in the body.
Please ask your doctor if you suspect it to be any of these, but particularly ask if it could be a melanoma. It might be worth you visiting a doctor specializing in skin cancer just to be sure.
I hope this helps.