/* Popup styles */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.show {
    display: flex;
    opacity: 1;
}

.popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 60px 80px;
}

#popup-media {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    max-width: calc(100vw - 160px);
    max-height: calc(100vh - 120px);
}

#popup-media img,
#popup-media video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

#popup-media iframe {
    width: 80vw;
    height: 45vw;
    max-width: 1200px;
    max-height: 675px;
    border-radius: 8px;
}

.popup-close {
    position: fixed;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    z-index: 1051;
    padding: 10px;
    line-height: 1;
    transition: opacity 0.3s ease;
}

.popup-close:hover {
    opacity: 0.7;
}

/* Navigation arrows */
.popup-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    padding: 20px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s ease;
    z-index: 1051;
}

.popup-nav:hover {
    background: rgba(255, 255, 255, 0.4);
}

.popup-nav.prev {
    left: 20px;
}

.popup-nav.next {
    right: 20px;
}

/* Animation */
#popup-media img,
#popup-media video,
#popup-media iframe {
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile adaptation */
@media(max-width: 768px) {
    .popup-content {
        padding: 40px 60px;
    }
    
    #popup-media {
        max-width: calc(100vw - 120px);
        max-height: calc(100vh - 80px);
    }
    
    .popup-nav {
        font-size: 20px;
    }
    
    .popup-nav.prev {
        left: 15px !important;
    }
    
    .popup-nav.next {
        right: 15px !important;
    }
    
    .popup-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    #popup-media iframe {
        width: 90vw;
        height: 50.625vw;
    }
    
    #popup-media img, 
    #popup-media video {
        max-width: 90%;
    }
}

/* Very small screens */
@media(max-width: 480px) {
    .popup-content {
        padding: 30px 50px;
    }
    
    #popup-media {
        max-width: calc(100vw - 100px);
        max-height: calc(100vh - 60px);
    }
}
