To my best knowledge, it takes 1000 hours of guided learning ('guided' means 'structured and controlled by a competent teacher') combined with at least 3000 hours of passive language exposure (reading/listening).
My first language is Russian. I had spent about that amount of time before I was able to pass a CEFR C1 level exam. With a bit of exaggeration, I can be considered 'fluent' (I actually write ‘fluent in English’ in my CV), because I can speak fast and freely on almost any topic. Nevertheless, I still have a very noticeable accent and I make accidental grammar errors.