Depends on the current, plating thickness, length of trace and temperature.
It's also very important to make sure there is sufficient physical seperation between the high voltage and low voltage side of your circuit
Just google "PCB trace width calculator"
Is C4 rated for AC?
Have you done a thermal analysis? Does the BT139 come in a surface mount version?
You raised Good question
I have selected an SMD capacitor rated for 500V DC, but I need a capacitor that can also handle AC voltage. Could you please suggest which type of capacitor I should use? The X2 safety capacitor takes up a lot of space, and my design has space constraints. Additionally, I think I should use a through-hole resistor instead of an SMD resistor for better heat dissipation to the air.
Guys who are following this question i have a update for you regarding trace width and clearance calculation for AC Voltage after some research
How Trace width is calculated?
For Current we have to choose cross sectional area. use Trace width calculator (Trace Width Calculator | AdvancedPCB) where he will asked you some question like current and thickness on base of that it will tell you trace width ,basically calculator calculate cross sectional area on the base of current and thickness of copper trace.
Q) How to Choose clearance between Traces?
Ans)clearance between two traces depends upon the voltages ,basically voltages is insulation. To find the minimum safe distance we can use IPC-2221B standard we can find calculator for this like PCB Trace Spacing Calculation for Voltage Levels Here after entering your voltage you can get min.distance between 2 traces
The G3MB-202P SSR (US $1 each) seems to be a standard footprint, and can be used for loads up to 2A. They have a built-in snubber circuit. Just add a 2A fuse, like on many modules that use this part.
Leo..