/* Overlay (fundo escurecido) */
.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: 9999;
    padding: 20px;
    box-sizing: border-box;

    /* Estado inicial: oculto */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Quando ativo, aparece */
.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Caixa do popup */
.popup-content {
    position: relative;
    max-width: 559px;   /* Largura original da imagem */
    width: 100%;
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transform: scale(0.85);
    transition: transform 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.popup-overlay.active .popup-content {
    transform: scale(1);
}

/* Imagem do popup */
.popup-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 559px;   /* Mantém proporção original em telas grandes */
    pointer-events: none; /* Evita "arrastar" a imagem */
    user-select: none;
}

/* Botão de fechar */
.popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.popup-close:hover,
.popup-close:focus {
    background-color: #e53935;
    transform: scale(1.1);
    outline: none;
}

/* Ajustes para telas pequenas */
@media (max-width: 600px) {
    .popup-overlay {
        padding: 15px;
    }

    .popup-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 6px;
        right: 6px;
    }
}

/* Evita scroll do body quando o popup estiver aberto (aplicado via JS) */
body.popup-open {
    overflow: hidden;
}