.wct-variation-swatches,
.wct-auto-variation-swatches {
    --wct-swatch-accent: var(--woocustom-color-primary, #087f8c);
    --wct-swatch-border: var(--woocustom-border, #e5e7eb);
    --wct-swatch-text: var(--woocustom-text, #1f2937);
    --wct-swatch-muted: var(--woocustom-muted, #64748b);
    position: relative;
    direction: rtl;
    text-align: right;
}

.wct-variation-swatches *,
.wct-auto-variation-swatches * {
    box-sizing: border-box;
}

.wct-variation-swatches form.variations_form,
form.wct-auto-variation-swatches {
    width: 100%;
    margin: 0;
    direction: rtl;
    text-align: right;
}

/* Div-based native WooCommerce variation layout. */
.wct-variations,
.wct-auto-variation-swatches .wct-variations.variations {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    gap: 16px;
    margin: 0;
    padding: 0;
}

.wct-variation-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.wct-variation-label,
.wct-variation-value {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: right;
}

.wct-variation-label label,
.wct-variation-swatches .variations label {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0;
    color: var(--wct-swatch-text);
    font-weight: 700;
    line-height: 1.6;
}

.wct-selected-value {
    color: var(--wct-swatch-muted);
    font-size: .88em;
    font-weight: 500;
}

.wct-selected-value:not(:empty)::before {
    content: "—";
    margin-left: 3px;
}

.wct-swatch-select-wrap {
    position: relative;
    width: 100%;
}

/* Keep the native select in the DOM for WooCommerce, forms and accessibility. */
.wct-has-prerendered-swatches select.wct-swatch-native-select,
.wct-swatches-ready select.wct-swatch-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !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;
}

.wct-swatches-ready select.wct-swatch-dropdown {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    border: 1px solid var(--wct-swatch-border) !important;
    border-radius: 10px !important;
    background: #fff !important;
    color: var(--wct-swatch-text) !important;
    opacity: 1 !important;
}

.wct-swatch-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
    direction: rtl;
}

.wct-swatch-options[hidden] {
    display: none !important;
}

.wct-swatch-option {
    all: unset;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--wct-swatch-border);
    border-radius: 10px;
    background: #fff;
    color: var(--wct-swatch-text);
    font: inherit;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.wct-swatch-option:hover {
    border-color: var(--wct-swatch-accent);
    transform: translateY(-1px);
}

.wct-swatch-option:focus-visible {
    outline: 2px solid var(--wct-swatch-accent);
    outline-offset: 2px;
}

.wct-swatch-option.is-selected {
    border-color: var(--wct-swatch-accent);
    background: var(--wct-swatch-accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .14);
}

.wct-swatch-option.is-color,
.wct-swatch-option.is-image {
    width: 42px;
    height: 42px;
    min-width: 0;
    min-height: 0;
    padding: 3px;
    overflow: visible;
}

.wct-swatch-color {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: var(--wct-option-color, #f1f5f9);
}

.wct-swatch-option.is-image > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.wct-swatch-option.is-disabled,
.wct-swatch-option:disabled {
    opacity: .38;
    cursor: not-allowed;
    filter: grayscale(.35);
    transform: none !important;
}

.wct-strike-unavailable .wct-swatch-option.is-disabled::before,
.wct-strike-unavailable .wct-swatch-option.is-disabled::after,
.wct-strike-unavailable .wct-swatch-option:disabled::before,
.wct-strike-unavailable .wct-swatch-option:disabled::after {
    content: "";
    position: absolute;
    inset-inline-start: 6%;
    top: 50%;
    width: 88%;
    height: 1px;
    background: #ef4444;
    transform: rotate(45deg);
    z-index: 3;
    pointer-events: none;
}

.wct-strike-unavailable .wct-swatch-option.is-disabled::after,
.wct-strike-unavailable .wct-swatch-option:disabled::after {
    transform: rotate(-45deg);
}

.wct-swatch-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translate(-50%, 6px);
    min-width: max-content;
    max-width: 180px;
    padding: 7px 9px;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
}

.wct-swatch-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111827;
}

.wct-swatch-tooltip img {
    display: block;
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    margin: 0 auto 5px;
}

.wct-swatch-option:hover .wct-swatch-tooltip,
.wct-swatch-option:focus-visible .wct-swatch-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.wct-variation-actions {
    display: flex;
    justify-content: flex-start;
    min-height: 24px;
    margin-top: 8px;
}

.wct-variation-swatches .reset_variations,
.wct-auto-variation-swatches .reset_variations {
    display: inline-flex !important;
    align-items: center;
    margin: 0;
    color: var(--wct-swatch-muted);
    font-size: 12px;
    text-decoration: none;
}

.wct-variation-swatches .reset_variations:hover,
.wct-auto-variation-swatches .reset_variations:hover {
    color: var(--wct-swatch-accent);
}

.wct-variation-swatches.wct-hide-reset .reset_variations {
    display: none !important;
}

.wct-variation-swatches.wct-hide-add-to-cart .single_variation_wrap .woocommerce-variation-add-to-cart {
    display: none !important;
}

.wct-variation-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    color: var(--wct-swatch-text);
    font-size: 13px;
}

.wct-variation-price .price,
.wct-variation-stock .stock,
.wct-variation-stock p {
    margin: 0;
}

.wct-variation-sku::before {
    content: "SKU: ";
    font-weight: 700;
}

