/* Popup Menu Styles */
#popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: auto;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: opacity;
}

#popup-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.popupContainer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0) scale(0.95);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 100001;
    opacity: 0;
    transition: all 0.2s ease;
    min-width: 250px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: auto;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.popupContainer.popupActive {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0) scale(1);
}

/* Popup Menu Content */
.popup-menu {
    padding: 15px;
}

.popup-menu h3 {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 16px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.popup-menu-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.popup-menu-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

.popup-menu-item:hover {
    background-color: #f5f5f5;
}

/* Close button */
.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.popup-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .popupContainer {
        max-width: 95%;
        max-height: 85vh;
        min-width: 200px;
    }
    
    /* Ensure centering is maintained on mobile */
    .popupContainer.popupActive {
        transform: translate3d(-50%, -50%, 0) scale(1) !important;
    }
}
