
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(47,62,70, 0.9); /* สีดำโปร่งแสง */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-in-out;
}

#overlay.show {
    opacity: 0;
    pointer-events: none; /* เรียกใช้คลาสนี้เมื่อโหลดเป็นครั้งที่สอง */
}
#overlay.hidden {
	visibility: hidden;
    opacity: 0;
}

#popup {
    background-color: white;
    padding: 40px;
    text-align: center;
    max-width: 80%;
    position: relative; /* สำคัญสำหรับการจัดตำแหน่งปุ่มปิด */
    transform: scale(0.8);
    opacity: 0;
    animation: fadeInScale 0.5s forwards;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#popup img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
}

#popup p {
    margin: 0;
    font-size: 16px!important;
    color: #333;
}
img.cart-animation {
	width: 40%; max-width: 140px!important;
	transform: scaleX(-1);
}

/* สไตล์สำหรับปุ่มปิด */
.popup-close {
    width: 50px;
    height: 50px;
    position: absolute;
    top: -25px;
    right: 0;
    cursor: pointer;
    background-color: #fecb03;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.popup-close span{
	width:100%; height:1px; display:block;
	background-color: #6626a9;
}
.popup-close span:first-of-type {
	-webkit-transform:rotate(45deg);
	-moz-transform:rotate(45deg);
	-ms-transform:rotate(45deg);
	-o-transform:rotate(45deg);transform:rotate(45deg);
}
.popup-close span:last-of-type {
	-webkit-transform:rotate(-45deg) translateY(-1px);
	-moz-transform:rotate(-45deg) translateY(-1px);
	-ms-transform:rotate(-45deg) translateY(-1px);
	-o-transform:rotate(-45deg) translateY(-1px);
	transform:rotate(-45deg) translateY(-1px);
}
.break-320px { display: none; visibility: hidden;}

@media (max-width: 320px) {
	.break-320px {  display: inherit; visibility: visible;}
}

/* Keyframe animation for popup */
@keyframes fadeInScale {
    to {
        transform: scale(1);
        opacity: 1;
    }
}