/* =============================================
   Product Units Swatches - Card Style
   ============================================= */

.dpest-units-swatches-wrap {
    margin-bottom: 18px;
    width: 100%;
}

.dpest-units-swatches-wrap .dpest-swatches-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* 2-column grid */
.dpest-units-swatches-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 480px) {
    .dpest-units-swatches-grid {
        grid-template-columns: 1fr;
    }
}

/* Each card */
.dpest-swatch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, border-style 0.2s ease, background 0.2s ease;
    background: #fff;
    min-height: 54px;
    user-select: none;
    -webkit-user-select: none;
}

.dpest-swatch-card:hover {
    border-color: #999;
}

/* Active / selected state */
.dpest-swatch-card.dpest-active {
    border-style: solid;
    border-color: var(--wd-primary-color, #83b735);
    background-color: rgba(131, 183, 53, 0.05);
}

/* Disabled / unavailable */
.dpest-swatch-card.dpest-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Name text */
.dpest-swatch-card .dpest-swatch-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    flex: 1;
    padding-right: 12px;
}

/* Price text */
.dpest-swatch-card .dpest-swatch-price {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    flex-shrink: 0;
}

.dpest-swatch-card .dpest-swatch-price .dpest-price-label {
    font-weight: 400;
    color: #777;
    margin-right: 4px;
    font-size: 12px;
}

/* =============================================
   Hide the original <select> when swatches exist
   ============================================= */

/* Target by multiple selectors for compatibility */
.dpest-swatches-initialized #pa_product-units,
.dpest-swatches-initialized select[name="attribute_pa_product-units"],
.dpest-swatches-initialized select[data-attribute_name="attribute_pa_product-units"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    white-space: nowrap !important;
}

/* Also hide Woodmart's swatch wrapper if it exists for this attribute */
.dpest-swatches-initialized .wd-swatches-product[data-id="pa_product-units"] {
    display: none !important;
}

/* Hide the "Product Units :" label row from variations table - we show our own */
.dpest-swatches-initialized tr.dpest-attr-row > .label {
    display: none !important;
}

/* Woodmart "Clear" link - keep it visible */
.dpest-swatches-initialized .reset_variations {
    display: inline-block !important;
}

/* =============================================
   RTL Support
   ============================================= */
[dir="rtl"] .dpest-swatch-card .dpest-swatch-name,
.rtl .dpest-swatch-card .dpest-swatch-name,
html[lang^="ar"] .dpest-swatch-card .dpest-swatch-name {
    padding-right: 0;
    padding-left: 12px;
}

[dir="rtl"] .dpest-swatch-card .dpest-swatch-price .dpest-price-label,
.rtl .dpest-swatch-card .dpest-swatch-price .dpest-price-label,
html[lang^="ar"] .dpest-swatch-card .dpest-swatch-price .dpest-price-label {
    margin-right: 0;
    margin-left: 4px;
}
