Updated sidebar toggle logic