.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.popup-container {
    background: white;
    border-radius: 12px;
    position: relative;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.8) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 90%;
    max-width: 500px;
}

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

.popup-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.popup-link:hover .popup-image {
    transform: scale(1.02);
}

.popup-content-wrapper {
    display: block;
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.popup-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.popup-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.popup-image-only {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.popup-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    min-height: 120px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.popup-text {
    padding: 20px;
}

.popup-text-no-image {
    padding: 40px 20px 20px 20px;
    min-height: 120px;
}

.popup-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: bold;
    color: #1f2937;
    line-height: 1.3;
}

.popup-content {
    color: #4b5563;
    line-height: 1.5;
    font-size: 14px;
}

.popup-content p {
    margin-bottom: 8px;
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
        max-width: 400px;
    }
    
    .popup-close {
        top: 8px;
        right: 8px;
        width: 26px;
        height: 26px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .popup-container {
        width: 98%;
        margin: 10px;
        border-radius: 8px;
        max-width: 350px;
    }
    
    .popup-close {
        top: 6px;
        right: 6px;
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .popup-loading {
        padding: 40px 20px;
        min-height: 80px;
    }
    
    .loading-spinner {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }
}

/* Animation for better UX */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-overlay.show .popup-container {
    animation: popupFadeIn 0.3s ease-out;
}

/* Accessibility improvements */
.popup-close:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.popup-button:focus {
    outline: 2px solid #0056b3;
    outline-offset: 2px;
}

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