/**
 * WC Color Variation Bulk Image - Frontend CSS v2.1.0
 * Responsive square swatch thumbnails — desktop shows at least 3
 */

/* ── Base swatch container ── */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) {
    width: auto !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    padding: 0 !important;
    background: none !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    cursor: pointer !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    transition: border-color .2s, box-shadow .2s !important;
}

/* ── Active / selected / hover state ── */
.wd-swatches-product .wd-swatch.wd-active:has(.wccvbi-swatch-img),
.wd-swatches-product .wd-swatch:focus:has(.wccvbi-swatch-img),
.wd-swatches-product .wd-swatch:hover:has(.wccvbi-swatch-img) {
    border-color: #1d2327 !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1d2327 !important;
}

/* ── DESKTOP ≥1025px: 110×110 (fits 3+ comfortably) ── */
.wd-swatches-product .wd-swatch .wccvbi-swatch-img {
    width: 110px !important;
    height: 110px !important;
    min-width: 110px !important;
    min-height: 110px !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
    border-radius: 0 !important;
    pointer-events: none !important;
}

/* ── Swatch label text below image ── */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
    display: block !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-align: center !important;
    padding: 4px 6px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 110px !important;
    color: #1d2327 !important;
    box-sizing: border-box !important;
}

/* Hide original color dot when image is present */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-bg {
    display: none !important;
}

/* Swatch list — allow wrapping, consistent gap */
.wd-swatches-product {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: flex-start !important;
}

/* ── LARGE DESKTOP ≥1440px: 130×130 ── */
@media (min-width: 1440px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 130px !important;
        height: 130px !important;
        min-width: 130px !important;
        min-height: 130px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        width: 130px !important;
    }
}

/* ── TABLET 769px–1024px: 90×90 ── */
@media (max-width: 1024px) and (min-width: 769px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 90px !important;
        height: 90px !important;
        min-width: 90px !important;
        min-height: 90px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        width: 90px !important;
        font-size: 10px !important;
    }
    .wd-swatches-product { gap: 8px !important; }
}

/* ── MOBILE ≤768px: 75×75 ── */
@media (max-width: 768px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 75px !important;
        height: 75px !important;
        min-width: 75px !important;
        min-height: 75px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        width: 75px !important;
        font-size: 10px !important;
        padding: 3px 4px !important;
    }
    .wd-swatches-product { gap: 8px !important; }
}

/* ── SMALL MOBILE ≤480px: 65×65 ── */
@media (max-width: 480px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 65px !important;
        height: 65px !important;
        min-width: 65px !important;
        min-height: 65px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        width: 65px !important;
        font-size: 9px !important;
        padding: 2px 3px !important;
    }
    .wd-swatches-product { gap: 6px !important; }
}


/* ── Base swatch container ── */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) {
    width: auto !important;
    height: auto !important;
    min-width: unset !important;
    min-height: unset !important;
    padding: 0 !important;
    background: none !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    cursor: pointer !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    transition: border-color .2s, box-shadow .2s !important;
}

/* ── Active / selected state ── */
.wd-swatches-product .wd-swatch.wd-active:has(.wccvbi-swatch-img),
.wd-swatches-product .wd-swatch:focus:has(.wccvbi-swatch-img),
.wd-swatches-product .wd-swatch:hover:has(.wccvbi-swatch-img) {
    border-color: #1d2327 !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1d2327 !important;
}

/* ── Injected image — DESKTOP: 150×150 ── */
.wd-swatches-product .wd-swatch .wccvbi-swatch-img {
    width: 150px !important;
    height: 150px !important;
    min-width: 150px !important;
    min-height: 150px !important;
    object-fit: cover !important;
    object-position: center top !important;
    display: block !important;
    border-radius: 0 !important;
    pointer-events: none !important;
}

/* ── Swatch label text below image ── */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
    display: block !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    text-align: center !important;
    padding: 4px 6px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 150px !important;
    color: #1d2327 !important;
}

/* Hide original color dot when image present */
.wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-bg {
    display: none !important;
}

/* Swatch list — allow wrapping */
.wd-swatches-product {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: flex-start !important;
}

/* ── TABLET: 768px–1024px → 100×100 ── */
@media (max-width: 1024px) and (min-width: 769px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        max-width: 100px !important;
        font-size: 10px !important;
    }
}

/* ── MOBILE: ≤768px → 70×70 ── */
@media (max-width: 768px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 70px !important;
        height: 70px !important;
        min-width: 70px !important;
        min-height: 70px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        max-width: 70px !important;
        font-size: 10px !important;
        padding: 3px 4px !important;
    }
    .wd-swatches-product {
        gap: 8px !important;
    }
}

/* ── SMALL MOBILE: ≤480px → 60×60 ── */
@media (max-width: 480px) {
    .wd-swatches-product .wd-swatch .wccvbi-swatch-img {
        width: 60px !important;
        height: 60px !important;
        min-width: 60px !important;
        min-height: 60px !important;
    }
    .wd-swatches-product .wd-swatch:has(.wccvbi-swatch-img) .wd-swatch-text {
        max-width: 60px !important;
        font-size: 9px !important;
    }
    .wd-swatches-product {
        gap: 6px !important;
    }
}
