/* WC Variation Swatches - Frontend Styles */

/* Hidden select - visually hidden but accessible to WooCommerce JS */
.wcs-hidden-select {
    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;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Swatches container */
.wcs-swatches-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 6px 0 4px;
}

/* Base swatch */
.wcs-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    position: relative;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.wcs-swatch:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 3px;
}

/* ---- Color swatch (circular) ---- */
.wcs-color-swatch {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px #c8c8c8;
}

.wcs-color-swatch:hover {
    box-shadow: 0 0 0 2px #555;
    transform: scale(1.08);
}

/* Selected state - clear outer ring like image 2 */
.wcs-color-swatch.wcs-selected {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111;
    transform: scale(1.06);
}

/* Checkmark for selected color swatch */
.wcs-check-icon {
    display: none;
    font-style: normal;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.wcs-color-swatch.wcs-selected .wcs-check-icon {
    display: block;
}

/* Light color swatch - dark checkmark */
.wcs-color-swatch.wcs-light.wcs-selected .wcs-check-icon {
    color: #222;
    text-shadow: none;
}

/* ---- Button swatch (text) ---- */
.wcs-button-swatch {
    padding: 8px 18px;
    min-width: 52px;
    border: 1.5px solid #d8d8d8;
    border-radius: 6px;
    background: #fff;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.wcs-button-swatch:hover {
    border-color: #888;
    background: #fafafa;
    color: #111;
}

/* Selected button - bold border, no fill, like image 2 */
.wcs-button-swatch.wcs-selected {
    border: 2px solid #111;
    color: #111;
    font-weight: 700;
    background: #fff;
}

/* ---- Disabled swatch (out of stock combination) ---- */
.wcs-swatch.wcs-disabled {
    opacity: 0.38;
    cursor: not-allowed;
    pointer-events: none;
}

.wcs-color-swatch.wcs-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110%;
    height: 1.5px;
    background: rgba(180,180,180,0.9);
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* ---- WoodMart compatibility ---- */
.woodmart-theme .wcs-button-swatch {
    font-family: inherit;
    font-size: 13px;
}

.woodmart-theme table.variations td .wcs-swatches-wrapper {
    margin-top: 8px;
}

/* Prevent WoodMart select styling from leaking */
.woodmart-theme .wcs-hidden-select + * {
    display: none;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .wcs-button-swatch {
        padding: 7px 13px;
        font-size: 12px;
        min-width: 44px;
    }

    .wcs-color-swatch {
        width: 30px;
        height: 30px;
    }

    .wcs-swatches-wrapper {
        gap: 7px;
    }
}
