On the base of new boundary-value problem for the Eilenberger function we investigate the superconducting and magnetic states in ferromagnet/superconductor (FM/S) nanostructures, where superconductivity is a superposition of the BCS pairing with zero total momentum in the S layers and the Fulde-Ferrell-Larkin-Ovchinnikov (FFLO) pairing with nonzero 3D coherent momentum k in the FM layers. We originally study the interplay between the BCS and FFLO states in the pure thin FM/S/FM trilayers and two novel -phase superconducting states with electron-electron repulsion in the FM layers are predicted. The modulated FFLO states are possible in such trilayers only in presence of external magnetic field at suitable parameters of the FM and S layers. In the FM/S superlattices there are also two -phase magnetic states (0 and ) with compensation of the exchange field paramagnetic effect. This fact allows us to explain a surprisingly high Tc ~ 5K in the short period Gd/La superlattice and to predict the sign and value of the electron-electron interaction in the ferromagnetic Gd metal.