Perfume can definitely go bad, and you're not imagining the changes you're noticing. The main culprits are light, heat, and air exposure - all three break down the fragrance compounds over time. Three years in a bathroom is actually pretty rough for a bottle since bathrooms get humid and experience temperature swings every time you shower. That darker color you're seeing is a real sign of oxidation, and if the smell is noticeably different (weaker, off, or just wrong), that's your cue that it's degraded.
The best way to tell is to compare it side-by-side with a fresh bottle if you can, but since that's not always practical, trust your nose. If it smells flat, has a vinegary or metallic undertone, or just doesn't have that punch it used to, it's gone. You can also check if it still performs the same - does it last on your skin like it used to, or does it fade super fast? If the performance tanked along with the smell, that's your answer.
To keep perfume longer, store it in a cool, dark place away from direct sunlight and humidity. A bedroom closet beats a bathroom shelf every time. If you want to salvage what you have, you could try moving it to better storage conditions, but honestly if it's already changed that much, it's probably not worth saving. You'd get better results just replacing it.