/* ===========================================================
   ESTILOS PARA POPUP DINÂMICO - IMAGEM E YOUTUBE
   ===========================================================
   Suporta dois modos:
   - image-mode: Exibe imagem clicável
   - youtube-mode: Exibe thumbnail com play, depois iframe
*/

/* ===========================================================
   OVERLAY (BACKDROP ESCURO)
   ===========================================================
*/
.imgPopup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: imgPopup-fadeIn 0.2s ease-out;
}

@keyframes imgPopup-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===========================================================
   CONTAINER PRINCIPAL
   ===========================================================
*/
.imgPopup-container {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: imgPopup-scaleIn 0.25s ease-out;
}

@keyframes imgPopup-scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===========================================================
   BOTÃO DE FECHAR
   ===========================================================
*/
.imgPopup-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    font-size: 20px;
    width: 32px;
    height: 32px;
    background-color: #fff;
    color: #333;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    cursor: pointer;
    font-weight: bold;
    z-index: 10000;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.imgPopup-close-btn:hover {
    background-color: #ff4444;
    color: #fff;
    transform: scale(1.1);
}

/* ===========================================================
   CONTEÚDO CLICÁVEL (IMAGEM OU YOUTUBE)
   ===========================================================
*/
.imgPopup-clickable {
    cursor: pointer;
}

/* ===========================================================
   MODO IMAGEM
   ===========================================================
*/
.imgPopup-container.image-mode .imgPopup-image {
    max-width: 90vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block;
    transition: transform 0.2s ease;
}

.imgPopup-container.image-mode .imgPopup-image:hover {
    transform: scale(1.01);
}

/* ===========================================================
   MODO YOUTUBE - THUMBNAIL COM PLAY
   ===========================================================
*/
.imgPopup-youtube {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.imgPopup-youtube-thumb {
    display: block;
    width: 100%;
    max-width: 800px;
    height: auto;
    object-fit: cover;
}

/* Botão de play centralizado */
.imgPopup-youtube-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
}

.imgPopup-youtube:hover .imgPopup-youtube-play {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
}

/* Fundo do botão play do YouTube */
.imgPopup-youtube-play-bg {
    fill: #f00;
    transition: fill 0.2s ease;
}

.imgPopup-youtube:hover .imgPopup-youtube-play-bg {
    fill: #cc0000;
}

/* ===========================================================
   MODO YOUTUBE - PLAYER ATIVO (IFRAME)
   ===========================================================
*/
.imgPopup-container.youtube-playing {
    width: 90vw;
    max-width: 800px;
}

.imgPopup-youtube-iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ===========================================================
   BOTÃO DE ACESSO AO LINK (PARA VÍDEOS)
   ===========================================================
*/
.imgPopup-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ffcc00 100%);
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: imgPopup-pulse 2s infinite;
}

.imgPopup-link-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ff8c5a 0%, #ffaa33 50%, #ffdd44 100%);
    color: #fff;
    text-decoration: none;
}

.imgPopup-link-btn:active {
    transform: translateY(0) scale(0.98);
}

.imgPopup-link-icon {
    font-size: 20px;
}

.imgPopup-link-text {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes imgPopup-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 53, 0.6), 0 2px 10px rgba(0, 0, 0, 0.3);
    }
}

/* Container do YouTube com botão - layout em coluna */
.imgPopup-container.youtube-mode {
    flex-direction: column;
}

/* ===========================================================
   RESPONSIVIDADE
   ===========================================================
*/
@media (max-width: 768px) {
    .imgPopup-container {
        max-width: 95vw;
        max-height: 85vh;
    }

    .imgPopup-close-btn {
        top: -8px;
        right: -8px;
        width: 28px;
        height: 28px;
        font-size: 18px;
        line-height: 26px;
    }

    .imgPopup-container.image-mode .imgPopup-image {
        max-width: 95vw;
        max-height: 80vh;
        border-radius: 4px;
    }

    .imgPopup-youtube {
        max-width: 95vw;
        border-radius: 4px;
    }

    .imgPopup-youtube-thumb {
        max-width: 100%;
    }

    .imgPopup-container.youtube-playing {
        width: 95vw;
    }

    .imgPopup-youtube-iframe {
        border-radius: 4px;
    }

    .imgPopup-link-btn {
        padding: 12px 20px;
        font-size: 14px;
        margin-top: 12px;
    }

    .imgPopup-link-icon {
        font-size: 16px;
    }
}