/* ============================================================
   ShopGen Variation Swatches
   Replaces WooCommerce dropdown selects with block swatches.
   ============================================================ */

/* Hide the native select — WooCommerce still uses it internally */
.sgw-select-hidden {
    display: none !important;
}

/* ── Collapse ALL gap between swatches and qty/add-to-cart ── */

/* WooCommerce variations table */
table.variations {
    margin-bottom: 0 !important;
    border-spacing: 0 !important;
}
table.variations td,
table.variations th {
    padding-bottom: 2px !important;
    padding-top: 2px !important;
    vertical-align: middle !important;
}

/* The variation description / price update area that holds empty height */
.woocommerce-variation,
.woocommerce-variation-description,
.woocommerce-variation-availability {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* The outer wrapper around qty + add-to-cart */
.single_variation_wrap {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* The row holding qty+button inside the wrapper */
.woocommerce-variation-add-to-cart {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Also reduce bottom margin on our own swatch wrap */
.sgw-swatch-wrap {
    margin-bottom: 4px !important;
}



/* ── Swatch container ── */
.sgw-swatch-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 10px;
    align-items: center;
}

/* ── Individual swatch button ── */
.sgw-swatch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 40px;
    padding: 0 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #1f2937;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.15s;
    outline: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden; /* keeps the strikethrough pseudo-element clipped */
}

/* Hover */
.sgw-swatch:hover:not(.sgw-disabled) {
    border-color: #6b7280;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transform: translateY(-1px);
}

/* ── Selected state ── */
.sgw-swatch.selected {
    border-color: #111827;
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    transform: translateY(-1px);
}

/* ── Disabled / out-of-stock: diagonal strikethrough ── */
.sgw-swatch.sgw-disabled {
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.75;
    pointer-events: auto; /* keep visible, just style as disabled */
    transform: none !important;
    box-shadow: none !important;
}

/* Diagonal strikethrough line via pseudo-element */
.sgw-swatch.sgw-disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130%;
    height: 1.5px;
    background: #9ca3af;
    transform: translate(-50%, -50%) rotate(-45deg);
    pointer-events: none;
    border-radius: 2px;
}

/* ── Focus ring for accessibility ── */
.sgw-swatch:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ── Responsive: tighten gap on mobile ── */
@media (max-width: 480px) {
    .sgw-swatch-wrap {
        gap: 6px;
    }
    .sgw-swatch {
        min-width: 40px;
        height: 36px;
        padding: 0 10px;
        font-size: 12px;
    }
}
