I'm trying to understand the derivation of the formula:

$E = z_{\frac{\alpha}{2}}\sqrt{\frac{\hat{p}\hat{q}}{n} }$

The definition given in the text is: When data from a simple random sample are used to estimate a population proportion $p$, theMargin of Error, denoted by $E$, is the maximum likely difference (with probability $1 - \alpha$, such as 0.95) between the observed sample proportion $\hat{p}$ and the true value of the population proportion $p$. The margin of error $E$ is found bymultiplying the critical value and the standard deviation of sample proportions, as shown in the above formula.

So here's my question: Where did $\sqrt{\frac{\hat{p}\hat{q}}{n}}$ come from?

In an earlier chapter it was stated that the standard deviation $\sigma = \sqrt{npq}$. And it's obvious that $z_{\frac{\alpha}{2}}$ is the critical value. So, why isn't $E = z_{\frac{\alpha}{2}}\sqrt{npq}$?

There is no other explanation given of why $\sqrt{\frac{\hat{p}\hat{q}}{n}}$ is a "standard deviation of a sample proportion".

Any help would be appreciated.