/* ==========================================================================
   BLOC 1 : CONTAINER
   ========================================================================== */
.spd-gallery-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: inherit;
    box-sizing: border-box;
}
.spd-gallery-container * { box-sizing: border-box; }


/* ==========================================================================
   BLOC 2 : SCÈNE PRINCIPALE
   ========================================================================== */
.spd-stage {
    width: 100%;
    position: relative;
    background: #fff;
    border: 0px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spd-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s ease;
    z-index: 1; 
}


/* ==========================================================================
   BLOC 3 : BADGES DYNAMIQUES
   ========================================================================== */
.spd-badges-layer {
    position: absolute;
    top: 15px; 
    left: 15px;
    z-index: 100 !important; 
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    pointer-events: none;
}

.spd-badge {
    display: inline-block !important; 
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    line-height: 1;
    visibility: visible !important; 
    opacity: 1 !important;
}

.spd-badge-stock.spd-b-in { background-color: #27ae60; }   
.spd-badge-stock.spd-b-out { background-color: #c0392b; }  
.spd-badge-stock.spd-b-back { background-color: #f39c12; } 
.spd-badge-promo { background-color: #e74c3c; font-size: 13px; }


/* ==========================================================================
   BLOC 4 : CARROUSEL PRINCIPAL
   ========================================================================== */
.spd-carousel-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: auto;
}

.spd-carousel-wrapper.spd-hide-nav .spd-arrow {
    visibility: hidden;
    pointer-events: none;
}

.spd-track-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 4px 0; 
}

.spd-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    width: 100%; 
}

.spd-thumb {
    flex: 0 0 33.3333%;
    width: 33.3333%;
    max-width: 33.3333%;
    padding: 0 6px;
    cursor: pointer;
    user-select: none;
    position: relative;
    outline: none !important;
}

/* Force la suppression de l'outline sur le focus */
.spd-thumb:focus, .spd-thumb:active {
    outline: none !important;
}

.spd-thumb-inner {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 1px solid #fff;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}

.spd-thumb-inner img { width: 100%; height: 100%; object-fit: contain; display: block; }
.spd-thumb-inner:hover { border-color: #999; }

.spd-thumb.is-active .spd-thumb-inner {
    border-color: #000;
    box-shadow: 0 0 0 1px #000 inset;
}

.spd-thumb.spd-out-of-stock .spd-thumb-inner { opacity: 0.6; }


/* ==========================================================================
   BLOC 5 : ÉLÉMENTS COMMUNS (FLÈCHES)
   ========================================================================== */
.spd-arrow {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    border: 1px solid #ddd; 
    background: #fff; 
    border-radius: 50%;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    color: #333; 
    transition: all 0.2s;
    padding: 0;
    outline: none !important;
}
.spd-arrow:hover { background: #222; color: #fff; border-color: #222; }

/* Style du SVG */
.spd-arrow svg, .syn-var-arrow svg { 
    width: 20px; 
    height: 20px; 
    stroke: currentColor; 
    fill: none; 
    display: block; 
}


/* ==========================================================================
   BLOC 6 : TUILES VARIATIONS (ANTI-FLIP FLAP)
   ========================================================================== */
.syn-var-gallery-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
    
    /* FIX : Masqué par défaut le temps du calcul JS */
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* Classe ajoutée par JS une fois le calcul fini */
.syn-var-gallery-container.is-ready {
    opacity: 1;
}

.syn-var-viewport { flex-grow: 1; overflow: hidden; }
.syn-var-track { display: flex; gap: 15px; transition: transform 0.4s ease-out; }

.syn-var-tile {
    flex-shrink: 0;
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    gap: 10px;
    outline: none !important;
}

.syn-var-tile.spd-out-of-stock { opacity: 0.6; }

.syn-var-tile-img {
    width: 100%; 
    aspect-ratio: 1 / 1;
    border: 1px solid #eee; 
    border-radius: 8px;
    overflow: hidden; 
    position: relative; 
    transition: border-color 0.2s, box-shadow 0.2s;
}

.syn-tile-badges { top: 10px; left: 10px; }
.syn-tile-badges .spd-badge { font-size: 11px; padding: 4px 8px; }

.syn-var-tile-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.syn-var-tile-info { text-align: center; width: 100%; }

/* TITRE H3 */
.syn-var-title { 
    font-size: 15px !important; 
    font-weight: 600; 
    color: #333 !important; 
    margin: 8px 0 0 0; 
    line-height: 1.3;
    text-transform: capitalize;
    display: block !important;
    visibility: visible !important;
    z-index: 10;
}

.syn-var-tile.is-active .syn-var-tile-img {
    border: 2px solid #000; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.syn-var-arrow {
    flex: 0 0 40px; width: 40px; height: 40px;
    border: 1px solid #ccc; background: #fff; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; z-index: 2;
    outline: none !important;
}
.syn-var-arrow:hover { border-color: #000; background: #000; color: #fff; }

/* ==========================================================================
   BLOC 1 : CONTAINER
   ========================================================================== */
.spd-gallery-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    font-family: inherit;
    box-sizing: border-box;
}
.spd-gallery-container * { box-sizing: border-box; }


/* ==========================================================================
   BLOC 2 : SCÈNE PRINCIPALE
   ========================================================================== */
.spd-stage {
    width: 100%;
    position: relative;
    background: #fff;
    border: 0px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.spd-main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.2s ease;
    z-index: 1; 
}

/* BOUTON DECLENCHEUR ZOOM */
.spd-zoom-trigger {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.spd-zoom-trigger:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}


/* ==========================================================================
   BLOC 3 : BADGES DYNAMIQUES
   ========================================================================== */
.spd-badges-layer {
    position: absolute;
    top: 15px; 
    left: 15px;
    z-index: 100 !important; 
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    pointer-events: none;
}

.spd-badge {
    display: inline-block !important; 
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    line-height: 1;
    visibility: visible !important; 
    opacity: 1 !important;
}

.spd-badge-stock.spd-b-in { background-color: #27ae60; }   
.spd-badge-stock.spd-b-out { background-color: #c0392b; }  
.spd-badge-stock.spd-b-back { background-color: #f39c12; } 
.spd-badge-promo { background-color: #e74c3c; font-size: 13px; }


/* ==========================================================================
   BLOC 4 : CARROUSEL PRINCIPAL
   ========================================================================== */
.spd-carousel-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: auto;
}

.spd-carousel-wrapper.spd-hide-nav .spd-arrow {
    visibility: hidden;
    pointer-events: none;
}

.spd-track-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 4px 0; 
}

.spd-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    width: 100%; 
}

.spd-thumb {
    flex: 0 0 33.3333%;
    width: 33.3333%;
    max-width: 33.3333%;
    padding: 0 6px;
    cursor: pointer;
    user-select: none;
    position: relative;
    outline: none !important;
}

.spd-thumb:focus, .spd-thumb:active {
    outline: none !important;
}

.spd-thumb-inner {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 1px solid #fff;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
}

.spd-thumb-inner img { width: 100%; height: 100%; object-fit: contain; display: block; }
.spd-thumb-inner:hover { border-color: #999; }

.spd-thumb.is-active .spd-thumb-inner {
    border-color: #000;
    box-shadow: 0 0 0 1px #000 inset;
}

.spd-thumb.spd-out-of-stock .spd-thumb-inner { opacity: 0.6; }


/* ==========================================================================
   BLOC 5 : ÉLÉMENTS COMMUNS (FLÈCHES)
   ========================================================================== */
.spd-arrow {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    border: 1px solid #ddd; 
    background: #fff; 
    border-radius: 50%;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    color: #333; 
    transition: all 0.2s;
    padding: 0;
    outline: none !important;
}
.spd-arrow:hover { background: #222; color: #fff; border-color: #222; }

.spd-arrow svg, .syn-var-arrow svg { 
    width: 20px; 
    height: 20px; 
    stroke: currentColor; 
    fill: none; 
    display: block; 
}


/* ==========================================================================
   BLOC 6 : TUILES VARIATIONS
   ========================================================================== */
.syn-var-gallery-container {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
    position: relative;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.syn-var-gallery-container.is-ready {
    opacity: 1;
}

.syn-var-viewport { flex-grow: 1; overflow: hidden; }
.syn-var-track { display: flex; gap: 15px; transition: transform 0.4s ease-out; }

.syn-var-tile {
    flex-shrink: 0;
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    gap: 10px;
    outline: none !important;
}

.syn-var-tile.spd-out-of-stock { opacity: 0.6; }

.syn-var-tile-img {
    width: 100%; 
    aspect-ratio: 1 / 1;
    border: 1px solid #eee; 
    border-radius: 8px;
    overflow: hidden; 
    position: relative; 
    transition: border-color 0.2s, box-shadow 0.2s;
}

.syn-tile-badges { top: 10px; left: 10px; }
.syn-tile-badges .spd-badge { font-size: 11px; padding: 4px 8px; }

.syn-var-tile-img img { width: 100%; height: 100%; object-fit: contain; display: block; }

.syn-var-tile-info { text-align: center; width: 100%; }

.syn-var-title { 
    font-size: 15px !important; 
    font-weight: 600; 
    color: #333 !important; 
    margin: 8px 0 0 0; 
    line-height: 1.3;
    text-transform: capitalize;
    display: block !important;
    visibility: visible !important;
    z-index: 10;
}

.syn-var-tile.is-active .syn-var-tile-img {
    border: 2px solid #000; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.syn-var-arrow {
    flex: 0 0 40px; width: 40px; height: 40px;
    border: 1px solid #ccc; background: #fff; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; z-index: 2;
    outline: none !important;
}
.syn-var-arrow:hover { border-color: #000; background: #000; color: #fff; }


/* ==========================================================================
   OVERLAY LIGHTBOX (ZOOM FULLSCREEN)
   ========================================================================== */
.spd-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.spd-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.spd-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(255 255 255 / 66%);
}

.spd-lightbox-close {
    position: absolute;
    top: 20px;
    right: 25px;
    z-index: 1000001;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease;
}
.spd-lightbox-close:hover {
    transform: scale(1.2);
}

.spd-lightbox-counter {
    position: absolute;
    top: 25px;
    left: 25px;
    z-index: 1000001;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
        background: rgba(0, 0, 0, 0.6);
    padding: 13px;
}

.spd-lightbox-caption {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000001;
    color: #fff;
    font-size: 15px;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
}

.spd-lightbox-content {
    position: relative;
    z-index: 1000000;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spd-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
}

.spd-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000001;
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    background: rgba(0, 0, 0, 0.6) !important;
    padding: 10px;
}
.spd-lightbox-arrow:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-50%) scale(1) !important;
}
.spd-lightbox-arrow svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
}
.spd-lb-prev { left: 20px; }
.spd-lb-next { right: 20px; }

@media (max-width: 768px) {
    .spd-lightbox-arrow {
        width: 40px;
        height: 40px;
    }
    .spd-lb-prev { left: 10px; }
    .spd-lb-next { right: 10px; }
}