In this paper, we investigate interactions and phase transitions in polyelectrolyte-surfactant complexes formed between a cationic azobenzene-containing surfactant and two types of polyelectrolytes: natural (DNA) or synthetic (PAA: poly acrylic acid). The construction of a phase diagram allowed distancing between four major phases: extended coil conformation, colloidally stable compacted globules, colloidal instability range, and surfactant-stabilized compact state. Investigation on the complexes' properties in different phases and under irradiation with UV light provides information about the role of the surfactant's hydrophobic trans isomers both in the formation and destruction of DNA and PAA globules as well as in their colloidal stabilization. The trans isomer shows much stronger affinity to the polyelectrolytes than the hydrophilic cis counterpart. There is no need for complete compensation of the polyelectrolyte charges to reach the complete compaction. On contrary to the findings previously reported in the literature, we demonstrate - for the first time - complete polyelectrolyte compaction which occurs already at 20% of DNA (and at 50% of PAA) charge compensation. The trans isomer plays the main role in the compaction. The aggregation between azobenzene units in the photosensitive surfactant is a driving force of this process. The decompaction can be realized during UV light irradiation and is strongly influenced by the interplay between surfactant-surfactant and surfactant-DNA interactions in the compacted globules.