Help with 529 and AOTC questions

Newbie here although I have been reading threads in this community throughout the end of my child’s college search and it was very helpful. I wish I had found this place sooner honestly.
Child is a freshman and I am navigating my way through how to effectively use our 529 account and also get the AOTC which I just learned about.

1st question/issue: The way her bill comes from college, it does not distinguish how her scholarships get applied. So as a general example her total semester bill is let’s say $40k in charges (tuition, fees required like resource and activity, improvement fund, housing, and dining). Then $30k in scholarships. My child took a loan so that takes off $2750. I then need to pay $7250. I had the 529 account pay that to her school. Is that going to be an issuer with taxes? How do I know if any part did not apply to a qualified expense when the bill just breaks down charges on one side and credits on the other?

Also, in regards to the 529, I paid that entire balance from her 529. They covered her first semester books. I was told by the college to pay for the books and then they would reimburse me. It was not explained how that would happen but I paid out of pocket and then was told they would refund my child on her bill. Since the bill was paid in full she had to wait for a refund check. Now I read that any refunds after 529 payments are applied can be an issue? But I can show I paid for those books out of pocket so maybe it is ok?

2nd question/issue: So similar bill comes in for spring semester. I want to pay with the 529 account again in full for what we owe but clearly do not want to make any more mistakes. And I just learned about the AOTC and read any money used from a 529 can’t be used to claim the AOTC so to get the full credit, do I need to pay $4k out of pocket and then only pay the remainder from the 529? Frustrating because this is what I saved in a 529 all these years for is to use it but I don’t want to miss a credit I could get either. And again with the bill breakdown, is there an issue with what is considered tuition to even get the credit?
Any help or advice would be greatly appreciated. I am in over my head on this stuff.
Thanks

Ugh. First post so I can’t seem to figure out how to edit my post. I have no idea why I used the acronym EOC when it should be AOTC. If I can figure out how to fix my title and post I will. Sorry.
I meant american opportunity tax credit

@BelknapPoint