/**
 * 产品对比功能样式
 */

/* 右侧对比栏 */
.compare-bar {
    position: fixed;
    right: 25px;
    top: 2%;
    width: 200px;
    height: 55vh;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}

.compare-bar.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(20px);
}

/* 浮动对比按钮 */
.compare-float-btn {
    position: fixed;
    top: 68%;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0a4480, #1a5490);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(10, 68, 128, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.compare-float-btn.show {
    opacity: 1;
    visibility: visible;
}

.compare-float-btn:hover {
    background: linear-gradient(135deg, #083d6e, #0a4480);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(10, 68, 128, 0.5);
}

.compare-float-btn .btn-text {
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
}

.compare-float-btn .btn-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: #ff4d4f;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 20px;
}

.compare-float-btn .btn-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.compare-bar-header {
    padding: 12px;
    background: linear-gradient(135deg, #0a4480, #1a5490);
    color: #fff;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.compare-bar-title {
    font-size: 14px;
    font-weight: bold;
}

.compare-bar-count {
    font-size: 11px;
    opacity: 0.9;
}

.compare-bar-toggle {
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
}

.compare-bar-toggle:hover {
    background: rgba(255,255,255,0.3);
}

.compare-bar-products {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.compare-item {
    position: relative;
    background: #f8f8f8;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.compare-item-image {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 6px;
}

.compare-item-image img {
    max-width: 90%;
    max-height: 75px;
    object-fit: contain;
}

.compare-item-name {
    font-size: 12px;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.compare-item-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ff4d4f;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-item-remove:hover {
    background: #ff7875;
}

.compare-bar-empty {
    text-align: center;
    padding: 30px 15px;
    color: #999;
}

.compare-bar-empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.3;
}

.compare-bar-footer {
    padding: 10px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
    border-radius: 0 0 12px 12px;
}

.compare-bar-actions {
    display: flex;
    gap: 8px;
}

.compare-btn {
    flex: 1;
    padding: 8px 4px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.compare-btn-clear {
    background: #fff;
    color: #666;
    border: 1px solid #d9d9d9;
}

.compare-btn-clear:hover {
    color: #ff4d4f;
    border-color: #ff4d4f;
}

.compare-btn-compare {
    background: linear-gradient(135deg, #0a4480, #1a5490);
    color: #fff;
}

.compare-btn-compare:hover {
    background: linear-gradient(135deg, #083d6e, #0a4480);
}

.compare-btn-compare:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 产品对比按钮 - 通用的 */
.add-compare-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #0a4480, #1a5490);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-compare-btn:hover {
    background: linear-gradient(135deg, #083d6e, #0a4480);
    transform: scale(1.05);
}

.add-compare-btn.added {
    background: #52c41a;
}

.add-compare-btn.added:hover {
    background: #73d13d;
}

.detail-compare-btn{
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #0a4480, #1a5490);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}
/* 产品卡片已选中状态 */
.product-card.in-compare,
.product-item.in-compare {
    border-color: #0a4480 !important;
    box-shadow: 0 4px 12px rgba(10, 68, 128, 0.15);
}

/* 响应式 */
@media (max-width: 768px) {
    .compare-bar {
        width: 180px;
        right: 15px;
    }

    .compare-float-btn {
        width: 50px;
        height: 50px;
        right: 15px;
    }
}

/* 产品列表页面卡片样式 */
.products_list .product-item {
    position: relative;
}

.products_list .product-item a {
    display: block;
    transition: all 0.3s ease;
}

.products_list .product-item:hover {
    box-shadow: 0 4px 12px rgba(10, 68, 128, 0.15);
}

.products_list .product-item.in-compare a {
    border-color: #0a4480 !important;
}
