/**
 * Product Video Pro - Frontend Styles
 * Design moderno e responsivo para vídeos de produto
 */

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.pvp-video-container {
    position: relative;
    margin: 40px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    background: #000;
}

/* Larguras */
.pvp-video-container.pvp-width-full {
    max-width: 100%;
    width: 100%;
}

.pvp-video-container.pvp-width-large {
    max-width: 80%;
    width: 80%;
}

.pvp-video-container.pvp-width-medium {
    max-width: 60%;
    width: 60%;
}

/* ============================================
   VÍDEO HTML5
   ============================================ */

.pvp-video {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
    background: #000;
    object-fit: contain; /* Default */
}

/* Fit options */
.pvp-fit-contain .pvp-video {
    object-fit: contain; /* Mostra vídeo completo, pode ter bordas */
}

.pvp-fit-cover .pvp-video {
    object-fit: cover; /* Preenche tudo, pode cortar */
}

.pvp-fit-fill .pvp-video {
    object-fit: fill; /* Estica para preencher */
}

/* Mobile vertical video (9:16) */
.pvp-video-container[data-device="mobile"] .pvp-video {
    aspect-ratio: 9 / 16;
    max-height: 70vh;
    margin: 0 auto;
}

/* Ajuste de largura para vídeos verticais */
@media (max-width: 767px) {
    .pvp-video-container[data-device="mobile"] {
        max-width: 50%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .pvp-video-container[data-device="mobile"] .pvp-video {
        aspect-ratio: 9 / 16;
        max-height: 80vh;
    }
}

/* Efeito de hover sutil */
.pvp-video-container:hover {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   YOUTUBE EMBED
   ============================================ */

.pvp-youtube-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
}

.pvp-youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================================
   CONTROLES PERSONALIZADOS
   ============================================ */

.pvp-video::-webkit-media-controls-panel {
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.pvp-video::-webkit-media-controls-play-button {
    background-color: #fff;
    border-radius: 50%;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.pvp-video-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pvp-spin 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.pvp-video-container.loading::before {
    opacity: 1;
}

@keyframes pvp-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   BADGE DE AUTOPLAY
   ============================================ */

.pvp-video-container[data-autoplay="true"]::after {
    content: "▶️ AUTOPLAY";
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    z-index: 2;
    pointer-events: none;
    animation: pvp-fade-out 3s forwards;
}

@keyframes pvp-fade-out {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 991px) {
    .pvp-video-container.pvp-width-large,
    .pvp-video-container.pvp-width-medium {
        max-width: 100%;
        width: 100%;
    }
    
    .pvp-video-container {
        margin: 30px auto;
        border-radius: 12px;
    }
}

@media (max-width: 767px) {
    .pvp-video-container {
        margin: 20px auto;
        border-radius: 8px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }
    
    .pvp-video-container::after {
        font-size: 10px;
        padding: 6px 12px;
    }
}

/* ============================================
   TEMA ESCURO (opcional)
   ============================================ */

body.dark-mode .pvp-video-container {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ============================================
   ANIMAÇÃO DE ENTRADA
   ============================================ */

.pvp-video-container {
    animation: pvp-slide-up 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pvp-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   OVERLAY PLAY BUTTON (para autoplay falhar)
   ============================================ */

.pvp-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.pvp-play-overlay:hover {
    background: rgba(0, 0, 0, 0.7);
}

.pvp-play-button {
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.pvp-play-overlay:hover .pvp-play-button {
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.pvp-play-button::before {
    content: "";
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 15px 0 15px 25px;
    border-color: transparent transparent transparent #000;
    margin-left: 5px;
}

.pvp-video-container.playing .pvp-play-overlay {
    display: none;
}

/* ============================================
   MELHORIAS DE ACESSIBILIDADE
   ============================================ */

.pvp-video:focus {
    outline: 3px solid #2271b1;
    outline-offset: 4px;
}

.pvp-video-container[aria-label]::before {
    position: absolute;
    top: 0;
    left: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    z-index: 3;
}

/* ============================================
   INTEGRAÇÃO COM WOOCOMMERCE
   ============================================ */

.woocommerce-Tabs-panel--pvp_video .pvp-video-container,
.product .entry-content .pvp-video-container {
    margin-top: 0;
}

/* Dentro da descrição */
.woocommerce-product-details__short-description .pvp-video-container {
    margin-bottom: 30px;
}

/* ============================================
   EFEITOS PREMIUM
   ============================================ */

/* Glow effect ao passar mouse */
@media (hover: hover) {
    .pvp-video-container::after {
        content: "";
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(45deg, #2271b1, #00a0d2);
        border-radius: 18px;
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .pvp-video-container:hover::after {
        opacity: 1;
    }
}

/* Efeito de pulse no botão de play */
@keyframes pvp-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pvp-play-button {
    animation: pvp-pulse 2s infinite;
}

.pvp-play-overlay:hover .pvp-play-button {
    animation: none;
}

/* ============================================
   OTIMIZAÇÃO DE PERFORMANCE
   ============================================ */

.pvp-video {
    will-change: transform;
}

.pvp-video-container {
    contain: layout style paint;
}

/* ============================================
   CUSTOMIZAÇÕES POR TEMA
   ============================================ */

/* Tema Porto */
.porto-theme .pvp-video-container {
    border-radius: 12px;
}

/* Tema Flatsome */
.flatsome-theme .pvp-video-container {
    margin: 50px auto;
}

/* Tema Astra */
.ast-separate-container .pvp-video-container {
    margin: 40px 0;
}
