Three-dimensional structure of solar active regions