/* Ẩn form biến thể mặc định */
.product-info .variations {
    display: none;
}

/* Styling cho giá sản phẩm chính */
.product-info .price span.amount, 
.product-info .price ins bdi {
    font-size: 22px;
}

.product-info .price del bdi, 
.product-info .price {
    color: gray;
    font-size: 15px;
}

/* Container chính */
.custom-variations-wrapper {
    margin: 15px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Header */
.variations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e8;
}

.variations-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.clear-variation-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    color: rgb(204 86 27 / 80%);
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.clear-variation-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

/* Container cho từng nhóm thuộc tính */
.attribute-group {
    margin-bottom: 10px;
}

.attribute-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

/* Container cho tags - flex wrap để tự động xuống dòng */
.custom-variation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.attribute-header .woocommerce-Price-currencySymbol {
    vertical-align: baseline !important;
}

.attribute-header button {
    margin: 0;
}

.attribute-header {
    margin-bottom:10px;
}

.clear-single-variation-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 1px 4px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    color: #666;
    margin-left: 8px;
    transition: all 0.2s ease;
    margin-left: 10px !important;
    height: 16px;
    width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.clear-single-variation-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

/* Variation Tag - giống như tag trên Shopee */
.variation-tag {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 2px 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    position: relative;
    min-height: 32px;
}

.variation-tag:hover {
    border-color: #ffc107;
    background: #fffbf0;
}

.variation-tag.selected {
    border-color: #ffc107;
    background: #fffbf0;
    color: #333;
    font-weight: 500;
}

/* Dấu tích chọn ở góc với nền vàng */
.selection-check {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ffc107;
    color: #333;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    z-index: 3;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.variation-tag.selected .selection-check {
    opacity: 1;
    transform: scale(1);
}

/* Icon trong tag */
.variation-icon {
    width: 28px;
    height: 28px;
    margin-right: 6px;
    overflow: hidden;
    border-radius: 2px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.variation-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Color swatches container */
.color-swatches {
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    overflow: hidden;
}

/* Color swatch styling */
.color-swatch {
    flex: 1;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.5);
}

.color-swatch:last-child {
    border-right: none;
}

/* Gradient color swatches */
.color-swatches.gradient {
    background: linear-gradient(45deg, var(--color1, #000), var(--color2, #fff));
}

.color-swatches.gradient .color-swatch {
    display: none;
}

.color-swatches.radial-gradient {
    background: radial-gradient(circle, var(--color1, #000), var(--color2, #fff));
}

.color-swatches.radial-gradient .color-swatch {
    display: none;
}

.color-swatches.vertical-gradient {
    background: linear-gradient(to bottom, var(--color1, #000), var(--color2, #fff));
}

.color-swatches.vertical-gradient .color-swatch {
    display: none;
}

/* Biến thể hết hàng */
.variation-tag.out-of-stock {
    opacity: 0.4;
    position: relative;
    cursor: not-allowed;
    filter: grayscale(80%);
    background: #f5f5f5;
}

.variation-tag.out-of-stock::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 2px;
    background: #ff0000;
    transform: translate(-50%, -50%) rotate(45deg);
    pointer-events: none;
    z-index: 2;
}

.variation-tag.out-of-stock::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 2px;
    background: #ff0000;
    transform: translate(-50%, -50%) rotate(-45deg);
    pointer-events: none;
    z-index: 2;
}

/* Label text */
.variation-label {
    line-height: 1.3;
}

/* Hiệu ứng selected */
.variation-tag.selected .variation-icon {
    background: #f8f9fa;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .custom-variation-tags {
        gap: 6px;
    }
    
    .variation-tag {
        padding: 5px 8px;
        font-size: 12px;
        min-height: 30px;
    }
    
    .selection-check {
        width: 12px;
        height: 12px;
        font-size: 7px;
        top: -3px;
        right: -3px;
    }
    
    .variation-icon {
        width: 18px;
        height: 18px;
        margin-right: 5px;
    }
    
    .attribute-group-title {
        font-size: 13px;
    }
    
    .clear-single-variation-btn {
        width: 14px;
        height: 14px;
        font-size: 9px;
        margin-left: 8px !important;
    }
}

@media (max-width: 480px) {
    .variations-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .clear-variation-btn {
        align-self: flex-end;
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .custom-variation-tags {
        gap: 5px;
    }
    
    .variation-tag {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 30px;
    }
    
    .selection-check {
        width: 11px;
        height: 11px;
        font-size: 6px;
        top: -2px;
        right: -2px;
    }
    
    .variation-icon {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }
    
    .variations-title {
        font-size: 13px;
    }
    
    .attribute-group-title {
        font-size: 12px;
    }
    
    .clear-single-variation-btn {
        width: 12px;
        height: 12px;
        font-size: 8px;
        margin-left: 6px !important;
    }
}

@media (max-width: 360px) {
    .variation-tag {
        padding: 3px 6px;
        font-size: 10px;
        min-height: 26px;
    }
    
    .selection-check {
        width: 10px;
        height: 10px;
        font-size: 5px;
        top: -2px;
        right: -2px;
    }
    
    .variation-icon {
        width: 14px;
        height: 14px;
        margin-right: 3px;
    }
    
    .variations-title {
        font-size: 12px;
    }
    
    .attribute-group-title {
        font-size: 11px;
    }
    
    .clear-single-variation-btn {
        width: 10px;
        height: 10px;
        font-size: 7px;
        margin-left: 5px !important;
    }
}