Were you idle for a long period of time? The site logs you off the live panel if you're not active. At times you may be logged off the entire site as well. I'm not sure if the latter is intentional, but it used to happen.
Detected as offline

No, I was online each time. The second time I was intentionally clicking buttons and being active but still the same result.

Well, I'm not certain if anybody actually visits this side of the forums, so you should probably lodge it officially as a bug.

Just happened to me as well, not sure whats going on
Try some if the steps in the following.
https://support.chess.com/article/213-how-do-i-fix-my-disconnect-lag-issues

I lost four match because its show offilne during match. How i can fix this issue.? Although my net is connected.

I'm so effing pissed whenver this happens. I literally stepped away for 10 seconds and it marked me as offline. Chess.com, you need to effing fix this bs.

It is very frustrating suddenly they make you offline and they make you lose points for no reason and sometime it is even funny they make you start and play some moves then suddenly they put you offline and I think they do it intentionally to make you upgrade to premium membership

It is very frustrating suddenly they make you offline and they make you lose points for no reason and sometime it is even funny they make you start and play some moves then suddenly they put you offline and I think they do it intentionally to make you upgrade to premium membership
The site doesn't do that. However, there are a lot of different things that can cause connection issues.
For things under your control check out the following.
https://support.chess.com/en/articles/8652402-how-can-i-optimize-my-online-chess-performance
https://support.chess.com/en/articles/8584209-how-do-i-fix-my-disconnect-lag-issues
Tried to enter two tournaments today, both times 'detected as offline' despite being online and given 0 point byes. Please fix server issues.