/**
 * Variation Swatches CSS
 * 
 * @package TTStoreBooster\Modules\VariationSwatches
 * @version 1.0.0
 */

/* Swatches Container */
.ttsb-variation-swatches {
    margin-bottom: 20px;
}
.ttsb-swatch-label {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
}
.ttsb-swatch-label .ttsb-selected-value {
    font-weight: 400;
    color: #666;
}
.ttsb-swatch-items {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Individual Swatch Item */
.ttsb-swatch-item {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}
.ttsb-swatch-item:hover {
    transform: translateY(-2px);
}
.ttsb-swatch-item.selected {
    opacity: 1;
}
.ttsb-swatch-item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}


/* Image Swatches */
.ttsb-swatch-items .ttsb-swatch-item span.ttsb-swatch-image{
    display: block;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    box-shadow: inset 0px 0px 0px 3px #ffffff;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}
.ttsb-swatch-items .ttsb-swatch-item span.ttsb-swatch-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    padding: 2px;
}
/* Hide button text when image swatch is present */
.ttsb-swatch-items .ttsb-swatch-item:has(.ttsb-swatch-image) .ttsb-swatch-button,
.ttsb-swatch-items .ttsb-swatch-item .ttsb-swatch-image ~ .ttsb-swatch-button {
    display: none !important;
}
.ttsb-swatch-items .ttsb-swatch-item.selected span.ttsb-swatch-image,
.ttsb-swatch-items .ttsb-swatch-item:hover span.ttsb-swatch-image {
    border-color: #333;
}
.woocommerce-js div.product form.cart .variations{
    border: none !important;
}
.variations_form .variations th.label{
    display: none !important;
}

/* Color Swatches */
.ttsb-swatch-color .ttsb-swatch-items .ttsb-swatch-item span{
    display: block;
    width: 32px;
    height: 32px;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    box-shadow: inset 0px 0px 0px 3px #ffffff;
}
.ttsb-swatch-color .ttsb-swatch-items .ttsb-swatch-item.selected span,
.ttsb-swatch-color .ttsb-swatch-items .ttsb-swatch-item:hover span{
    border-color: #333;
}
.ttsb-swatch-color .ttsb-swatch-items .ttsb-swatch-item.disabled span{
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button/Label Swatches */
.ttsb-swatch-button .ttsb-swatch-items .ttsb-swatch-item span{
    padding: 2px;
    font-size: 13px;
    border-radius: 30px;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}
.ttsb-swatch-button .ttsb-swatch-items .ttsb-swatch-item.selected span,
.ttsb-swatch-button .ttsb-swatch-items .ttsb-swatch-item:hover span{
    border-color: #333;
}

/* Shape Circle */
.ttsb-swatch-shape-circle .ttsb-swatch-items .ttsb-swatch-item span,
.ttsb-swatch-shape-circle .ttsb-swatch-items .ttsb-swatch-item span.ttsb-swatch-image img{
    border-radius: 50% !important;
}

/* Shape Square */
.ttsb-swatch-shape-square .ttsb-swatch-items .ttsb-swatch-item span{
    border-radius: 4px !important;
}


/* Size Variations */
.ttsb-swatch-size-small .ttsb-swatch-items .ttsb-swatch-item span{
    width: 30px;
    height: 30px;
}
.ttsb-swatch-size-small .ttsb-swatch-button {
    width: auto;
    min-width: 30px;
    height: 30px;
}
.ttsb-swatch-size-medium .ttsb-swatch-items .ttsb-swatch-item span{
    width: 35px;
    height: 35px;
}
.ttsb-swatch-size-medium .ttsb-swatch-button {
    width: auto;
    min-width: 35px;
    height: 35px;
}
.ttsb-swatch-size-large .ttsb-swatch-items .ttsb-swatch-item span.ttsb-swatch-color {
    width: 45px;
    height: 45px;
}
.ttsb-swatch-size-large .ttsb-swatch-items .ttsb-swatch-item span.ttsb-swatch-image {
    width: 45px;
    height: 45px;
}
.ttsb-swatch-size-large .ttsb-swatch-button {
    width: auto;
    min-width: 45px;
    height: 45px;
}

/* Tooltip */
.ttsb-variation-swatches .ttsb-swatch-item::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--ttsb-tooltip-bg, #333);
    color: var(--ttsb-tooltip-text, #fff);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}
.ttsb-variation-swatches .ttsb-swatch-item::before {
    content: '';
    position: absolute;
    bottom: calc(100% + -2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--ttsb-tooltip-bg, #333);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}
.ttsb-variation-swatches:not(.ttsb-tooltip-disabled) .ttsb-swatch-item:hover::after,
.ttsb-variation-swatches:not(.ttsb-tooltip-disabled) .ttsb-swatch-item:hover::before {
    opacity: 1;
}

.ttsb-variation-swatches.ttsb-tooltip-disabled .ttsb-swatch-item::after,
.ttsb-variation-swatches.ttsb-tooltip-disabled .ttsb-swatch-item::before {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .ttsb-swatch-items {
        gap: 8px;
    }
    
    .ttsb-swatch-color {
        width: 35px;
        height: 35px;
    }
    
    .ttsb-swatch-image {
        width: 45px;
        height: 45px;
    }
    
    .ttsb-swatch-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Reset Button */
.reset_variations {
    margin-top: 10px;
    font-size: 13px;
}