/* ---- 产品页整体 ---- */
.product-page {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

/* 左右栏 */
.product-gallery { flex: 1; max-width: 580px; }
.product-info { flex: 1; max-width: 580px; }

/* ---- 大图区域 ---- */
.product-gallery {
    width: 100%;        /* 手机端占满宽度 */
    max-width: 580px;
    flex: 1;
}

#mainImage {
    opacity: 1;
    transition: opacity 0.35s ease;
}

#mainImage.fade-out {
    opacity: 0;
}


.image-view {
    position: relative;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
}

#mainImageContainer {
    position: relative;
    width: 100%;
    max-width: 580px;
    margin: auto;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    overflow: hidden;
}

/* 放大镜 */
#lens {
    position: absolute;
    border: 2px solid #000;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: none;
    pointer-events: none;
    background-repeat: no-repeat;
    z-index: 20;
}

/* 大图容器，用于定位箭头 */
#mainImageContainer {
    position: relative;
    width: 100%;
    max-width: 580px;
    margin: auto;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    overflow: hidden;
}

/* 小图区域 */
#thumbsContainer {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5列 */
    gap: 5px;
    padding: 10px;
    background: #f8f8f8;
}

.thumb-item {
    width: 100%;
    aspect-ratio: 1 / 1;  /* 正方形 */
    overflow: hidden;
    position: relative;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;   /* ★ 关键：裁剪 */
    object-position: center; /* ★ 居中 */
}








.thumb-item.active {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0,123,255,.5);
}

.thumb-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

/* ---- 左右箭头按钮 ---- */
#prevBtn,
#nextBtn {
    position: absolute;
    top: 50%;                       /* 垂直居中 */
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 10px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background 0.3s;
}


/* 紧贴大图边缘 */
#prevBtn { left: 10px; }
#nextBtn { right: 10px; }

/* 鼠标悬停效果 */
#prevBtn:hover,
#nextBtn:hover {
    background: rgba(255,255,255,1);
}

/* ---- 产品信息 ---- */
.product-info {
    flex: 1;
    min-width: 300px;
}

.price {
    font-size: 28px;
    font-weight: bold;
    color: #e63946;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
    /* 手机/平板隐藏箭头 */
    #thumbsContainer { grid-template-columns: repeat(5, 1fr); }

    #prevBtn,
    #nextBtn {
        display: none;
    }

    #thumbsContainer {
        grid-template-columns: repeat(4, 1fr);
    }
    .product-page {
    flex-direction: column; /* 上下排列 */
    gap: 15px;
    
      .product-gallery,
  .product-info {
    max-width: 100%; /* 占满全屏宽度 */
  }
  }
}

@media (max-width: 480px) {
    #thumbsContainer {
        grid-template-columns: repeat(3, 1fr);
    }
}
