/* ==========================================================================
   EC Card Swatch v1.5 – Product Card Color Swatches
   Swatches inline with price. Image preview uses overlay.
   ========================================================================== */

/* ─── Price container: flex row with price left, swatches right ──────── */
li.post-card .fusion-woo-price-tb.eccs-inline {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    overflow: visible !important;
    float: none !important;
    /* Override Avada's .floated class */
    width: 100% !important;
}

/* ─── Swatch container: right-aligned inside the price row ───────────── */
.eccs-swatches {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--eccs-gap, 4px);
    margin-left: auto;
    flex-shrink: 0;
    line-height: 0;
    overflow: visible;
    position: relative;
    z-index: 10;
}

/* ─── Individual swatch ──────────────────────────────────────────────── */
.eccs-swatch {
    position: relative;
    display: inline-block;
    width: var(--eccs-size, 18px);
    height: var(--eccs-size, 18px);
    border-radius: var(--eccs-radius, 50%);
    border: var(--eccs-border-width, 1px) solid var(--eccs-border-color, #999);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: visible;
    padding: 0;
    line-height: 0;
    vertical-align: middle;
}

.eccs-swatch:hover {
    transform: scale(1.25);
}

.eccs-swatch--active {
    border-width: var(--eccs-active-bw, 2px);
    border-color: var(--eccs-active-bc, #000);
}

.eccs-swatch--active:hover {
    transform: none;
}

/* ─── Color fill ─────────────────────────────────────────────────────── */
.eccs-swatch__color {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    box-sizing: border-box;
}

/* ─── Tooltip ────────────────────────────────────────────────────────── */
.eccs-swatch__tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 7px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
    line-height: 1.3;
}

.eccs-swatch__tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

.eccs-swatch:hover>.eccs-swatch__tooltip {
    opacity: 1;
    visibility: visible;
}


/* ==========================================================================
   PREVIEW IMAGE OVERLAY
   ========================================================================== */

.eccs-preview-img {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.eccs-preview-img--visible {
    opacity: 1;
}


/* ==========================================================================
   AVADA OVERRIDES
   ========================================================================== */

li.post-card .fusion-column-wrapper {
    overflow: visible !important;
}

li.post-card .fusion-image-element {
    position: relative;
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media screen and (max-width: 640px) {
    .eccs-swatches {
        gap: 3px;
    }

    .eccs-swatch__tooltip {
        font-size: 9px;
        padding: 2px 5px;
    }
}