/* Carrousel 3D effect */
.carousel-3d-modern {
    perspective: 1800px;
    width: 100%;
    height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-top: 0;
    /* Optimisations tactiles */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
     }

.carousel-stage {
    position: relative;
    width: 100%;
    height: 380px;
    display: flex;
    justify-content: center;
    transform-style: preserve-3d;
    overflow: visible;
    /* Variables pour le carousel coverflow */
    --card-width: 320px;
    --card-height: 240px;
    /* Optimisations tactiles */
    touch-action: manipulation;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
   
}

.carousel-card {
    position: absolute;
    width: var(--card-width, 320px);
    height: var(--card-height, 240px);
    background: #232323;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(1, 48, 32, 0.5);
    /* Transition optimisée pour la fluidité tactile */
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0.75;
    transform-origin: center center;
    z-index: 1;
    overflow: hidden;
    cursor: pointer;
    /* Positionnement centré */
    left: 50%;
    top: 40%;
    margin-left: calc(var(--card-width, 320px) / -2);
    margin-top: calc(var(--card-height, 240px) / -2);
    /* Position par défaut - côté droit */
    transform: translateX(600px) rotateY(-60deg) scale(0.7);
    /*tactiles  */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform, opacity, z-index;
    /* Accélération matérielle */
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    /* Optimisations supplémentaires pour mobile */
    -webkit-perspective: 1000px;
    perspective: 1000px;
    contain: layout style paint;
}

/* Carte centrale  */
.carousel-card.center {
    transform: translateX(0) rotateY(0deg) scale(1.4);
    opacity: 1;
    z-index: 10;
    /* Teintes harmonisées avec la galerie */
    box-shadow: 0 0 60px rgba(2, 131, 92, 0.6), 0 30px 100px rgba(16, 16, 16, 0.88), 0 0 32px 0 rgba(0, 212, 255, 0.10);
    border: 1px solid #02835d;
}

/* animations tactiles*/
.carousel-3d-modern.touch-active {
    transition: transform 0.15s ease-out;
}

.carousel-3d-modern.swipe-feedback {
    transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/*  animations mobile */
@media (max-width: 768px) {
    .carousel-card {
        transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    }
    
    .carousel-3d-modern {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Masquer les flèches sur tablettes */
    .carousel-controls {
        display: none !important;
    }
}

/* Masquer les flèches sur mobile et petites tablettes */
@media (max-width: 1024px) {
    .carousel-controls {
        display: none !important;
    }
}

/* Flèches visibles uniquement sur desktop */
@media (min-width: 1025px) {
    .carousel-controls {
        display: flex !important;
    }
    
    .carousel-btn:hover {
        background: rgba(0, 255, 136, 0.2);
        border-color: rgba(0, 255, 136, 0.6);
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
        opacity: 1;
    }
}

/* Réduction du motion pour les utilisateurs qui le préfèrent */
@media (prefers-reduced-motion: reduce) {
    .carousel-card {
        transition: all 0.2s ease-in-out;
    }
    
    .carousel-3d-modern.touch-active,
    .carousel-3d-modern.swipe-feedback {
        transition: none;
    }
}

/* Positions coverflow - effet traditionnel */
.carousel-card.left {
    transform: translateX(-280px) rotateY(45deg) scale(0.9);
    opacity: 0.85;
    z-index: 5;
}

.carousel-card.right {
    transform: translateX(280px) rotateY(-45deg) scale(0.9);
    opacity: 0.85;
    z-index: 5;
}

/* Cartes plus éloignées */
.carousel-card.far-left {
    transform: translateX(-480px) rotateY(55deg) scale(0.75);
    opacity: 0.7;
    z-index: 3;
}

.carousel-card.far-right {
    transform: translateX(480px) rotateY(-55deg) scale(0.75);
    opacity: 0.7;
    z-index: 3;
}

/* Cartes très éloignées (presque cachées) */
.carousel-card.hidden-left {
    transform: translateX(-600px) rotateY(60deg) scale(0.6);
    opacity: 0.55;
    z-index: 1;
}

.carousel-card.hidden-right {
    transform: translateX(600px) rotateY(-60deg) scale(0.6);
    opacity: 0.55;
    z-index: 1;
}

/* Image et contenu */
.video-thumb {
    width: 100%;
    height: 90%;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    display: block;
}

.card-info {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.7rem;
    
    border-radius: 0 0 12px 12px;
    padding: 8px 8px 8px 8px;
    backdrop-filter: blur(4px);
    box-sizing: border-box;
}

/* Contrôles navigation */
.carousel-controls {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    z-index: 20;
    padding: 0 20px;
    pointer-events: none;
}

.carousel-btn {
    background: none;
    border: none;
    color: #00ff88;
    font-size: 1.7rem;
    padding: 10px 14px;
    cursor: pointer;
    
    transition: all 0.3s ease;
    
    pointer-events: auto;
    opacity: 0.7;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Optimisations tactiles */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    min-width: 44px;
    min-height: 44px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.carousel-btn:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.6);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    opacity: 1;
}

/* Pagination */
.carousel-pagination {
    position: relative;
    margin-top: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
    z-index: 20;
}

.carousel-dot {
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.4s ease;
    /* Optimisations tactiles */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    min-width: 9px;
    min-height: 9px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding: 4px;
}

.carousel-dot.active {
    background: #00ff88;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.7);
    transform: scale(1.4);
}

.carousel-dot:hover {
    background: rgba(0, 255, 136, 0.7);
    transform: scale(1.2);
}

/* Overlay pour play button */
.carousel-card .card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: 12px;
}

