Re: If Buddypress, then sidebar and css rules
Take a look at this page: https://codex.buddypress.org/developer-docs/conditional-template-tags/
Essentially, something like !bp_is_blog_page() will return TRUE when you are on any page that isn’t a WordPress blog page – i.e. when you are on any of the Social Network (BuddyPress) pages.
Alternatively, the default theme already embeds some class information in the body tag – although there is no single one for a BuddyPress page, so you’d have to catch all the different classes.