When to Trust LLMs: Aligning Confidence with Response Quality