/* Swatch slider vertical layout */
.woo-swatches-splide-wrapper.is-vertical .woo-swatches-splide-layout {
    display: flex;
    align-items: stretch;
}

.woo-swatches-splide-thumbs-col {
    width: 80px;
    flex-shrink: 0;
}

.woo-swatches-splide-thumbs {
    height: 100%;
}

.woo-swatches-splide-main-col {
    flex: 1;
    min-width: 0;
}

.woo-swatches-splide-thumbs .splide__track {
    height: 100%;
}

.woo-swatches-splide-thumbs .splide__slide img,
.woo-swatches-splide-main .splide__slide img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .woo-swatches-splide-wrapper.is-vertical .woo-swatches-splide-layout {
        flex-direction: column;
    }

    .woo-swatches-splide-thumbs-col {
        width: 100%;
        order: 2;
    }

    .woo-swatches-splide-main-col {
        order: 1;
    }
}
/* Swatch Wrapper */
/* Hide default label column from variations table */
table.variations th.label,
table.variations td.label {
    display: none !important;
}

.woo-swatch-control-wrapper {
    margin-bottom: 40px;
}

.woo-swatch-label-info {
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.woo-swatch-selected-value {
    font-weight: 400;
}

.woo-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 768px) {
    .woo-swatches:has(.woo-swatch-item.type-label) {
        gap: 0px;
    }
}

/* Swatch Item Common */
.woo-swatch-item {
    cursor: pointer;
    border: 1px solid #919191;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    pointer-events: auto;
}

.woo-swatch-item:hover {
    border-color: #253746;
}

.woo-swatch-item.type-label.disabled:hover::after{
    background: #253746; 
}

.woo-swatch-item.selected {
    border-color: #253746;
}

.woo-swatch-item.disabled {
    cursor: pointer;
    position: relative;
    overflow: hidden; /* Ensure cross stays within rounded corners if any */
}
.woo-swatch-item.type-image.disabled:hover {
    border-color: #253746;
}

.woo-swatch-item.type-image.disabled:hover::after {
    background: #253746; 
}

/* Cross for disabled items */
.woo-swatch-item.type-image.disabled::after {
    content: '';
    position: absolute;
    width: calc(100% + 6px); /* Extend beyond edges */
    height: 3px;
    background: #C6C6C6; /* Darker grey for visibility */
    top: calc(50% - 3px);
    left: 0;
    z-index: 20; /* Higher z-index */
    /* pointer-events: none;  */
    transform: rotate(-45deg);
    transform-origin: center;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #fff;
    transition: background-color 0.2s ease;
}

.woo-swatch-item.type-image.selected.disabled::after {
    background: #253746; 
}

.woo-swatch-item.type-label.disabled::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 150%;
    background: #C6C6C6;
    top: -25%;
    left: 50%;
    z-index: 1; /* Higher z-index */
    /* pointer-events: none;  */
    transform: rotate(45deg);
    transform-origin: center;
    transition: background-color 0.2s ease;
}

.woo-swatch-item.type-label.selected.disabled::after {
    background: #fff; 
}

.woo-swatch-item.type-label.disabled {
    /* background-color: #f9f9f9; */
    /* color: #ccc; */
    /* text-decoration: line-through; Removed in favor of cross */
}

/* Image Swatches - Circular (Bo tròn) */
.woo-swatch-item.type-image {
    width: 52px;
    height: 52px;
    padding: 3px;
    border-radius: 50%;
}

.woo-swatch-item.type-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.woo-swatch-item.type-image.selected {
    border-color: #253746;
    box-shadow: 0 0 0 1px #253746; /* Double ring effect */
}

/* Label Swatches - Square Block (Khối vuông không bo tròn) */
.woo-swatch-item.type-label {
    border-radius: 0;
    padding: 8px 12px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    line-height: 1;
    height: 52px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.woo-swatches[data-attribute="pa_size"] .woo-swatch-item.type-label {
    min-width: 52px;
}

.woo-swatches .woo-swatch-item.type-label {
    min-width: 104px;
}

.woo-swatch-item.type-label.selected {
    background-color: #253746;
    color: #fff;
    border-color: #253746;
}

/* Archive Page Swatches Styles */
.woo-archive-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.woo-archive-swatch-item {
    width: 25px;
    height: 25px;
    padding: 2px;
    border: 1px solid #919191;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.woo-archive-swatch-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.woo-archive-swatch-item:hover {
    border-color: #253746;
    box-shadow: 0 0 0 1px #253746;
}

/* Smooth transition for product images on archive pages */
.product .woocommerce-loop-product__link img,
.type-product .woocommerce-loop-product__link img,
.product .attachment-woocommerce_thumbnail,
.type-product .attachment-woocommerce_thumbnail {
    transition: opacity 0.3s ease;
}

/* Product Switching Loading Overlay */
.woo-product-switch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.woo-product-switch-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #253746;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.woo-product-switching {
    /* pointer-events: none; */
    opacity: 0.6;
}

/* Archive swatch link styling */
.woo-archive-swatch-item {
    display: block;
    text-decoration: none;
}

.woo-original-select {
    display: none !important;
}

/* Use !important briefly just to test if this is the issue */
.woo-archive-swatch-wrapper:focus {
  outline: 1px dashed #253746;
  outline-offset: 5px;
}

/* Use !important briefly just to test if this is the issue */
.woo-swatch-item-wrapper:focus {
  outline: 1px dashed #253746;
  outline-offset: 5px;
}