/* Bouton play visible par défaut sur la carte centrale */
.carousel-card.center .card-overlay {
    opacity: 1;
    pointer-events: auto;
}

.carousel-card.center:hover .card-overlay {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0,0,0,0.4);
}

.play-button {
    font-size: 1.6rem;
    color: #00ff88;
    background: rgba(0,0,0,0.8);
    border-radius: 50%;
    padding: 10px 12px 10px 15px; /* Ajustement pour centrer le triangle */
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 255, 136, 0.4);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Icône play personnalisée avec CSS */
.play-button::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 12px solid #00ff88;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    margin-left: 2px; /* Centrage optique */
    font-size: 0; /* Supprime le contenu texte */
}

.carousel-card.center:hover .play-button {
    background: rgba(0,255,136,0.2);
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
    border-color: rgba(0, 255, 136, 0.8);
}

.carousel-card.center:hover .play-button::before {
    border-left-color: #ffffff;
}

/* Animation d'entrée plus simple */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 0.4;
        transform: translateY(0) scale(1);
    }
}

.carousel-card {
    animation: cardSlideIn 0.8s ease-out;
}

/* Ajustements responsives */
@media (max-width: 768px) {
    .carousel-3d-modern {
        height: 400px;
        perspective: 1400px;
    }
    
    .carousel-stage {
        height: 320px;
        --card-width: 280px;
        --card-height: 200px;
    }
    
    .carousel-card.center {
        transform: translateX(0) rotateY(0deg) scale(1.25);
    }
    
    .carousel-card.left {
        transform: translateX(-220px) rotateY(40deg) scale(0.85);
        opacity: 0.8;
    }
    
    .carousel-card.right {
        transform: translateX(220px) rotateY(-40deg) scale(0.85);
        opacity: 0.8;
    }
    
    .carousel-card.far-left {
        transform: translateX(-380px) rotateY(50deg) scale(0.7);
        opacity: 0.65;
    }
    
    .carousel-card.far-right {
        transform: translateX(380px) rotateY(-50deg) scale(0.7);
        opacity: 0.65;
    }
    
    .carousel-controls {
        display: none !important; /* Masquer les flèches sur tablettes */
    }
    
    .carousel-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .carousel-3d-modern {
        perspective: 1200px;
    }
    
    .carousel-stage {
        height: 280px;
        --card-width: 240px;
        --card-height: 170px;
    }
    
    .carousel-card.center {
        transform: translateX(0) rotateY(0deg) scale(1.2);
    }
    
    .carousel-card.left {
        transform: translateX(-180px) rotateY(35deg) scale(0.8);
        opacity: 0.75;
    }
    
    .carousel-card.right {
        transform: translateX(180px) rotateY(-35deg) scale(0.8);
        opacity: 0.75;
    }
    
    .carousel-card.far-left,
    .carousel-card.far-right {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-400px) scale(0.5);
    }
    
    .carousel-card.hidden-left,
    .carousel-card.hidden-right {
        opacity: 0;
        pointer-events: none;
        transform: translateX(400px) scale(0.5);
    }
    
    .carousel-controls {
        display: none !important; /* Masquer les flèches sur mobile */
    }
    
    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .play-button {
        width: 45px;
        height: 45px;
    }
}

