/* 产品详情页样式 */
.product-detail {
    background: white;
    border-radius: 15px;
    padding: 3rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 3rem;
    /* 关键修复1：确保这里不遮挡弹出的放大镜 */
    position: relative;
    z-index: 1;
}

/* 京东式放大镜 */
.product-gallery {
    display: flex;
    gap: 2rem;
    /* 关键修复2：作为定位基准，确保放大镜窗口定位准确 */
    position: relative;
}

.thumbnail-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    opacity: 0.6;
}

.thumbnail:hover,
.thumbnail.active {
    border-color: var(--accent-color);
    opacity: 1;
    transform: scale(1.05);
}

.main-image-container {
    position: relative;
    flex: 1;
    height: 400px;
    /* 关键修复3：删除了 overflow: hidden，否则放大窗口会被切掉不可见 */
    border-radius: 10px;
    border: 1px solid #e9ecef;
    cursor: crosshair;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.zoom-lens {
    position: absolute;
    border: 1px solid #aaa;
    background-color: rgba(255, 255, 0, 0.2);
    /* 半透明黄 */
    width: 100px;
    height: 100px;
    display: none;
    /* 关键修复4：鼠标穿透透镜，防止鼠标进入透镜后触发mouseleave导致闪烁 */
    pointer-events: none;
    z-index: 10;
}

.zoom-result {
    position: absolute;
    top: 0;
    left: 100%;
    /* 紧贴主图右侧 */
    margin-left: 15px;
    /* 稍微留点空隙 */
    width: 450px;
    height: 450px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background-repeat: no-repeat;
    background-color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    /* 关键修复5：极高的层级，确保覆盖右侧文字 */
    z-index: 9999;
    display: none;
}

.product-info-detail {
    padding: 2rem 0;
}

.product-title-detail {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.product-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item i {
    color: var(--accent-color);
}

.product-description-detail {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 2rem;
}

.product-specs {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.specs-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.specs-table {
    width: 100%;
}

.specs-table tr {
    border-bottom: 1px solid #e9ecef;
}

.specs-table tr:last-child {
    border-bottom: none;
}

.specs-table td {
    padding: 0.8rem 0;
    font-size: 0.95rem;
}

.specs-table td:first-child {
    font-weight: 600;
    color: #333;
    width: 30%;
}

.specs-table td:last-child {
    color: #666;
}

.product-features-detail {
    margin-bottom: 2rem;
}

.features-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* product-detail.css */

.features-grid {
    display: grid;
    /* 核心修改：使用 auto-fill 和 minmax 自动适应宽度，每列最小260px */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #0d6efd; /* 悬停时边框变色，增加交互感 */
}

.feature-icon {
    font-size: 2rem;
    color: #0d6efd;
    margin-right: 1.2rem;
    line-height: 1;
    flex-shrink: 0; /* 防止图标被压缩 */
}

.feature-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.feature-text p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0;
    line-height: 1.5;
}

.product-actions-detail {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn-action {
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary-action {
    background: var(--accent-color);
    color: white;
}

.btn-primary-action:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-outline-action {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline-action:hover {
    background: var(--primary-color);
    color: white;
}

/* 相关产品 */
.related-products {
    margin-top: 4rem;
}

.related-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 2rem;
    text-align: center;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.product-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.product-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-item:hover .product-image img {
    transform: scale(1.1);
}

.product-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-category-tag {
    display: inline-block;
    background: rgba(0, 86, 179, 0.1);
    color: var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-product {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary-product {
    background: var(--primary-color);
    color: white;
}

.btn-primary-product:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}

.btn-outline-product {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline-product:hover {
    background: var(--primary-color);
    color: white;
}


/* 产品元数据容器 */
.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* 标签之间的间距 */
    margin-bottom: 25px;
    align-items: center;
}

/* 标签基础样式 */
.spec-tag {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 50px; /* 胶囊形状 */
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    cursor: default;
    transition: all 0.3s ease;
    border: 1px solid transparent; /* 预留边框位置 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

/* 鼠标悬停微动效 */
.spec-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* ----- 颜色定义 (背景色 + 文字色 + 边框色) ----- */

/* 蓝色系 - 适合产品类型 */
.tag-blue {
    background-color: #e8f4ff;
    color: #007bff;
    border-color: #cce5ff;
}

/* 绿色系 - 适合防护等级/环保 */
.tag-green {
    background-color: #e6fffa;
    color: #00a884;
    border-color: #b2f5ea;
}

/* 橙色系 - 适合温度/警示参数 */
.tag-orange {
    background-color: #fffaf0;
    color: #dd6b20;
    border-color: #feebc8;
}

/* 紫色系 - 适合认证/特殊工艺 */
.tag-purple {
    background-color: #faf5ff;
    color: #805ad5;
    border-color: #e9d8fd;
}

.tag-red {
    background-color: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* 2. 科技青：适合“防水”、“信号传输”、“高速” */
.tag-cyan {
    background-color: #ecfeff;
    color: #0891b2;
    border-color: #a5f3fc;
}

/* 3. 工业灰/暗夜黑：适合“材质”、“金属”、“型号” (非常硬核) */
.tag-dark {
    background-color: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}

/* 4. 活力粉/玫红：适合“新品”、“特价”、“定制” (非常吸睛) */
.tag-pink {
    background-color: #fdf2f8;
    color: #db2777;
    border-color: #fbcfe8;
}

/* 5. 琥珀金/橙黄：适合“高压”、“等级”、“推荐” */
.tag-gold {
    background-color: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

/* 6. 靛青紫 (比之前的紫色更深更专业)：适合“协议”、“芯片” */
.tag-indigo {
    background-color: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

.social-icons a {
    color: white;
    font-size: 1.5rem;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}


/* 1. 标题固定占2行 */
.related-products .product-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.4;
    height: 2.8em; /* 1.4 * 2 = 2.8em */
    margin-bottom: 8px;
    word-break: break-word;
}

/* 2. 描述固定占2行 */
.related-products .product-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.5;
    height: 3em; /* 1.5 * 2 = 3em */
    margin-bottom: 15px;
    word-break: break-word;
}


/* 响应式设计 */
@media (max-width: 768px) {
    .product-detail {
        padding: 2rem 1.5rem;
    }

    .product-title-detail {
        font-size: 1.5rem;
    }

    .product-meta {
        gap: 1rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    /* 移动端禁用放大镜 */
    .zoom-result,
    .zoom-lens {
        display: none !important;
    }

    .product-gallery {
        flex-direction: column;
    }

    .thumbnail-column {
        flex-direction: row;
        justify-content: center;
    }

    .main-image-container {
        height: 300px;
    }
}