/* Popup Carousel Styles */
.popup-overlay {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.popup-overlay.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.popup-content.popup-carousel {
    position: relative;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    margin: -550vh auto 0;     /* ขยับลงจากด้านบน 5vh */
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 16px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

/* Slideshow container */
.popup-slideshow {
    position: relative;
    max-width: 100%;
    margin: auto;
}

/* รูปภาพในสไลด์ */
.popup-slide {
    display: none;
    width: 100%;
}

.popup-slide img {
    width: 100%;
    height: auto;
    transform: none !important;
    transform-origin: center;  /* ขยายจากจุดกลาง */
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

/* Animation fade */
.fade-slide {
    animation: fadeEffect 1s;
}

@keyframes fadeEffect {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ปุ่มซ้าย-ขวา */
.popup-prev, .popup-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -40px;
    padding: 16px 20px;
    color: #ffdc96;
    font-weight: bold;
    font-size: 32px;
    transition: 0.3s ease;
    border-radius: 0 8px 8px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 10px rgba(255, 220, 100, 0.8);
}

.popup-next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

.popup-prev:hover, .popup-next:hover {
    background-color: rgba(255, 220, 100, 0.3);
    transform: scale(1.1);
}

/* จุดแสดงหน้า */
.popup-dots {
    text-align: center;
    padding: 20px 0;
    position: absolute;
    bottom: -50px;
    width: 100%;
}

.popup-dot {
    cursor: pointer;
    height: 15px;
    width: 15px;
    margin: 0 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.popup-dot.active, .popup-dot:hover {
    background-color: #ffdc96;
    box-shadow: 0 0 15px rgba(255, 220, 100, 0.9);
}

/* ปุ่มปิด */
.popup-close {
    position: absolute;
    top: -15px;
    right: -15px;
    color: #ffdc96;
    font-size: 48px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    transition: all 0.3s ease;
    text-shadow: 0 0 20px rgba(255, 220, 100, 0.8);
}

.popup-close:hover {
    background: rgba(255, 220, 100, 0.3);
    transform: rotate(90deg) scale(1.1);
}

/* Responsive */
@media screen and (max-width: 768px) {
    .popup-content.popup-carousel {
        width: 95%;
    }
    
    .popup-prev, .popup-next {
        font-size: 24px;
        padding: 12px 15px;
    }
    
    .popup-close {
        font-size: 36px;
        width: 40px;
        height: 40px;
        top: -10px;
        right: -10px;
    }
    
    .popup-dot {
        height: 12px;
        width: 12px;
    }
}