/* ==========================================================================
   Machine Gallery - CSS
   Design épuré et minimaliste
   ========================================================================== */

/* Container principal
   ========================================================================== */

.machine-gallery {
    width: 100%;
    position: relative;
}

/* Cadre principal (663.6px minimum)
   ========================================================================== */

.machine-gallery-main {
    width: 100%;
    min-height: 800px;
    position: relative;
    background: #000;
    overflow: hidden;
}

.machine-gallery-main-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.machine-gallery-slide {
    position: absolute;
    top: -400px;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.machine-gallery-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.machine-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom; 
    display: block;
}

/* Flèches de navigation
   ========================================================================== */

.machine-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    opacity: 0;
}

.machine-gallery-main:hover .machine-gallery-arrow {
    opacity: 1;
}

.machine-gallery-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.machine-gallery-prev {
    left: 20px;
}

.machine-gallery-next {
    right: 20px;
}

.machine-gallery-arrow svg {
    color: #000;
}

/* Compteur
   ========================================================================== */

.machine-gallery-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.machine-gallery-separator {
    opacity: 0.5;
}

/* Miniatures (superposées et centrées)
   ========================================================================== */

.machine-gallery-thumbs {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    max-width: calc(100% - 40px);
}

.machine-gallery-thumbs-container {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    max-width: 100%;
    
    /* Scrollbar minimaliste */
    scrollbar-width: thin;
    scrollbar-color: #000 transparent;
}

.machine-gallery-thumbs-container::-webkit-scrollbar {
    height: 4px;
}

.machine-gallery-thumbs-container::-webkit-scrollbar-track {
    background: transparent;
}

.machine-gallery-thumbs-container::-webkit-scrollbar-thumb {
    background: #000;
}

.machine-gallery-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    background: #f5f5f5;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.machine-gallery-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
}

.machine-gallery-thumb:hover::after {
    background: rgba(0, 0, 0, 0.2);
}

.machine-gallery-thumb.active {
    border-color: #000;
}

.machine-gallery-thumb.active::after {
    background: rgba(0, 0, 0, 0);
}

.machine-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .machine-gallery-main {
        min-height: 400px;
    }
    
    .machine-gallery-arrow {
        width: 40px;
        height: 40px;
    }
    
    .machine-gallery-prev {
        left: 10px;
    }
    
    .machine-gallery-next {
        right: 10px;
    }
    
    .machine-gallery-counter {
        bottom: 10px;
        right: 10px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .machine-gallery-thumbs {
        bottom: 20px;
        max-width: calc(100% - 20px);
    }
    
    .machine-gallery-thumbs-container {
        gap: 8px;
        padding: 8px;
    }
    
    .machine-gallery-thumb {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .machine-gallery-main {
        min-height: 300px;
    }
    
    .machine-gallery-thumb {
        width: 50px;
        height: 50px;
    }
}

/* States et animations
   ========================================================================== */

.machine-gallery-slide.fade-in {
    animation: galleryFadeIn 0.4s ease;
}

@keyframes galleryFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Variante : Si tu veux le cadre avec un ratio fixe (16:9 par exemple)
   ========================================================================== */

/*
.machine-gallery-main {
    aspect-ratio: 16 / 9;
    min-height: 0;
}
*/

/* Variante : Fond blanc au lieu de noir
   ========================================================================== */

/*
.machine-gallery-main {
    background: #fff;
}

.machine-gallery-slide img {
    object-fit: contain;
}
*/

/* Variante : Images en cover (remplissent tout le cadre)
   ========================================================================== */

/*
.machine-gallery-slide img {
    object-fit: cover;
}
*/