I was in the bath and basically felt an urge without wanting it. I resisted the urge but it was playing on my mind, I was ignoring it but it was still in my mind, I resisted it completely in the end but since it was in my mind, even though I was trying to get it out, is it a sin?
Temptation does not equal sin. Thoughts often enter our minds unexpectedly and unintentionally. That is not sinful. The key is our response.
That you successfully resisted the temptation is a good thing.
Worrying too much about things like this will just make you tense, and waste time you could be thinking happier things. You’re handling it properly, so relax - God loves you!
You fought temptation and thus grew in virtue.
Really, you were *exposed *to sin–but since you are part of a fallen Humanity, you are almost always exposed to sin in some way or another. So:
As long as you live on Earth, your battle with sin will be relentless. We call ourselves the Church Militant for a reason. Thankfully, our Redeemer is infinitely powerful, while the devil most certainly is not. In this case, it sounds like you emerged, by the grace of God, triumphant–so you have nothing to worry about, but plenty to be grateful for.