It may be as a result of your phone performance, If the app has not been launched for a long time, it needs to connect with the cloud when you log in again, so the device is displayed as offline. As the app is temporarily not connected with the device, it is not actually offline. It is a normal phenomenon, and you don't have to worry about it. Just like many apps require to buffer for a few seconds before displaying content, which is actually a process of connecting to the cloud. If this is not the case for you please read on.
This may also be as a result of your Internet connection. Please keep the bulb near by WiFi router and powered on. It will be back online automatically. If you have changed the WiFi SSID(WiFi name) or password, the device will not go online automatically, you need to reset the device and connect to the App by clicking "Add Device" and selecting your device then follow the steps to put the device in set up mode and reconnect it to the app.