.ths-native-swatch-field {
    position: relative;
    width: 100%;
}

/* WooCommerce's select remains available to its native variation script but is
 * visually removed. */
.ths-native-swatch-field > select,
.ths-native-swatch-field .select2-container,
.ths-native-swatch-field .select2-selection {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ths-native-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.ths-native-swatch {
    appearance: none;
    -webkit-appearance: none;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 11px;
    border: 1px solid rgba(0, 0, 0, .24);
    border-radius: 7px;
    background: #fff;
    color: inherit;
    font: inherit;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease, transform .15s ease;
}

.ths-native-swatch:hover:not(.is-disabled),
.ths-native-swatch:focus-visible {
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(44, 153, 209, .22);
    outline: none;
}

.ths-native-swatch.is-selected {
    border-color: #2c99d1;
    box-shadow: 0 0 0 2px rgba(44, 153, 209, .32);
    transform: translateY(-1px);
}

.ths-native-swatch.is-disabled {
    opacity: .34;
    cursor: not-allowed;
    text-decoration: line-through;
}

.ths-native-swatches--color .ths-native-swatch {
    width: 42px;
    min-width: 42px;
    padding: 0;
}

.ths-native-swatches--image .ths-native-swatch {
    width: 54px;
    height: 54px;
    padding: 3px;
    overflow: hidden;
}

.ths-native-swatches--image .ths-native-swatch img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.ths-native-swatches--radio {
    display: grid;
    gap: 6px;
}

.ths-native-swatches--radio .ths-native-swatch {
    position: relative;
    justify-self: start;
    min-height: 34px;
    padding: 6px 10px 6px 32px;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.ths-native-swatches--radio .ths-native-swatch::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-radius: 50%;
    transform: translateY(-50%);
}

.ths-native-swatches--radio .ths-native-swatch.is-selected::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    transform: translateY(-50%);
}

@media (max-width: 767px) {
    .ths-native-swatch {
        min-width: 44px;
        min-height: 44px;
    }
}


/* v1.7.2: Keep sold-out variation values visible but unmistakably unavailable. */
.ths-native-swatch.is-out-of-stock,
.ths-native-swatch.is-disabled {
    opacity: .38;
    cursor: not-allowed;
    filter: grayscale(1);
    text-decoration: line-through;
}

.ths-native-swatch.is-out-of-stock:hover,
.ths-native-swatch.is-out-of-stock:focus,
.ths-native-swatch.is-disabled:hover,
.ths-native-swatch.is-disabled:focus {
    transform: none;
    box-shadow: none;
    border-color: rgba(0, 0, 0, .24);
}
