بَعْلَبَكّ: a mazjī place-name; diptote.
عَبْدُ اللَّهِ: an iḍāfa compound; the first element takes regular case, the second remains genitive.
شَابَ قَرْنَاهَا: an isnādī proper name; its internal clause stays fixed, so the book calls it mabnī.
Exam method: Determine the compound type before assigning its case rule.