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

.product-detail-main {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: flex-start;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    flex-direction: row; /* 确保是水平方向的布局 */
}

/* 左侧商品图片区域 */
.product-gallery {
    flex: 0 0 45%; /* 固定宽度为45% */
    position: relative;
    margin-right: 2rem;
}

/* 右侧商品信息区域 */
.product-info {
    flex: 0 0 50%; /* 减小宽度以防止溢出 */
    display: flex;
    flex-direction: column;
    border-left: 1px solid #eee;
    padding: 0 0 0 2rem; /* 只保留左侧padding */
    box-sizing: border-box; /* 确保padding包含在宽度内 */
}

.main-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #333;
}

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

.product-meta {
    margin-bottom: 1.5rem;
}

.product-meta > div {
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
}

.label {
    color: #666;
    min-width: 60px;
    margin-right: 0.5rem;
}

.product-price {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    justify-content: flex-start; /* 确保价格左对齐 */
}

.price {
    font-size: 1.2rem;
    color: #e53935;
    font-weight: bold;
    margin-left: 0.5rem;
    text-align: left; /* 确保价格文本左对齐 */
}

.product-quantity {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
}

.quantity-btn:hover {
    background: #f5f5f5;
}

#quantity {
    width: 50px;
    height: 1.5rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 0.5rem;
}

.stock {
    color: #666;
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

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

.product-actions .btn {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #e53935;
    color: white;
    border: none;
}

.btn-secondary {
    background-color: #fff;
    color: #e53935;
    border: 1px solid #e53935;
}

.product-tabs {
    margin: 3rem 0;
}

.tab-header {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    position: relative;
}

.tab-btn.active {
    color: #e53935;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #e53935;
}

.tab-content {
    padding: 1rem 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.related-products {
    margin: 3rem 0;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: #333;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.product-card {
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-card .product-image {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    margin-bottom: 0;
}

.product-card .product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}



.product-card .product-info {
    padding: 1rem;
    border-left: none; /* 移除卡片中的左边框 */
}

.product-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #333;
}

.product-card .product-desc {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    /* 主要多行文本截断方案 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 备用方案 */
    max-height: 2.7em;
    line-height: 1.35em;
    position: relative;
}

.product-card .product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.product-card .product-price {
    color: #e53935;
    font-weight: bold;
    font-size: 1.1rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-detail-main {
        flex-direction: column;
        gap: 2rem;
    }

    .product-gallery,
    .product-info {
        flex: 0 0 100%;
        width: 100%;
    }

    .product-info {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #eee;
        padding-top: 1.5rem;
        margin-top: 1rem;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-card .product-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .product-gallery {
        margin-right: 0;
        margin-bottom: 1rem;
    }

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

    .tab-header {
        overflow-x: auto;
        white-space: nowrap;
    }

    .tab-btn {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .product-detail-main {
        flex-direction: column;
        padding: 1rem;
    }
    
    .product-title {
        font-size: 1.5rem;
    }

    .product-price .price {
        font-size: 1.2rem;
    }

    .product-quantity {
        flex-wrap: wrap;
    }

    .stock {
        margin-left: 0;
        margin-top: 0.5rem;
        width: 100%;
    }

    .product-actions .btn {
        padding: 0.8rem;
    }

    .product-meta > div {
        flex-wrap: wrap;
    }
}