/**
 * WooCommerce Variation Groups – Frontend Styles
 * Dark-theme compatible. All black elements replaced with white/light.
 */

/* ── Fix: Woodmart adjacent-selector broken by our tab bar ── */
.wd-swatches-product ~ select {
    display: none !important;
}

/* ── Table layout: two rows (label above, value below) ── */
table.variations tbody,
table.variations tr {
    display: block !important;
    width: 100% !important;
}

table.variations .label {
    display: block !important;
    width: 100% !important;
    padding: 0 0 6px 0 !important;
    font-weight: 600;
    white-space: normal;
    color: inherit;
}

table.variations .value {
    display: block !important;
    width: 100% !important;
    padding: 0 0 20px 0 !important;
}

/* ── Tab bar ── */
.wvg-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px 0;
}

.wvg-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.3px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.wvg-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.9);
    color: #fff;
}

/* Active tab: filled white pill, dark text */
.wvg-tab.active {
    background: #fff;
    color: #111;
    border-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.wvg-tab:active {
    transform: scale(0.96);
}

/* ── Hide filtered / limited swatches ── */
.wd-swatch.wvg-tab-hidden {
    display: none !important;
}

/* ── Swatch wrapper — allows color name below the circle ── */
.wvg-swatch-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    /* No overflow:hidden so label is never clipped */
}

/* ── Color name label ── */
.wvg-color-name {
    display: block;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    margin-top: 2px;
}

/* ── View More / View Less — inline link after swatches ── */
.wvg-view-more-btn {
    display: inline-flex;
    align-items: center;
    align-self: center;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.35);
    background: none;
    border: none;
    padding: 0 6px;
    margin-left: 4px;
    line-height: 1;
    transition: color 0.15s, text-decoration-color 0.15s;
    user-select: none;
    white-space: nowrap;
}

.wvg-view-more-btn:hover {
    color: #fff;
    text-decoration-color: rgba(255, 255, 255, 0.7);
}

/* ── Image preview popup ── */
.wvg-popup {
    position: fixed;
    z-index: 999999;
    background: #fff;
    border: 3px solid #8B6240;
    border-radius: 16px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.25);
    padding: 8px;
    width: 180px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px) scale(0.97);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Downward caret — border triangle */
.wvg-popup::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: var(--caret-left, 50%);
    transform: translateX(-50%);
    border-width: 20px 15px 0 15px;
    border-style: solid;
    border-color: #8B6240 transparent transparent transparent;
    pointer-events: none;
}

/* Downward caret — white inner fill */
.wvg-popup::before {
    content: '';
    position: absolute;
    bottom: -14px;
    left: var(--caret-left, 50%);
    transform: translateX(-50%);
    border-width: 15px 11px 0 11px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    z-index: 1;
    pointer-events: none;
}

.wvg-popup--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Popup image */
.wvg-popup-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
}

/* Text label: always visible below the image */
.wvg-popup-name {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    font-weight: 700;
    color: #222;
    text-align: center;
}

/* No image: hide the img slot, show name with more padding */
.wvg-popup--no-img .wvg-popup-img {
    display: none;
}

.wvg-popup--no-img .wvg-popup-name {
    padding: 18px 8px;
    font-size: 15px;
}
