#pbp-home-popup-overlay {
    position: fixed !important;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 999999;
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
#pbp-home-popup-overlay.pbp-visible { display: flex !important; }

.pbp-popup-backdrop {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.6);
}

.pbp-popup-modal {
    position: relative;
    background: #fff;
    width: auto;
    max-width: min(600px, 92vw);
    max-height: 90vh;
    overflow: auto;
    border-radius: 8px;
    padding: 20px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    animation: pbp-modal-in 0.3s ease;
    box-sizing: border-box;
}
@keyframes pbp-modal-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.pbp-popup-close {
    position: absolute;
    top: 8px; right: 12px;
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    z-index: 2;
}

.pbp-popup-content {
    margin-top: 10px;
    max-height: calc(90vh - 90px);
    overflow: auto;
}

/* Garante que a imagem sempre se ajuste ao espaço disponível do modal */
.pbp-popup-content .pbp-carousel,
.pbp-popup-content .pbp-slides-track,
.pbp-popup-content .pbp-slide {
    width: 100%;
}
.pbp-popup-content .pbp-slide img {
    width: 100%;
    height: auto;
    max-height: calc(90vh - 140px);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Ajustes para telas pequenas (celulares) */
@media (max-width: 600px) {
    #pbp-home-popup-overlay { padding: 10px; }
    .pbp-popup-modal {
        max-width: 96vw;
        max-height: 94vh;
        padding: 14px;
        border-radius: 6px;
    }
    .pbp-popup-content {
        max-height: calc(94vh - 80px);
    }
    .pbp-popup-content .pbp-slide img {
        max-height: calc(94vh - 120px);
    }
    .pbp-popup-close {
        top: 6px; right: 6px;
        width: 28px; height: 28px;
        font-size: 18px;
    }
}

/* Telas muito baixas (paisagem em celulares) */
@media (max-height: 480px) {
    .pbp-popup-modal { max-height: 96vh; }
    .pbp-popup-content { max-height: calc(96vh - 60px); }
    .pbp-popup-content .pbp-slide img { max-height: calc(96vh - 90px); }
}
