Flavor physics in the Randall-Sundrum model I. Theoretical setup and electroweak precision tests