/**
 * Styles pour le widget Galerie Variations Product
 */

/* Container principal */
.eecb-gallery-widget {
    width: 100%;
    position: relative;
}

.eecb-gallery-wrapper {
    display: flex;
    gap: 20px;
}

/* Dispositions selon la position des miniatures */
.eecb-gallery-wrapper.eecb-gallery-bottom {
    flex-direction: column;
}

.eecb-gallery-wrapper.eecb-gallery-left {
    flex-direction: row;
}

.eecb-gallery-wrapper.eecb-gallery-left .eecb-gallery-thumbnails-wrapper {
    order: -1;
}

.eecb-gallery-wrapper.eecb-gallery-right {
    flex-direction: row;
}

/* Image principale */
.eecb-gallery-main-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.eecb-gallery-main-image {
    width: 100%;
    height: 500px;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    transition: all 0.3s ease;
}

.eecb-gallery-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

/* Effet de zoom au hover */
.eecb-gallery-main-image.zoom-enabled:hover img {
    transform: scale(1.05);
}

/* Conteneur des miniatures */
.eecb-gallery-thumbnails-wrapper {
    flex-shrink: 0;
}

.eecb-gallery-thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Orientation des miniatures selon la position */
.eecb-gallery-left .eecb-gallery-thumbnails-wrapper,
.eecb-gallery-right .eecb-gallery-thumbnails-wrapper {
    max-width: 100px;
}

.eecb-gallery-left .eecb-gallery-thumbnails,
.eecb-gallery-right .eecb-gallery-thumbnails {
    flex-direction: column;
}

.eecb-gallery-left .eecb-gallery-variants-separator,
.eecb-gallery-right .eecb-gallery-variants-separator {
    writing-mode: vertical-lr;
    text-orientation: mixed;
    height: auto;
    width: 100%;
    border-top: none;
    border-left: 1px solid #e0e0e0;
    padding: 5px 0 10px 5px;
    margin: 10px 0;
}

.eecb-gallery-bottom .eecb-gallery-thumbnails {
    flex-direction: row;
    justify-content: center;
}

/* Séparateur de variantes */
.eecb-gallery-variants-separator {
    width: 100%;
    margin: 20px 0 10px 0;
    padding: 10px 0 5px 0;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.eecb-gallery-variants-separator span {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Groupe de miniatures */
.eecb-gallery-images,
.eecb-gallery-variants {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Miniatures */
.eecb-gallery-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: #f5f5f5;
}

/* Wrapper de variante avec prix */
.eecb-variant-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

/* Style spécial pour les variantes */
.eecb-variant-thumbnail {
    position: relative;
}

.eecb-variant-thumbnail::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #2271b1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.eecb-variant-thumbnail:hover::after {
    opacity: 1;
}

/* Prix de la variante */
.eecb-variant-price {
    font-size: 13px;
    font-weight: 600;
    color: #2271b1;
    text-align: center;
    padding: 2px 5px;
    background: rgba(34, 113, 177, 0.08);
    border-radius: 4px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.eecb-variant-wrapper:hover .eecb-variant-price {
    background: rgba(34, 113, 177, 0.15);
    transform: translateY(-2px);
}

/* Ajuster pour les positions latérales */
.eecb-gallery-left .eecb-variant-wrapper,
.eecb-gallery-right .eecb-variant-wrapper {
    width: 100%;
}

.eecb-gallery-left .eecb-variant-price,
.eecb-gallery-right .eecb-variant-price {
    font-size: 12px;
    padding: 1px 3px;
}

.eecb-gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.eecb-gallery-thumbnail:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.eecb-gallery-thumbnail.active {
    opacity: 1;
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34, 113, 177, 0.3);
}

/* Animation de changement d'image */
.eecb-gallery-image-changing .eecb-gallery-image {
    opacity: 0.5;
}

.eecb-gallery-image-fade-in {
    animation: eecb-fade-in 0.4s ease-out;
}

@keyframes eecb-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Indicateur de chargement */
.eecb-gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.eecb-gallery-loading::after {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: eecb-spin 1s linear infinite;
}

@keyframes eecb-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mode zoom */
.eecb-gallery-zoomed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.eecb-gallery-zoomed img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

/* Bouton fermer pour le zoom */
.eecb-gallery-zoom-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 24px;
    transition: all 0.3s ease;
}

.eecb-gallery-zoom-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Navigation du zoom */
.eecb-gallery-zoom-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 24px;
    transition: all 0.3s ease;
}

.eecb-gallery-zoom-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.eecb-gallery-zoom-prev {
    left: 20px;
}

.eecb-gallery-zoom-next {
    right: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .eecb-gallery-wrapper {
        flex-direction: column !important;
    }
    
    .eecb-gallery-main-image {
        height: 400px;
    }
    
    .eecb-gallery-thumbnails {
        flex-direction: row !important;
        max-width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    
    .eecb-gallery-thumbnail {
        flex-shrink: 0;
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .eecb-gallery-main-image {
        height: 300px;
        border-radius: 8px;
    }
    
    .eecb-gallery-thumbnail {
        width: 60px;
        height: 60px;
    }
}

/* Mode édition Elementor */
.elementor-editor-active .eecb-gallery-widget {
    min-height: 400px;
}

.elementor-widget-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ccc;
    font-size: 50px;
}