as far as I've seen, your pain is caused by alt least 3 problems. I'll put it in the order that I would correct them step by step:
1. Your left shoulder is working very hard, moving a lot. muscle tension in the left shoulder is always spreading/casting forth to the other side.
proposal: I once saw on youtube a masterclass by Pepe Romero. the first what he told to the guitarist was to put down the footstool, - try it out, what's for me, this helped me al lot. and: play very easy pieces so that you can put awareness to relaxing the left shoulder (makingsome Tai Ji or Qi Gong exercises may also help to understand the connection betwwen muscles and the difference tension - relaxing
2. Your guitar is not really resting on your upperleg this habit is quite common, cause it "allows" the guitarist to see the whole fretboard. The less your guitar is "resting" the more your right arm is under tension.I bet, your right forearm will achieve another position and another "point of contact" with the guitar.
3. Your right wrist. It looks like you would hold your fingers and the hand with the wrist (like tennis-players). Ithink it would be better to let the hand fall down from the wrist without any tension. In the first position the tension goes via short head biceps up to the shoulder. (the exercises I cannot explain in english, may sombody else can help)
You are playing so nice, it's really worthy to work on your pains. good luck
(ed. it was not Pepe Romero but Julian Bream: s.f. Julian Bream Masterclass 1978: Heitor Villa-Lobos 3 Preludes , 19:30 min.