/* Frissonelle Color Groups - CSS */

/* Общие стили */
.fcg-wrapper {
    clear: both;
    width: 100%;
    box-sizing: border-box;
}

/* Grid Mode - под названием товара и ценой */
.fcg-grid-mode {
    margin-top: 8px;
    margin-bottom: 12px;
    min-height: 24px;
}

/* Single Mode - перед формой добавления в корзину */
.fcg-single-mode {
    margin-bottom: 25px;
    margin-top: 15px;
}

.fcg-attr-label-wrapper {
    margin-bottom: 12px;
}

.fcg-label-title {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    color: #333;
    letter-spacing: 0.5px;
}

/* Контейнер свотчей */
.fcg-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Кружок свотча */
.fcg-swatch-circle {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

/* Размер в карточке товара */
.fcg-single-mode .fcg-swatch-circle {
    width: 26px;
    height: 26px;
}

/* Ховер эффекты */
.fcg-swatch-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Активный свотч */
.fcg-swatch-circle.active {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #000000;
    border-color: transparent;
    pointer-events: none;
    cursor: default;
}

/* Спиннер загрузки */
.fcg-swatch-circle.loading {
    pointer-events: none;
    opacity: 0.7;
}

.fcg-swatch-circle.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.5);
    animation: fcg-spin 0.6s linear infinite;
}

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

/* Тултипы */
.fcg-swatch-circle[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000;
    color: #fff;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    animation: fcg-tooltip-fade 0.2s forwards;
    z-index: 1000;
    font-weight: 500;
}

.fcg-swatch-circle[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #000;
    opacity: 0;
    animation: fcg-tooltip-fade 0.2s forwards;
    z-index: 1000;
}

@keyframes fcg-tooltip-fade {
    to {
        opacity: 1;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .fcg-swatch-circle {
        width: 18px;
        height: 18px;
    }
    
    .fcg-single-mode .fcg-swatch-circle {
        width: 22px;
        height: 22px;
    }
    
    .fcg-color-swatches {
        gap: 6px;
    }
}

/* Совместимость с темами */
.woocommerce .products .product .fcg-wrapper {
    margin-top: 5px;
}

.woocommerce .product .fcg-wrapper {
    clear: both;
}

/* Галерея - скрытые элементы для данных */
.fcg-gallery-data {
    display: none;
}

/* Состояние disabled для товаров не в наличии */
.fcg-swatch-circle.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.fcg-swatch-circle.out-of-stock:hover {
    transform: none;
    box-shadow: none;
}

/* Анимация смены изображения */
.fcg-image-transition {
    transition: opacity 0.3s ease;
}

.fcg-image-loading {
    opacity: 0.5;
}

/* Для совместимости с WooCommerce галереей */
.woocommerce-product-gallery__image.fcg-updating img {
    transition: opacity 0.3s ease;
}

.woocommerce-product-gallery__image.fcg-updating img.fcg-loading {
    opacity: 0.5;
}

/* Отключаем ховер-эффект темы Moderno для товаров со свотчами */
.fcg-wrapper ~ .c-product-grid__thumb-wrap:hover .c-product-grid__thumb--base,
.fcg-wrapper ~ .c-product-grid__thumb-wrap:hover .c-product-grid__thumb--hover {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Включаем ховер только при наведении на изображение */
.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb:hover ~ .c-product-grid__thumb--base,
.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb:hover ~ .c-product-grid__thumb--hover,
.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb--base:hover,
.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb--hover:hover {
    opacity: 0 !important;
    visibility: hidden !important;
}

.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb:hover ~ .c-product-grid__thumb--hover,
.fcg-wrapper ~ .c-product-grid__thumb-wrap .c-product-grid__thumb--base:hover ~ .c-product-grid__thumb--hover {
    opacity: 1 !important;
    visibility: visible !important;
}