/* Container du carrousel */
.wprg-carousel-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 50px;
    overflow: hidden;
}

/* Carrousel */
.wprg-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: var(--wprg-gap, 20px);
    padding: 15px 0 25px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    transition: transform 0.3s ease;
}

.wprg-carousel.dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
}

.wprg-carousel::-webkit-scrollbar {
    display: none;
}

/* Centrage quand peu d'éléments */
.wprg-carousel-container.few-items .wprg-carousel {
    justify-content: center;
    overflow-x: hidden;
}

.wprg-carousel-container.few-items .wprg-carousel-prev,
.wprg-carousel-container.few-items .wprg-carousel-next,
.wprg-carousel-container.few-items .wprg-carousel-dots {
    display: none !important;
}

/* Élément du carrousel */
.wprg-carousel-item {
    flex: 0 0 auto;
    width: calc((100% - (var(--wprg-desktop, 6) - 1) * var(--wprg-gap, 20px)) / var(--wprg-desktop, 6));
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}

.wprg-carousel-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.2);
}

/* Miniature */
.wprg-carousel-thumbnail {
    width: 100%;
    aspect-ratio: 9/16;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
}

.wprg-carousel-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, 
        rgba(0,0,0,0.7) 0%, 
        rgba(0,0,0,0.3) 30%,
        rgba(0,0,0,0.1) 70%,
        rgba(0,0,0,0.3) 100%);
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.wprg-carousel-item:hover .wprg-carousel-thumbnail::after {
    opacity: 1;
}

.wprg-carousel-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 0, 0.2, 1);
    position: relative;
    z-index: 0;
}

.wprg-carousel-item:hover .wprg-carousel-thumbnail img {
    transform: scale(1.08);
}

/* Bouton play - TOUJOURS VISIBLE */
.wprg-carousel-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.9;
    transition: all 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    z-index: 5;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
    pointer-events: none;
}

.wprg-carousel-item:hover .wprg-carousel-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.wprg-carousel-play svg {
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
    transition: transform 0.2s ease;
    width: 48px;
    height: 48px;
}

/* Titre en bas - TOUJOURS VISIBLE */
.wprg-carousel-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    padding: 30px 12px 12px;
    background: linear-gradient(0deg, 
        rgba(0,0,0,0.9) 0%, 
        rgba(0,0,0,0.6) 50%,
        rgba(0,0,0,0) 100%);
    opacity: 1;
    transition: all 0.3s ease;
    z-index: 4;
    line-height: 1.4;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transform: translateY(0);
}

.wprg-carousel-item:hover .wprg-carousel-title {
    background: linear-gradient(0deg, 
        rgba(0,0,0,0.95) 0%, 
        rgba(0,0,0,0.7) 50%,
        rgba(0,0,0,0.1) 100%);
}

/* Boutons de navigation */
.wprg-carousel-prev,
.wprg-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
    color: #1a1a1a;
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

.wprg-carousel-container:hover .wprg-carousel-prev,
.wprg-carousel-container:hover .wprg-carousel-next {
    opacity: 1;
    pointer-events: auto;
}

.wprg-carousel-prev {
    left: 5px;
}

.wprg-carousel-next {
    right: 5px;
}

.wprg-carousel-prev:hover,
.wprg-carousel-next:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.wprg-carousel-prev:active,
.wprg-carousel-next:active {
    transform: translateY(-50%) scale(0.95);
}

.wprg-carousel-prev svg,
.wprg-carousel-next svg {
    width: 24px;
    height: 24px;
}

/* Indicateurs (dots) */
.wprg-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding-bottom: 5px;
}

.wprg-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.wprg-carousel-dot:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: scale(1.2);
}

.wprg-carousel-dot.active {
    background: #e1306c;
    width: 24px;
    transform: scale(1);
}

/* Popup */
.wprg-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.wprg-popup.active {
    display: block;
    animation: wprgFadeIn 0.2s ease;
}

