As Mike M. mentioned, there was a bug during activity recreation and his suggested workaround is the solution. So, for those who also faced this issue, you should do:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Add these 3 lines to your code
if (savedInstanceState != null && Build.VERSION.SDK_INT >= 35) {
WindowCompat.setDecorFitsSystemWindows(window, false)
}
enableEdgeToEdge()
}