/* ===== Popup global - Pedro Tavares Auto ===== */

/* Overlay (fundo escurecido) */
#ptp-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
    /* permite scroll do overlay caso o popup seja muito alto em ecrãs pequenos */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: ptp-fade 0.25s ease;
}

@keyframes ptp-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Caixa do popup */
#ptp-box {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 440px;
    /* nunca ultrapassa a altura visível do ecrã */
    max-height: 92vh;
    overflow-y: auto;            /* scroll interno apenas dentro do popup */
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    animation: ptp-pop 0.25s ease;
}

@keyframes ptp-pop {
    from { transform: translateY(12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Imagem - mesma imagem em desktop e telemóvel.
   Adapta-se ao ecrã mantendo a proporção, sem cortar nem deformar. */
#ptp-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* Rodapé compacto em verde WhatsApp */
#ptp-content {
    padding: 10px 16px;
    text-align: center;
    background: #25D366;
}

/* só ocupa espaço se tiver conteúdo */
#ptp-content:empty {
    display: none;
}

#ptp-title {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

#ptp-text {
    margin: 0 0 10px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #ffffff;
}

/* Botão de ação - mais pequeno */
#ptp-button {
    display: inline-block;
    padding: 7px 18px;
    background: #ffffff;
    color: #128C7E;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

#ptp-button:hover {
    background: #f0f0f0;
    color: #0a6e5d;
}

/* Botão fechar (X) - roda branca no canto da imagem */
#ptp-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    color: #222222;
    font-size: 20px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: background 0.2s ease, transform 0.15s ease;
}

#ptp-close:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

/* Bloqueia scroll do site enquanto o popup está aberto */
body.ptp-open {
    overflow: hidden;
}

/* Ajustes para telemóvel (mesma imagem vertical 1080x1350) */
@media (max-width: 768px) {
    #ptp-box {
        max-width: 360px;
        max-height: 92vh;
    }

    #ptp-image {
        max-height: 72vh;
    }

    #ptp-title {
        font-size: 1.2rem;
    }
}
