.wc-product-disassembler-container {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.wc-product-disassembler-container h3 {
    margin-top: 0;
    color: #333;
    font-size: 18px;
}

.disassembly-attribute-option {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 3px;
    border-left: 3px solid #0073aa;
}

.disassembly-attribute-option h4 {
    margin: 0 0 10px 0;
    color: #0073aa;
}

.disassembly-values {
    margin: 10px 0;
    padding-left: 20px;
}

.disassembly-values li {
    margin: 5px 0;
    color: #666;
}

.disassembly-actions {
    margin-top: 15px;
}

.btn-disassemble,
.btn-create-bundle {
    display: inline-block;
    margin-right: 10px;
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-disassemble:hover,
.btn-create-bundle:hover {
    background: #005a87;
}

.btn-create-bundle {
    background: #00a32a;
}

.btn-create-bundle:hover {
    background: #008a20;
}

.disassembly-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 3px;
}

.disassembly-result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.disassembly-result.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.disassembly-loading {
    opacity: 0.6;
    pointer-events: none;
}

.disassembly-loading::after {
    content: " 处理中...";
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wc-product-disassembler-container {
        padding: 15px;
    }
    
    .btn-disassemble,
    .btn-create-bundle {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
}

.wc-disassembler-bundle-card {
    margin: 30px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.bundle-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.bundle-products-container {
    position: relative;
    overflow: hidden;
    /* 添加右侧占位空间，确保最后一个产品能完全显示 */
    padding-right: 20px;
}

.bundle-products-carousel {
    display: flex;
    transition: transform 0.3s ease;
    gap: 15px;
    /* 添加右侧占位，确保最后一个产品能完全显示 */
    padding-right: 20px;
}

.bundle-products-grid {
    display: grid;
    gap: 15px;
    margin-top: 15px;
    justify-items: center;
}

/* PC端：最多3列 */
@media (min-width: 769px) {
    .bundle-products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        max-width: 100%;
    }
}

/* 移动端：单列 */
@media (max-width: 768px) {
    .bundle-products-grid {
        grid-template-columns: 1fr;
        max-width: 300px;
        margin: 15px auto 0;
    }
}

.bundle-product-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    width: 100%;
    max-width: 250px;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

.bundle-product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.bundle-product-item:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-name {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
}

/* 轮播控制按钮 */
.carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    z-index: 10;
}

.carousel-controls:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-controls:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 轮播指示器 */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: background 0.2s ease;
}

.carousel-indicator.active {
    background: #0073aa;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .wc-disassembler-bundle-card {
        margin: 20px 0;
        padding: 15px;
    }
    
    .bundle-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .bundle-product-item {
        max-width: 200px;
        max-height: 250px;
        margin: 0 auto;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .bundle-product-item {
        max-width: 180px;
        max-height: 220px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 13px;
    }
}

/* Bundle区域非表单处理 */
.wc-disassembler-bundle-card[data-bundle-container="true"] {
    /* 确保Bundle区域独立于表单 */
    position: relative;
    z-index: 1;
    margin: 20px 0;
    /* 防止表单事件影响 */
    pointer-events: auto;
}

.wc-disassembler-bundle-card[data-bundle-container="true"] .carousel-controls[data-non-form="true"] {
    /* 确保按钮完全独立 */
    position: relative;
    z-index: 10;
    /* 防止表单提交 */
    form: none;
}

/* 防止表单事件冒泡到Bundle区域 */
form.cart .wc-disassembler-bundle-card[data-bundle-container="true"] {
    /* 如果Bundle在表单内，确保它不受表单影响 */
    pointer-events: none;
}

form.cart .wc-disassembler-bundle-card[data-bundle-container="true"] .carousel-controls[data-non-form="true"] {
    /* 只允许按钮交互 */
    pointer-events: auto;
}

/* 确保Bundle区域内的链接正常工作 */
.wc-disassembler-bundle-card[data-bundle-container="true"] .product-link {
    pointer-events: auto;
}
