
/* Smart Variation Swatches — frontend */

.svsw-swatches[hidden] {
    display: none !important;
}

/* Keep attribute labels and swatches on one line. */
.variations_form table.variations tr:has(.svsw-swatches) {
    display: grid !important;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: center;
    column-gap: 12px;
    margin-bottom: 12px;
}

.variations_form table.variations tr:has(.svsw-swatches) > th,
.variations_form table.variations tr:has(.svsw-swatches) > td {
    display: block;
    width: auto !important;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0 !important;
    background: transparent;
    border: 0;
    text-align: left;
}

.variations_form table.variations tr:has(.svsw-swatches) > th label {
    display: block;
    margin: 0;
    line-height: 36px;
}

/* Hide the original dropdown only when swatches are active. */
.variations_form .svsw-has-swatches > select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    pointer-events: none;
}

/* Swatch container */
.variations_form .svsw-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 0;
}

/* Color buttons */
.variations_form .svsw-swatches .svsw-swatch {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
    border: 2px solid #b5b5b5;
    border-radius: 50%;
    background: var(--svsw-color);
    box-shadow: inset 0 0 0 2px #fff;
    cursor: pointer;
    line-height: 1;
    transition: border-color .15s ease,
                outline-color .15s ease;
}

/* Selected swatch */
.variations_form .svsw-swatch[aria-pressed="true"] {
    border-color: #222;
    outline: 2px solid #222;
    outline-offset: 2px;
}

/* Keyboard focus */
.variations_form .svsw-swatch:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 3px;
}

/* Selection checkmark */
.svsw-swatch__mark {
    visibility: hidden;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font: bold 14px/20px sans-serif;
    text-align: center;
}

.svsw-swatch[aria-pressed="true"] .svsw-swatch__mark {
    visibility: visible;
}

/* Unavailable options */
.variations_form .svsw-swatch:disabled {
    opacity: .35;
    cursor: not-allowed;
    border-style: dashed;
}

/* Keep the native Clear link below the swatches. */
.variations_form .svsw-has-swatches .reset_variations {
    display: inline-block;
    margin-top: 8px;
}

/* Narrow screens */
@media (max-width: 480px) {
    .variations_form table.variations tr:has(.svsw-swatches) {
        grid-template-columns: 70px minmax(0, 1fr);
        column-gap: 10px;
    }

    .variations_form .svsw-swatches {
        gap: 8px;
    }
}