.wct-variation-swatches .single_variation_wrap,
.wct-auto-variation-swatches .single_variation_wrap {
    margin-top: 10px;
}

.wct-variation-swatches .woocommerce-variation-description:empty,
.wct-variation-swatches .woocommerce-variation-availability:empty,
.wct-variation-swatches .woocommerce-variation-price:empty,
.wct-auto-variation-swatches .woocommerce-variation-description:empty,
.wct-auto-variation-swatches .woocommerce-variation-availability:empty,
.wct-auto-variation-swatches .woocommerce-variation-price:empty {
    display: none;
}

/* Backward-compatible fallback if a theme bypasses the custom template. */
.wct-variation-swatches table.variations {
    width: 100%;
    margin: 0;
    border: 0;
}

.wct-variation-swatches table.variations tbody,
.wct-variation-swatches table.variations tr,
.wct-variation-swatches table.variations th,
.wct-variation-swatches table.variations td {
    display: block;
    width: 100%;
}

.wct-variation-swatches table.variations tr {
    margin: 0 0 16px;
}

.wct-variation-swatches table.variations th,
.wct-variation-swatches table.variations td {
    padding: 0;
    border: 0;
    text-align: right;
    background: transparent;
}

.wct-variation-swatches table.variations th {
    margin: 0 0 8px;
}

@media (max-width: 767px) {
    .wct-variations {
        gap: 14px;
    }

    .wct-swatch-options {
        gap: 7px;
    }

    .wct-swatch-option {
        min-width: 37px;
        min-height: 37px;
        padding: 7px 11px;
        border-radius: 9px;
        font-size: 13px;
    }

    .wct-swatch-option.is-color,
    .wct-swatch-option.is-image {
        width: 38px;
        height: 38px;
    }
}

/* Unified AJAX cart + variation-image selector. The native WooCommerce selects
 * remain accessible but the visible option is sourced from each Variation image. */
.wct-swatch-option.is-image .wct-swatch-image-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: #f8fafc;
}

.wct-swatch-option.is-image .wct-swatch-variation-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.wct-swatch-option.is-image .wct-swatch-variation-image[hidden],
.wct-swatch-option.is-image .wct-swatch-image-fallback[hidden],
.wct-swatch-option.is-image .wct-image-option-name[hidden] {
    display: none !important;
}

.wct-swatch-option.is-image .wct-swatch-image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 4px;
    color: var(--wct-swatch-muted);
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
}

.wct-unified-ajax-cart .wct-swatch-option.is-image {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    overflow: visible;
    flex-direction: column;
    gap: 7px;
    transform: none;
    box-shadow: none;
}

.wct-unified-ajax-cart .wct-swatch-option.is-image .wct-swatch-image-frame {
    width: 64px;
    height: 64px;
    padding: 2px;
    border: 1px solid var(--wct-swatch-border);
    border-radius: 12px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

.wct-unified-ajax-cart .wct-swatch-option.is-image:hover .wct-swatch-image-frame,
.wct-unified-ajax-cart .wct-swatch-option.is-image:focus-visible .wct-swatch-image-frame {
    border-color: var(--wct-swatch-accent);
    transform: translateY(-1px);
}

.wct-unified-ajax-cart .wct-swatch-option.is-image.is-selected .wct-swatch-image-frame {
    border-color: var(--wct-swatch-accent);
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .14);
}

.wct-unified-ajax-cart .wct-swatch-option.is-image.is-disabled .wct-swatch-image-frame,
.wct-unified-ajax-cart .wct-swatch-option.is-image:disabled .wct-swatch-image-frame {
    opacity: .38;
    filter: grayscale(.7);
}

.wct-unified-ajax-cart .wct-image-option-name {
    display: block;
    max-width: 110px;
    color: var(--wct-swatch-text);
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
    overflow-wrap: anywhere;
}

.wct-unified-ajax-cart.wct-hide-option-labels .wct-variation-label,
.wct-unified-ajax-cart.wct-hide-option-labels table.variations th.label {
    display: none !important;
}

.wct-unified-ajax-cart.wct-hide-option-names .wct-image-option-name {
    display: none !important;
}

.wct-unified-ajax-cart .wct-variation-meta:empty {
    display: none;
}

@media (max-width: 767px) {
    .wct-unified-ajax-cart .wct-swatch-option.is-image .wct-swatch-image-frame {
        width: 56px;
        height: 56px;
    }
}

.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image.is-disabled::before,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image.is-disabled::after,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image:disabled::before,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image:disabled::after {
    display: none !important;
}

.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image.is-disabled .wct-swatch-image-frame::before,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image.is-disabled .wct-swatch-image-frame::after,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image:disabled .wct-swatch-image-frame::before,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image:disabled .wct-swatch-image-frame::after {
    content: "";
    position: absolute;
    inset-inline-start: 7%;
    top: 50%;
    width: 86%;
    height: 1.5px;
    background: #ef4444;
    transform: rotate(45deg);
    z-index: 3;
    pointer-events: none;
}

.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image.is-disabled .wct-swatch-image-frame::after,
.wct-unified-ajax-cart.wct-strike-unavailable .wct-swatch-option.is-image:disabled .wct-swatch-image-frame::after {
    transform: rotate(-45deg);
}

.wct-variation-meta[hidden] {
    display: none !important;
}
