I there a way to set a separate password for a file (other than root)?
What you wish to achieve sounds like a duplicate of this question. There are complications such as SIP to consider these days. More trouble than it's worth.

It would be more effective to 'firewall' those sites in some way that does not rely on a password that you may forget, or be tempted to revert when you should be concentrating your attentions elsewhere. Fortunately, as the other question stated, there's an app (or many) to do that.

I personally used Self Control some years ago when trying to get coursework done. It's free. There are other similar apps out there, some paid-for for the sake of extra features, though I feel those extra features are just another avenue of procrastination.