/* WooCommerce Product Gallery Slider Styles */

.wc-custom-gallery {
    max-width: 100%;
    margin: 0 auto;
    font-family: inherit;
}

/* Главное изображение */
.gallery-main-image {
    position: relative;
    margin-bottom: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
}

.main-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Квадратное соотношение */
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: opacity 0.4s ease, transform 0.3s ease;
    opacity: 1;
}

/* Состояния загрузки */
.main-gallery-image.loading {
    opacity: 0.7;
}

.main-gallery-image.fade-out {
    opacity: 0;
}

.main-gallery-image.fade-in {
    opacity: 1;
}

/* Стрелки на главном изображении */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #0D40C5;
    border: 1px solid #0D40C5;
    border-radius: 100px !important;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0 !important;
}

.gallery-arrow:hover {
    background: #0D40C5 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-arrow.gallery-arrow-prev {
    background: transparent;
    left: 20px;
    border-radius: 100px;
}

.gallery-arrow.gallery-arrow-prev:hover svg path {
    fill: #FFFFFF;
}

.gallery-arrow.gallery-arrow-prev:focus,.gallery-arrow.gallery-arrow-next:focus  {
    background: #0D40C5;
}

.gallery-arrow.gallery-arrow-prev:focus svg path {
    fill: #FFFFFF;
}

.gallery-arrow-next {
    right: 20px;
}

.gallery-arrow svg {
    color: #333;
    width: 24px;
    height: 24px;
}

/* Блок миниатюр */
.gallery-thumbnails {
    position: relative;
}

.thumbnails-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 10px;
    aspect-ratio: 2 / 1;
}

.thumbnail-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    background: #f8f8f8;
    height: 350px;
}

.thumbnail-item:hover {
    border-color: #0D40C5;
}

.thumbnail-item.active {
    border-color: #0D40C5;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: opacity 0.3s ease;
}

/* Плавная загрузка миниатюр */
.thumbnail-item.loading img {
    opacity: 0.6;
}

.thumbnail-item img.loaded {
    opacity: 1;
}

/* Навигация по миниатюрам (если больше 4 изображений) */
.thumbnails-navigation {
    position: absolute;
    top: 50%;
    right: -50px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thumb-nav-prev,
.thumb-nav-next {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    color: #333;
}

.thumb-nav-prev:hover,
.thumb-nav-next:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Скрытые данные */
.gallery-data {
    display: none;
}

/* Адаптивность */
@media (max-width: 768px) {
    .gallery-arrow {
        width: 40px;
        height: 40px;
    }
    
    .gallery-arrow-prev {
        left: 10px;
    }
    
    .gallery-arrow-next {
        right: 10px;
    }
    
    .gallery-arrow svg {
        width: 20px;
        height: 20px;
    }
    
    .thumbnails-container {
        gap: 8px;
    }
    
    .thumbnails-navigation {
        right: -40px;
    }
    
    .thumb-nav-prev,
    .thumb-nav-next {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .gallery-arrow {
        width: 35px;
        height: 35px;
    }
    
    .gallery-arrow svg {
        width: 18px;
        height: 18px;
    }
    
    .thumbnails-container {
        gap: 6px;
    }
    
    .thumbnail-item {
        border-width: 2px;
    }
}

/* Загрузка изображений */
.main-gallery-image.loading {
    opacity: 0.7;
}

.main-gallery-image.fade-out {
    opacity: 0;
}

.main-gallery-image.fade-in {
    opacity: 1;
}

/* Индикатор загрузки */
.gallery-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-loading-indicator.visible {
    opacity: 1;
}

.gallery-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wc-custom-gallery {
    animation: fadeIn 0.5s ease;
}
