How can I avoid conflicts between plugin and theme?

You can/should prefix all your classes. That way you have very limited chance to have conflicting classes, which can cause unexpected behaviour on the front-end. So, instead of .container, you can use .mypluginprefix_container.