To begin, soak the dried beans overnight in plenty of cold water. This ensures even cooking and reduces cooking time. Move to simmering the beans.
Drain the soaked beans, add to a large pot with fresh water, bay leaves, and salt. Simmer gently for 45–60 minutes until tender but not mushy. Drain, reserving 200ml of the cooking liquid. Proceed to onion preparation.
Heat the sunflower oil in a wide pan over medium heat. Add the sliced onions and cook slowly for 15–20 minutes until soft and golden. Stir often to prevent sticking. Continue by seasoning.
Add garlic, sweet paprika, hot paprika if using, salt, and black pepper. Stir thoroughly to release fragrance. Cook for another 2 minutes to deepen flavour. Transition to combining with beans.
In a large mixing bowl, combine the cooked beans with the onion mixture. Pour in some of the reserved bean liquid to keep the mixture moist. Stir gently so the beans remain intact. Move to baking preparation.
Preheat your oven to 180°C (160°C fan). Grease a deep ovenproof dish with a little oil to prevent sticking. Proceed to layering.
Spread half of the bean and onion mixture into the dish. Pour a splash of bean liquid over the layer. Add the remaining mixture evenly on top. This layering helps the flavours meld beautifully. Transition to baking.
Place the dish in the oven and bake uncovered for 60 minutes. Check halfway and add more bean liquid if it looks too dry. Bake until the top forms a rich golden crust. Move to serving.
Serve Prebranac hot with crusty bread or grilled meats. Presentation tip: garnish with a drizzle of sunflower oil or a sprinkle of fresh parsley for a lighter touch.