Why pterosaurs were not declining

Lately I've seen many people who have the erroneous idea pterosaurs were being replaced by birds in the Late Cretaceous. In reality, the evidence availiable does not, in fact, support a long decline as said imbeciles think.

To begin with, lets analyse avian and pterosaurian diversity. Birds began diversifying early in the Cretaceous; Liaoning is a clear evidence of this, presenting a vast menagerie of bird species. In the late Cretaceous birds pretty much only went to populate marine ecosystems, and even so seabirds were already present in the Early Cretaceous, and only diving forms like the Hesperornithes seem to have achieved success; volant forms like Itchyornis were still outnumbered by pterosaurs, or somehow just managed to avoid being preserved. In the late Cretaceous we have footprints of a crane sized bird and remains of large, flightless forms like Gargantuavis, but the first don't seem to have been common (we still don't have fossils of flying, crane sized birds) and the later were occupying dinosaurian niches not ones taken by pterosaurs, for they never produced wingless forms AFAIK. In fact, there seems to be a general tendency for birds to have specialised in terrestrial niches, competing more directly with their dinosaurian bretheren than with pterosaurs.

Pterosaur diversity is more complicated. In the Early Cretaceous we have a vast diversity of pterodactyloid pterosaurs, as well as the occasional anurognathid fossil; after the Early Cretaceous we are limited to azhdarchids and ornithocheiroids, the later seeing the replacement of ornithocheirids and Lonchodectes by pteranodontians after the Turonian (its worth to note little is known of Lonchodectes' lifestyle, so its just as easy to assume it was replaced by pteranodontians, azhdarchids or crane like birds). The situation is not so much decline as it is a sudden disappearence of species, specially considering bird diversity does not increase significantly until way after many pterosaurs disappear, suggesting that birds were simply taking niches opportunistically, like mammals took the niches of dinosaurs after the extinction.

Ecologically wise, it does not make sense birds replacing pterosaurs; following this logic bats should have replaced birds, because bats are superior flyers on many levels, having a higher control of the wing and not having large hindlimbs that only offer useless weight in the air. Nevertheless, birds still dominate the skies, and bats haven't been replaced by any clade of nocturnal bird; this is because they essencially occupy different niches at the present, limited by the presence of either group. This means pterosaurs and birds likely followed a similar pattern, and neither birds nor pterosaurs could had occupied each other's niches while co-existing. However, if either group suffers losses, its likely that one of them will take advantage of the empty niches; pterosaur extinctions opened some paths for birds. Even so, birds don't seem to have occupied many previously pterosaurian niches in the Cretaceous (sans for waterfowl and possibly flamingos, which took the niches of ctenochasmatoids), though oviraptorian dinosaurs did replaced tapejarids and dsungaripterids in the northern hemisphere.

Worth of noting is that the disappearence of most pterosaurs is consistent with the disappearence of lagerstattën fossil sites, none dating from the Lare Cretaceous. Combined with the generally poor fossil record of both birds and pterosaurs sans a few cases, this implies that pterosaurs could had been actually quite more diverse than we know them to be now; this is specially true for anurognathids, whose origins lay in the Triassic but whose skeletons are so fragile that they only occur in a few lagerstattë from the late Jurassic and Early Cretaceous and could have survived to the very end.

In addition, the known pterosaur groups from the late Cretaceous were far from gone; pteranodontians seem to have been more common than volant seabirds, while azhdarchids were not only cosmopolitian, but also have shown some variation in ecological niches. In short, if the KT never occured, pterosaurs would still be around.