/**
 * 相关产品组件样式 (related-products.css)
 *
 * 这个文件包含相关产品组件的样式，基于产品列表组件样式复刻
 */

/*--------------------------------------------------------------
1. 相关产品容器样式
--------------------------------------------------------------*/
/* 相关产品区域 */
.related-products-section {
    margin-top: 60px;
    padding: 40px 0 0 0;
    border-top: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
    clear: both;
    overflow: hidden;
}

/* 相关产品标题 */
.related-products-title {
    font-size: 14px !important; /* 固定为14px */
    font-weight: var(--font-medium);
    margin-bottom: 30px;
    padding: 0 30px; /* 添加左右内边距，与首页推荐产品一致 */
    text-align: left;
}

/* 相关产品网格 */
.related-products-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 30px; /* 添加左右内边距，与首页推荐产品一致 */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 0 !important;
    list-style: none;
    width: calc(100% - 60px) !important; /* 考虑左右内边距 */
}

/* 隐藏滚动条 */
.related-products-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.related-products-grid {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/*--------------------------------------------------------------
2. 相关产品卡片样式
--------------------------------------------------------------*/
/* 产品卡片容器 */
.related-product {
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: none;
    transition: transform 0.3s ease;
    margin-bottom: 20px;
    overflow: hidden;
    flex: 0 0 300px;
    min-width: 300px;
    width: 300px;
}

/* 移除产品卡片悬停缩放效果 */
.related-product:hover {
    transform: none !important;
}

/* 产品图片容器 */
.related-product-image-container {
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
}

/* 产品图片 */
.related-product-image-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* 移除产品图片悬停缩放效果 */
.related-product:hover .related-product-image-container img {
    transform: none !important;
}

/* 产品信息容器 */
.related-product-info {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
}

/* 产品标题 */
.related-product-title {
    font-size: 11px !important; /* 固定为11px */
    font-weight: var(--font-medium);
    margin-bottom: 5px;
    color: var(--color-text);
    white-space: nowrap; /* 禁止回行 */
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
}

/* 产品链接 */
.related-product-link {
    text-decoration: none;
    color: inherit;
}

/* 产品价格 */
.related-product-price {
    font-size: 11px !important; /* 固定为11px */
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 5px;
}

.related-product-current-price {
    font-weight: var(--font-bold);
}

.related-product-original-price {
    text-decoration: line-through;
    color: var(--color-text-light);
}

/* 产品颜色变体 */
.related-product-colors {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
    margin-top: 5px;
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    position: relative;
    transition: transform 0.2s ease;
}

/* 可点击的颜色变体 */
.color-dot.clickable {
    cursor: pointer;
}

/* 不可点击的颜色变体 */
.color-dot.non-clickable {
    cursor: default;
    opacity: 0.9;
}

/* 颜色变体悬停效果 - 只对可点击的应用 */
.color-dot.clickable:hover {
    transform: scale(1.2);
    z-index: 2;
}

/*--------------------------------------------------------------
3. 产品图片比例修复
--------------------------------------------------------------*/
/* 相关产品图片比例修复 */
.related-product-image-container {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 100% !important; /* 1:1图片比例 */
    overflow: hidden !important;
    aspect-ratio: 1/1 !important; /* 现代浏览器支持 */
}

/* 确保图片正确填充容器 */
.related-product-image-container img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/*--------------------------------------------------------------
4. 产品操作按钮
--------------------------------------------------------------*/
/* 产品操作按钮容器 */
.related-product-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 5;
}

/* 产品卡片悬停时显示操作按钮 */
.related-product:hover .related-product-actions {
    opacity: 1;
    visibility: visible;
}

/* 操作按钮基本样式 */
.related-product-action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 3px;
    border-radius: 0;
    border: none;
}

/* 操作按钮悬停效果 */
.related-product-action-btn:hover {
    background-color: #fff;
}

/* 图标样式 */
.related-product-action-btn svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: #555;
    stroke-width: 2;
    transition: all 0.2s ease;
}

/* 已添加状态 */
.related-product-action-btn.added svg {
    fill: #555;
}

/* 缺货购物车按钮 */
.related-product-action-btn.out-of-stock {
    cursor: not-allowed;
    opacity: 0.5;
}

.related-product-action-btn.out-of-stock svg {
    stroke: #999;
}

/* 添加到购物车/心愿单动画 */
@keyframes addedAnimation {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.related-product-action-btn.adding {
    animation: addedAnimation 0.5s ease;
}

/*--------------------------------------------------------------
5. 响应式样式
--------------------------------------------------------------*/
@media (max-width: 768px) {
    .related-products-title {
        padding: 0 20px; /* 移动设备上减少左右内边距 */
    }

    .related-products-grid {
        gap: 15px;
        padding: 10px 20px; /* 移动设备上减少左右内边距 */
        width: calc(100% - 40px) !important; /* 考虑左右内边距 */
    }

    .related-product {
        flex: 0 0 250px;
        min-width: 250px;
        width: 250px;
    }

    .related-product-action-btn {
        width: 20px;
        height: 20px;
    }

    .related-product-action-btn svg {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    .related-products-title {
        padding: 0 15px; /* 小屏幕设备上进一步减少左右内边距 */
    }

    .related-products-grid {
        gap: 10px;
        padding: 10px 15px; /* 小屏幕设备上进一步减少左右内边距 */
        width: calc(100% - 30px) !important; /* 考虑左右内边距 */
    }

    .related-product {
        flex: 0 0 220px;
        min-width: 220px;
        width: 220px;
    }

    .related-product-action-btn {
        width: 18px;
        height: 18px;
    }

    .related-product-action-btn svg {
        width: 9px;
        height: 9px;
    }
}
