A variety of light management structures have been introduced in solar cells to improve light harvesting and further boost their conversion efficiency. Reliable and accurate simulation tools are required to design and optimize the individual structures and complete devices. In the first part of this paper, we analyze the performance of rigorous coupled-wave analysis (RCWA) for accurate three-dimensional optical simulation of solar cells, in particular heterojunction silicon (HJ Si) solar cells. The structure of HJ Si solar cells consists of thin and thick layers, and additionally, micro- and nano-textures are also introduced to further exploit the potential of light trapping. The RCWA was tested on the front substructure of the solar cell, including the texture, thin passivation and contact layers. Inverted pyramidal textures of different sizes were included in the simulations. The simulations rapidly converge as long as the textures are small (in the (sub)micrometer range), while for larger microscale textures (feature sizes of a few micrometers), this is not the case. Small textures were optimized to decrease the reflectance, and consequently, increase the absorption in the active layers of the solar cell. Decreasing the flat parts of the texture was shown to improve performance. For simulations of structures with microtextures, and for simulations of complete HJ Si cells, we propose a coupled modeling approach (CMA), where the RCWA is coupled with raytracing and the transfer matrix method. By means of CMA and nanotexture optimization, we show the possible benefits of nanotextures at the front interface of HJ Si solar cells, demonstrating a 13.4% improvement in the short-circuit current density with respect to the flat cell and 1.4% with respect to the cell with double-sided random micropyramids. We additionally demonstrate the ability to simulate a combination of nano- and microtextures at a single interface, although the considered structure did not show an improvement over the pyramidal textures.