/* Modal Popup Ads Styles */
.popup-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.popup-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.4s ease-in-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.popup-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80vh;
    object-fit: contain;
}

.popup-image-wrapper a {
    display: block;
    width: 100%;
}

.popup-close-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    z-index: 10;
    font-family: 'Kanit', sans-serif;
}

.popup-close-btn:hover {
    background: #c82333;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6);
    transform: translateX(-50%) translateY(-2px);
}

.popup-close-btn:active {
    transform: translateX(-50%) translateY(0);
}

/* ปุ่ม X มุมขวาบน (สำรอง) */
.popup-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 11;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.popup-close-x:hover {
    background: #fff;
    transform: rotate(90deg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Slider Controls สำหรับหลายรูป */
.popup-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.popup-slides-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.popup-slide {
    min-width: 100%;
    position: relative;
}

.popup-slide img {
    width: 100%;
    height: auto;
    display: block;
}

.popup-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.popup-nav-btn:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.popup-nav-btn.prev {
    left: 15px;
}

.popup-nav-btn.next {
    right: 15px;
}

.popup-dots {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.popup-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.popup-dot.active {
    background: #fff;
    width: 14px;
    height: 14px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .popup-content {
        max-width: 85%;
    }
}

@media (max-width: 768px) {
    .popup-content {
        max-width: 95%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .popup-image-wrapper img {
        max-height: 85vh;
    }
    
    .popup-close-btn {
        padding: 10px 30px;
        font-size: 14px;
        bottom: 10px;
    }
    
    .popup-close-x {
        width: 35px;
        height: 35px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }
    
    .popup-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .popup-nav-btn.prev {
        left: 10px;
    }
    
    .popup-nav-btn.next {
        right: 10px;
    }
    
    .popup-dots {
        bottom: 60px;
        gap: 8px;
    }
    
    .popup-dot {
        width: 10px;
        height: 10px;
    }
    
    .popup-dot.active {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .popup-content {
        max-width: 98%;
        border-radius: 5px;
    }
    
    .popup-close-btn {
        padding: 8px 25px;
        font-size: 13px;
        bottom: 8px;
    }
    
    .popup-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* ป้องกัน scroll ของ body เมื่อเปิด popup */
body.popup-open {
    overflow: hidden;
}
