// Define the WhatsApp SVG code
var whatsappSVG = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32px" height="32px" fill="#FFFFFF">
    <path d="M16,1C7.163,1,0,8.163,0,17c0,3.01,0.84,5.832,2.331,8.249L1.02,31.029c-0.141,0.645,0.447,1.233,1.092,1.092 l5.804-1.311C11.212,31.839,13.553,32,16,32c8.837,0,16-7.163,16-15S24.837,1,16,1z M16,29c-2.2,0-4.315-0.57-6.165-1.644 l-0.439-0.253l-3.447,0.779l0.748-3.403l-0.285-0.446C5.662,22.156,5,19.633,5,17c0-6.065,4.935-11,11-11s11,4.935,11,11 S22.065,29,16,29z"/>
    <path d="M23.489,19.308c-0.353-0.177-2.086-1.027-2.409-1.146c-0.324-0.119-0.561-0.177-0.799,0.177 c-0.237,0.353-0.919,1.146-1.127,1.384c-0.207,0.237-0.415,0.266-0.768,0.089c-0.353-0.177-1.492-0.55-2.84-1.754 c-1.05-0.938-1.76-2.098-1.966-2.452c-0.207-0.353-0.022-0.543,0.154-0.719c0.158-0.158,0.353-0.415,0.53-0.622 c0.178-0.207,0.237-0.355,0.355-0.592c0.119-0.237,0.059-0.443-0.03-0.621C13.527,12.84,12.798,11,12.518,10.452 c-0.281-0.55-0.566-0.476-0.799-0.485c-0.206-0.01-0.444-0.01-0.682-0.01c-0.237,0-0.622,0.089-0.947,0.444 c-0.324,0.353-1.264,1.238-1.264,3.018s1.293,3.495,1.473,3.73c0.177,0.237,2.519,3.84,6.104,5.384 C17.25,23.999,17.86,24.13,18.391,24.263c0.532,0.133,1.011,0.114,1.393,0.069c0.425-0.051,2.086-0.852,2.38-1.677 c0.295-0.826,0.295-1.538,0.207-1.677C23.944,19.548,23.843,19.485,23.489,19.308z"/>
</svg>`;

// Create the WhatsApp icon container
var whatsappIcon = document.createElement('div');
whatsappIcon.className = 'whatsapp-icon';

// Create an anchor element
var whatsappLink = document.createElement('a');
whatsappLink.href = "https://wa.me/966533511424?text=مرحبًا، أحتاج إلى مساعدة.";
whatsappLink.target = "_blank";

// Set the inner HTML of the anchor to the SVG code
whatsappLink.innerHTML = whatsappSVG;

// Append the anchor to the icon container
whatsappIcon.appendChild(whatsappLink);

// Append the WhatsApp icon container to the body
document.body.appendChild(whatsappIcon);

// Add CSS styles
var css = `
.whatsapp-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}
.whatsapp-icon a {
    color: white;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.whatsapp-icon svg {
    width: 40px;
    height: 40px;
}
.whatsapp-icon:hover {
    background-color: #128c7e;
}`;

var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheet.innerText = css;
document.head.appendChild(styleSheet);