@keyframes wprgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wprg-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.wprg-popup-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CORRIGÉ : Conteneur principal du player avec position relative */
.wprg-popup-player-container {
    position: relative;
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.wprg-popup-video-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 9/16;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
    margin: 0 auto;
}

.wprg-popup.active .wprg-popup-video-container {
    transform: scale(1);
}

.wprg-popup-video {
    width: 100%;
    height: 100%;
}

.wprg-popup-video video,
.wprg-popup-video iframe {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: contain;
}

/* Bouton fermeture */
.wprg-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    line-height: 1;
    padding: 0;
    font-weight: 300;
    pointer-events: auto;
}

.wprg-popup-close:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.4);
    transform: rotate(90deg);
}

/* ===== STYLES POUR LES LIKES ===== */

/* Badge de likes sur les miniatures */
.wprg-thumbnail-likes {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index:9;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    pointer-events: none;
}

.wprg-thumbnail-likes .wprg-likes-icon {
    font-size: 11px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.wprg-thumbnail-likes .wprg-likes-count {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.2px;
    font-size: 11px;
}

.wprg-thumbnail-likes.liked .wprg-likes-icon {
    animation: wprg-heart-pop 0.3s ease;
}

/* NOUVEAU : Badge de vues sur les miniatures - POSITIONNÉ EN HAUT À GAUCHE */
.wprg-thumbnail-views {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 9;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    pointer-events: none;
}

.wprg-thumbnail-views .wprg-views-icon {
    font-size: 11px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.wprg-thumbnail-views .wprg-views-count {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.2px;
    font-size: 11px;
}

/* Barre de likes dans le popup */
.wprg-popup-likes-bar {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    padding: 0 10px;
    margin-top: 0;
    position: relative;
}

.wprg-like-button {
    background: rgba(225, 48, 108, 0.9);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 40px;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    box-shadow: 0 8px 20px rgba(225, 48, 108, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    pointer-events: auto;
    color: white;
    font-weight: 600;
    font-size: 14px;
    transform: scale(1);
    position: relative;
}

.wprg-like-button:hover {
    background: #e1306c;
    transform: scale(1.02);
    box-shadow: 0 12px 28px rgba(225, 48, 108, 0.4);
}

.wprg-like-button:active {
    transform: scale(0.98);
}

.wprg-like-button.liked {
    background: #e1306c;
    box-shadow: 0 8px 20px rgba(225, 48, 108, 0.5);
}

.wprg-like-button.liked .wprg-like-icon {
    animation: wprg-heart-beat 0.3s ease;
}

.wprg-like-icon {
    font-size: 18px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.wprg-like-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: 0.3px;
    font-size: 14px;
}

.wprg-like-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes wprg-heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes wprg-heart-beat {
    0% { transform: scale(1); }
    25% { transform: scale(1.15); }
    50% { transform: scale(0.95); }
    75% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.wprg-like-pop {
    animation: wprg-like-pop 0.3s ease !important;
}

@keyframes wprg-like-pop {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); }
    60% { transform: scale(0.97); }
    100% { transform: scale(1); }
}

/* Responsive avec variables CSS */
@media (max-width: 1024px) {
    .wprg-carousel-item {
        width: calc((100% - (var(--wprg-tablet, 4) - 1) * var(--wprg-gap, 20px)) / var(--wprg-tablet, 4));
    }
    
    .wprg-carousel-container {
        padding: 15px 40px;
    }
    
    .wprg-popup-player-container {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .wprg-carousel-item {
        width: calc((100% - (var(--wprg-mobile, 2) - 1) * var(--wprg-gap, 20px)) / var(--wprg-mobile, 2));
    }
    
    .wprg-carousel-title {
        font-size: 11px;
        padding: 25px 10px 10px;
    }
    
    .wprg-popup-player-container {
        max-width: 350px;
        gap: 12px;
    }
    
    .wprg-carousel-container {
        padding: 10px 35px;
    }
    
    .wprg-carousel-prev,
    .wprg-carousel-next {
        width: 36px;
        height: 36px;
        opacity: 0.8;
    }
    
    .wprg-carousel-prev svg,
    .wprg-carousel-next svg {
        width: 20px;
        height: 20px;
    }
    
    /* Ajustements dots pour tablette */
    .wprg-carousel-dots {
        gap: 6px;
        margin-top: 15px;
    }
    
    .wprg-carousel-dot {
        width: 6px;
        height: 6px;
    }
    
    .wprg-carousel-dot.active {
        width: 20px;
    }
    
    /* Ajustements likes pour tablette */
    .wprg-thumbnail-likes {
        top: 6px;
        right: 6px;
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .wprg-thumbnail-likes .wprg-likes-icon {
        font-size: 10px;
    }
    
    .wprg-thumbnail-likes .wprg-likes-count {
        font-size: 10px;
    }
    
    /* Ajustements vues pour tablette - POSITIONNÉ EN HAUT À GAUCHE */
    .wprg-thumbnail-views {
        top: 6px;
        left: 6px;
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .wprg-thumbnail-views .wprg-views-icon {
        font-size: 10px;
    }
    
    .wprg-thumbnail-views .wprg-views-count {
        font-size: 10px;
    }
    
    .wprg-like-button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .wprg-like-icon {
        font-size: 16px;
    }
    
    .wprg-like-text {
        font-size: 13px;
    }
    
    .wprg-like-count {
        padding: 2px 7px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .wprg-carousel-container {
        padding: 10px 30px;
    }
    
    .wprg-carousel-play svg {
        width: 40px;
        height: 40px;
    }
    
    .wprg-popup-player-container {
        max-width: 300px;
        gap: 10px;
    }
    
    .wprg-popup-video-container {
        border-radius: 16px;
    }
    
    /* Ajustements dots pour mobile */
    .wprg-carousel-dots {
        gap: 5px;
        margin-top: 12px;
    }
    
    .wprg-carousel-dot {
        width: 5px;
        height: 5px;
    }
    
    .wprg-carousel-dot.active {
        width: 18px;
    }
    
    /* Ajustements likes pour mobile */
    .wprg-thumbnail-likes {
        top: 5px;
        right: 5px;
        padding: 2px 5px;
        font-size: 9px;
        border-radius: 16px;
    }
    
    .wprg-thumbnail-likes .wprg-likes-icon {
        font-size: 9px;
    }
    
    .wprg-thumbnail-likes .wprg-likes-count {
        font-size: 9px;
    }
    
    /* Ajustements vues pour mobile - POSITIONNÉ EN HAUT À GAUCHE */
    .wprg-thumbnail-views {
        top: 5px;
        left: 5px;
        padding: 2px 5px;
        font-size: 9px;
        border-radius: 16px;
    }
    
    .wprg-thumbnail-views .wprg-views-icon {
        font-size: 9px;
    }
    
    .wprg-thumbnail-views .wprg-views-count {
        font-size: 9px;
    }
    
    .wprg-like-button {
        padding: 7px 14px;
        font-size: 12px;
        border-radius: 30px;
    }
    
    .wprg-like-icon {
        font-size: 14px;
    }
    
    .wprg-like-text {
        font-size: 12px;
    }
    
    .wprg-like-count {
        padding: 2px 6px;
        font-size: 10px;
    }
}

/* Animation de chargement */
.wprg-carousel-item {
    animation: wprgSlideUp 0.5s ease backwards;
}

@keyframes wprgSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wprg-carousel-item:nth-child(1) { animation-delay: 0.05s; }
.wprg-carousel-item:nth-child(2) { animation-delay: 0.1s; }
.wprg-carousel-item:nth-child(3) { animation-delay: 0.15s; }
.wprg-carousel-item:nth-child(4) { animation-delay: 0.2s; }
.wprg-carousel-item:nth-child(5) { animation-delay: 0.25s; }
.wprg-carousel-item:nth-child(6) { animation-delay: 0.3s; }

/* Mode sombre support */
@media (prefers-color-scheme: dark) {
    .wprg-thumbnail-likes,
    .wprg-thumbnail-views {
        background: rgba(0, 0, 0, 0.6);
    }
}