We present an analytically solvable theory of Bardeen-Cooper-Schrieffer-type superconductivity in good metals which are confined along one of the three spatial directions, such as thin films. Closed-form expressions for the dependence of the superconducting critical temperature [Formula: see text] as a function of the confinement size [Formula: see text] are obtained, in quantitative agreement with experimental data with no adjustable parameters. Upon increasing the confinement, a crossover from a spherical Fermi surface, which contains two growing hollow spheres corresponding to states forbidden by confinement, to a strongly deformed Fermi surface, is predicted. This crossover represents a new topological transition, driven by confinement, between two Fermi surfaces belonging to two different homotopy classes. This topological transition provides a mechanistic explanation of the commonly observed non-monotonic dependence of [Formula: see text] upon film thickness with a maximum which, according to our theory, coincides with the topological transition.