/* ========================================
   Product Videos - Styles Front-Office
   ======================================== */

/* Container principal */
.product-videos-container {
    margin: 20px 0;
}

/* Vignettes vidéos */
.product-videos-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.video-thumb-wrapper {
    flex: 0 0 calc(25% - 12px);
    max-width: calc(25% - 12px);
}

@media (max-width: 991px) {
    .video-thumb-wrapper {
        flex: 0 0 calc(33.333% - 10px);
        max-width: calc(33.333% - 10px);
    }
}

@media (max-width: 767px) {
    .video-thumb-wrapper {
        flex: 0 0 calc(50% - 8px);
        max-width: calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    .video-thumb-wrapper {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.video-thumb {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: #000;
}

.video-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.video-thumb-image {
    position: relative;
    padding-bottom: 56.25%;
    /* Ratio 16:9 */
    overflow: hidden;
}

.video-thumb-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-thumb:hover .video-thumb-image img {
    transform: scale(1.05);
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.video-placeholder i.material-icons {
    font-size: 64px;
    color: rgba(255, 255, 255, 0.8);
}

/* Overlay de lecture */
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);

    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);

}

.video-thumb:hover .video-play-overlay {
    background: rgba(255, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-play-overlay i.material-icons {
    font-size: 36px;
    color: #fff;
}

/* Badge de type de vidéo */
.video-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
}

/* Titre de la vignette */
.video-thumb-title {
    padding: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background: #fff;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   Modal Vidéo
   ======================================== */

.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.video-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    z-index: 10;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.video-modal-close i.material-icons {
    font-size: 24px;
}

.video-modal-title {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.video-modal-player {
    position: relative;
    padding-bottom: 56.25%;
    /* Ratio 16:9 */
    height: 0;
    overflow: hidden;
    background: #000;
}

.video-modal-player iframe,
.video-modal-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-modal-player video {
    background: #000;
}

/* ========================================
   Intégration dans la galerie PrestaShop
   ======================================== */

.integrated-video-thumb {
    position: relative;
}

.integrated-video-thumb .video-thumb {
    border-radius: 4px;
}

/* Adaptation pour le thème Classic */
.js-qv-product-images .integrated-video-thumb,
.images-container .integrated-video-thumb {
    margin: 0 5px 10px 0;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .video-modal-content {
        max-width: 95%;
    }

    .video-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }

    .video-modal-title {
        font-size: 14px;
        padding: 12px 15px;
    }
}

/* ========================================
   Material Icons - Fallback
   ======================================== */

@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url(https://fonts.gstatic.com/s/materialicons/v139/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

/* ========================================
   Animations supplémentaires
   ======================================== */

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.video-thumb:active .video-play-overlay {
    animation: pulse 0.3s ease;
}

/* ========================================
   États de chargement
   ======================================== */

.video-modal-player.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ========================================
   Accessibilité
   ======================================== */

.video-thumb:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.video-modal-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    .video-thumb-title {
        background: #1a1a1a;
        color: #f0f0f0;
    }
}