/* Popup Overlay */
.mpm-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.mpm-popup-overlay.mpm-active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.mpm-popup-container {
    position: relative;
    display: inline-block;
    max-width: 40vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: visible;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: mpm-popup-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    margin: 0;
    padding: 0;
    z-index: 1;
}

/* Container khi chỉ có ảnh */
.mpm-popup-container.mpm-image-only {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible;
    width: auto;
    height: auto;
    max-width: 40vw;
    max-height: 90vh;
    min-width: auto;
    min-height: auto;
    display: inline-block;
}

.mpm-popup-overlay.mpm-active .mpm-popup-container {
    transform: scale(1) translateY(0);
}

@keyframes mpm-popup-enter {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Popup Content */
.mpm-popup-content {
    position: relative;
    padding: 30px;
    margin: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    box-sizing: border-box;
    line-height: 1.6;
    color: #333333;
}

/* Khi chỉ có ảnh, không có padding */
.mpm-popup-content.mpm-image-only {
    padding: 0 !important;
    line-height: 0;
    width: auto !important;
    height: auto !important;
    max-width: 40vw !important;
    max-height: 90vh !important;
    overflow: visible;
    display: block;
}

.mpm-popup-content img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
    margin: 15px 0;
}

.mpm-popup-content.mpm-image-only img {
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: 40vw !important;
    max-height: 90vh !important;
    object-fit: contain !important;
    display: block;
    vertical-align: top;
    max-width: 40vw;
    max-height: 90vh;
}

.mpm-popup-content img:first-child {
    margin-top: 0;
}

.mpm-popup-content img:last-child {
    margin-bottom: 0;
}

.mpm-popup-content p {
    margin: 0 0 15px 0;
}

.mpm-popup-content p:last-child {
    margin-bottom: 0;
}

.mpm-popup-content h1,
.mpm-popup-content h2,
.mpm-popup-content h3,
.mpm-popup-content h4,
.mpm-popup-content h5,
.mpm-popup-content h6 {
    margin: 20px 0 15px 0;
    line-height: 1.4;
}

.mpm-popup-content h1:first-child,
.mpm-popup-content h2:first-child,
.mpm-popup-content h3:first-child {
    margin-top: 0;
}

/* Close Button - Modern Style */
#mpm-popup-overlay .mpm-popup-container .mpm-popup-close,
.mpm-popup-overlay .mpm-popup-container .mpm-popup-close,
.mpm-popup-close {
    position: absolute !important;
    top: -18px !important;
    right: -18px !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: none !important;
    border-radius: 50% !important;
    -webkit-border-radius: 50% !important;
    -moz-border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999999 !important;
    transition: all 0.25s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    color: #666666 !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
    outline: none !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    aspect-ratio: 1 / 1 !important;
    text-align: center !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.mpm-popup-close:hover {
    background: #f8f9fa;
    color: #333333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mpm-popup-close:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.mpm-popup-close:focus {
    outline: 2px solid rgba(0, 123, 255, 0.3);
    outline-offset: 2px;
}

.mpm-close-icon {
    font-size: 22px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    color: inherit !important;
    display: block !important;
    user-select: none !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
    vertical-align: middle !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mpm-popup-container {
        max-width: 80vw;
    }
    
    .mpm-popup-container.mpm-image-only {
        max-width: 80vw;
        max-height: 90vh;
    }
    
    .mpm-popup-content.mpm-image-only {
        max-width: 80vw !important;
        max-height: 90vh !important;
    }
    
    .mpm-popup-content.mpm-image-only img {
        max-width: 80vw !important;
        max-height: 90vh !important;
    }
    
    .mpm-popup-content {
        padding: 20px;
        max-height: calc(90vh - 40px);
    }
    
    .mpm-popup-close {
        width: 32px !important;
        height: 32px !important;
        top: -14px !important;
        right: -14px !important;
    }
    
    .mpm-close-icon {
        font-size: 18px !important;
    }
}

@media (max-width: 480px) {
    .mpm-popup-container {
        max-width: 90vw;
    }
    
    .mpm-popup-container.mpm-image-only {
        max-width: 90vw;
        max-height: 95vh;
    }
    
    .mpm-popup-content.mpm-image-only {
        max-width: 90vw !important;
        max-height: 95vh !important;
    }
    
    .mpm-popup-content.mpm-image-only img {
        max-width: 90vw !important;
        max-height: 95vh !important;
    }
    
    .mpm-popup-content {
        padding: 15px;
        max-height: calc(95vh - 30px);
    }
    
    .mpm-popup-close {
        width: 30px !important;
        height: 30px !important;
        top: -12px !important;
        right: -12px !important;
    }
    
    .mpm-close-icon {
        font-size: 16px !important;
    }
}

/* Prevent body scroll when popup is open */
body.mpm-popup-open {
    overflow: hidden;
}

