I just did a quick google search and the most likely cause of foamy urine in your case (keeping in mind I’m not a doctor) would have been dehydration, especially considering your other symptoms of muscle cramps and kidney pain (also symptoms of dehydration).
Were you drinking water whenever you felt thirsty? Because honestly, after that short a fast I’m not sure what else it would be.
My son has kidney issues and I can tell you that bubbly urine is a sign of your kidneys not filtering out the waste/ protein from your body. You should see a nephrologist or visit and urgent care to get lab tests done. Obviously this isn’t medical advise as I’m not a Dr. But you want to be certain before anything serious happens.
Go to r/intermittent fasting no greater benefit to doing a 72hr vs a 23hr/OMD. There’s great benefit to doing 16:8 -you don’t need to do huge water fasts, but when you do you NEED the water and the electrolytes.