/**
 * WC Variation Buttons - Stylesheet
 */

/* Ẩn dropdown gốc nhưng vẫn cho WC đọc giá trị */
.wcvb-hidden-select {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ẩn cả nhãn "Chọn một tuỳ chọn" sinh ra từ dropdown */
.wcvb-active table.variations td.value {
    position: relative;
}

/* List wrapper */
.wcvb-buttons {
    list-style: none !important;
    margin: 8px 0 0 !important;
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Button chung */
.wcvb-buttons .wcvb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 40px;
    padding: 6px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: all .18s ease;
    font-size: 14px;
    line-height: 1.2;
    color: #222;
    position: relative;
    box-sizing: border-box;
}

.wcvb-buttons .wcvb-button:hover {
    border-color: #111;
    color: #111;
}

/* Selected state */
.wcvb-buttons .wcvb-button.wcvb-selected {
    border-color: #d32f2f;
    color: #d32f2f;
    font-weight: 600;
    background: #fff5f5;
}

.wcvb-buttons .wcvb-button.wcvb-selected::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 14px 14px;
    border-color: transparent transparent #d32f2f transparent;
    border-bottom-right-radius: 5px;
}

/* Disabled (out of stock) */
.wcvb-buttons .wcvb-button.wcvb-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: repeating-linear-gradient(
        135deg,
        #fff,
        #fff 6px,
        #f3f3f3 6px,
        #f3f3f3 8px
    );
}
.wcvb-buttons .wcvb-button.wcvb-disabled:hover {
    border-color: #d1d5db;
    color: #222;
}

/* ---------- Type: COLOR ---------- */
.wcvb-buttons.wcvb-type-color .wcvb-button {
/*    width: 36px;*/
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 5px;
    background-clip: padding-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px #d1d5db;
}

.wcvb-buttons.wcvb-type-color .wcvb-button:hover {
    box-shadow: 0 0 0 1.5px #111;
}

.wcvb-buttons.wcvb-type-color .wcvb-button.wcvb-selected {
    box-shadow: 0 0 0 2px #d32f2f;
    background-color: inherit;
}

.wcvb-buttons.wcvb-type-color .wcvb-button.wcvb-selected::after {
    display: none;
}

/* ---------- Type: IMAGE ---------- */
.wcvb-buttons.wcvb-type-image .wcvb-button {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    padding: 2px;
    overflow: hidden;
}

.wcvb-buttons.wcvb-type-image .wcvb-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

/* SR-only utility (cho accessibility với color swatch) */
.wcvb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus accessibility */
.wcvb-buttons .wcvb-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.25);
}

/* Responsive */
@media (max-width: 480px) {
    .wcvb-buttons .wcvb-button {
        min-height: 38px;
        padding: 6px 12px;
        font-size: 13px;
    }
    .wcvb-buttons.wcvb-type-color .wcvb-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }
}
