Structure, electronic and optical properties of CsPbX3 halide perovskite: A first-principles study