#pw-video-ad-overlay {
display: none;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.72);
z-index: 999999;
align-items: center;
justify-content: center;
padding: 16px;
box-sizing: border-box;
animation: pwFadeIn 0.25s ease-out;
}#pw-video-ad-box {
position: relative;
background: #000;
border-radius: 12px;
box-shadow: 0 12px 35px rgba(0, 0, 0, 0.55);
overflow: visible;
}/* Desktop Sizing (16:9 Landscape) */
#pw-video-ad-box.pw-desktop {
width: 100%;
max-width: 640px;
aspect-ratio: 16 / 9;
}/* Mobile Sizing (9:16 Vertical) */
#pw-video-ad-box.pw-mobile {
width: 100%;
max-width: 310px;
aspect-ratio: 9 / 16;
}#pw-video-ad-link {
display: block;
width: 100%;
height: 100%;
border-radius: 12px;
overflow: hidden;
cursor: pointer;
text-decoration: none;
}#pw-video-ad-player {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}#pw-video-ad-close {
position: absolute;
top: -12px;
right: -12px;
width: 32px;
height: 32px;
border-radius: 50%;
background: #ffffff;
color: #111111;
border: 2px solid #222222;
font-size: 20px;
font-weight: bold;
line-height: 26px;
text-align: center;
cursor: pointer;
z-index: 1000000;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
padding: 0;
transition: transform 0.15s ease, background 0.15s ease;
}#pw-video-ad-close:hover {
background: #ff9900;
color: #000000;
transform: scale(1.08);
}@keyframes pwFadeIn {
from { opacity: 0; }
to { opacity: 1; }
}(function () {
// 1. Configure your video URLs and popup settings here
const DESKTOP_VIDEO_URL = "https://pharmawalks.in/wp-content/uploads/2026/11/Amazon-Desktop.mp4";
const MOBILE_VIDEO_URL = "https://pharmawalks.in/wp-content/uploads/2026/11/amazon-deals-9x16-readable-text.mp4";
const TARGET_LINK = "https://link.amazon/B080qyyh2";
const POPUP_DELAY_MS = 2000; // Opens 2 seconds after page load
const COOLDOWN_HOURS = 6; // Won't show again for 6 hours after closing (set to 0 to show every load)const STORAGE_KEY = "pw_goldbox_ad_closed_at";
const lastClosed = localStorage.getItem(STORAGE_KEY);
if (lastClosed && COOLDOWN_HOURS > 0) {
const hoursPassed = (Date.now() - parseInt(lastClosed, 10)) / (1000 * 60 * 60);
if (hoursPassed < COOLDOWN_HOURS) return;
}const overlay = document.getElementById("pw-video-ad-overlay");
const box = document.getElementById("pw-video-ad-box");
const player = document.getElementById("pw-video-ad-player");
const link = document.getElementById("pw-video-ad-link");
const closeBtn = document.getElementById("pw-video-ad-close");const isMobile = window.innerWidth <= 768;// Apply device-specific video and aspect ratio
if (isMobile) {
box.classList.add("pw-mobile");
player.src = MOBILE_VIDEO_URL;
} else {
box.classList.add("pw-desktop");
player.src = DESKTOP_VIDEO_URL;
}link.href = TARGET_LINK;function closePopup() {
overlay.style.display = "none";
player.pause();
localStorage.setItem(STORAGE_KEY, Date.now().toString());
}closeBtn.addEventListener("click", function (e) {
e.stopPropagation();
closePopup();
});// Also close if user clicks the dark background outside the video
overlay.addEventListener("click", function (e) {
if (e.target === overlay) {
closePopup();
}
});// Trigger popup after delay
setTimeout(function () {
overlay.style.display = "flex";
player.play().catch(function () {});
}, POPUP_DELAY_MS);
})();