/* Lightbox Modal pour vidéos */

/* Modal Vidéo - Design en box overlay */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
  background-color: #1a1a1a;
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 60px 20px;
    box-sizing: border-box;
}

.video-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: relative;
    width: 85%;
    max-width: 900px;
    height: auto;
  
    border-radius: 16px;
    overflow: visible;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.3), 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    z-index: 2;
    /* Empêcher le modal de prendre tout l'écran */
    margin: auto;
}

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

.modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    
    position: relative;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    /* Forcer un ratio 16:9 */
    aspect-ratio: 16/9;
    width: 100%;
}

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    pointer-events: auto;
}

.modal-video {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
    outline: none;
    border-radius: 16px 16px 0 0;
}

.modal-close {
    position: fixed;
    top: 50px;
    right: 95px;
    z-index: 10001;
    border: 2px solid #02835D;
    background: rgba(0, 30, 20, 0.92);
    color: #028f65; 
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(0, 255, 136, 0.15);
    transition: all 0.2s;
    padding: 0;
}

@media (max-width: 768px) {
    .modal-close {
        top: 16px;
        right: 16px;
        width: 38px;
        height: 38px;
        font-size: 1.3rem;
    }
}

.modal-close:hover {
    background: rgba(0, 255, 136, 0.13);
    color: #00ff88;
    transform: scale(1.08);
    box-shadow: 0 0 18px #00ff88, 0 6px 25px rgba(0,255,136,0.18);
    border-color: #00ff88;
}

/* Adapter la couleur de l'icône SVG au hover */

.modal-close:hover svg line {
    stroke: #00ff88;
}

/* Animations du modal */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

.video-modal.opening .modal-container {
    animation: modalFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.video-modal.closing .modal-container {
    animation: modalFadeOut 0.3s ease-in;
}

/* États focus pour accessibilité */
.modal-close:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

/* Empêcher le scroll du body quand modal ouvert */
body.modal-open {
    overflow: hidden;
}

/* Responsive modal */
@media (max-width: 768px) {
    .video-modal {
        padding: 30px;
    }
    
    .modal-container {
        width: 90%;
        max-width: none;
    }
    
    .modal-close {

        right: 0px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .video-modal {
        padding: 15px;
    }
    
    .modal-container {
        width: 95%;
        border-radius: 12px;
    }
    
    .modal-close {
        
        right: 5px;
        width: 36px;
        height: 36px;
      
    }
    
    .modal-body {
        border-radius: 12px 12px 0 0;
    }
    
    .modal-video {
        border-radius: 12px 12px 0 0;
    }
}

/* Modal Vidéo */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.video-modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
   
    cursor: pointer;
   
    z-index: 1;
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: 675px; /* 16:9 ratio */
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.3), 0 20px 60px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 136, 0.2);
    display: flex;
    flex-direction: column;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    z-index: 2;
}

.video-modal.active .modal-container {
    transform: scale(1);
    /* Transition plus rapide pour l'affichage */
    transition: transform 0.2s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(0, 255, 136, 0.1);
}

.modal-title {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* supprimé doublon modal-close, hover déjà géré plus haut */

.modal-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #000;
}

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
    aspect-ratio: 16/9;
    /* S'assurer que le container ne bloque pas les événements */
    pointer-events: auto;
}

.modal-video {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    /* Permettre l'interaction avec l'iframe */
    pointer-events: auto;
    /* S'assurer que l'iframe peut recevoir le focus */
    outline: none;
}

/* Animations d'ouverture et fermeture */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

.video-modal.opening .modal-container {
    animation: modalFadeIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.video-modal.closing .modal-container {
    animation: modalFadeOut 0.3s ease-in;
}

/* Loading state */
.modal-video::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(0, 255, 136, 0.3);
    border-top-color: #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

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

/* Responsive modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        height: 85%;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        width: 98%;
        height: 80%;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
    }
}

.modal-close:focus {
    outline: 2px solid #00ff88;
    outline-offset: 2px;
}

body.modal-open {
    overflow: hidden;
}
