You may not be getting enough electrolytes, especially salt. Try drinking broth, taking a salt tablet, or adding some salt to your water. For me, the brain fog lifts within half an hour of taking salt.
It could be the water is helping, and not the salt.
Dieting tends to dehydrate me. Burning fat releases a boatloat of stored toxins, and does a number on the kidneys, etc.