This is simple - any decision in the country must be made through a referendum. Now, it is possible to perform referendums online, so the humanity has a possibility to build a quite good democracy.
I also have an idea, that in a really ideal democracy, one more principle must be implemented: each person should mention the importance of the decision on vote for himself, and this information must be honest. I mean, with modern democracies it is theoretically possible, that 90% will vote for making the remaining 10% slaves. This was impossible if the voters indicated (honestly) on a ten-pointed scale, how important is this decision for themselves.