/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

body {
  background-color: #f5f5f7;
  color: #2d2d2f;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll; /* 解决滚动条导致的晃动 */
  scroll-behavior: smooth; /* 全局平滑滚动 */
}

/* 导航栏样式 */
.nav {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1d1d1f;
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

.logo:hover {
  color: #0066cc;
}

/* 产品列表页样式 */
.container {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 30px;
}

.page-title {
  text-align: center;
  margin-bottom: 50px;
  font-size: 2.2rem;
  color: #1d1d1f;
  font-weight: 500;
  letter-spacing: -0.03em;
  position: relative;
  padding-bottom: 15px;
}

.page-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background-color: #0066cc;
}

/* 标签页导航样式 - 优化滚动体验 + 布局适配 */
.tab-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eaeaea;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-right: 10px;
  /* 新增：滚动吸附，提升体验 */
  scroll-snap-type: x mandatory;
  /* 新增：隐藏滚动条但保留功能（兼容更多浏览器） */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 新增：彻底隐藏webkit内核滚动条 */
.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 12px 24px;
  background-color: #f0f0f2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  color: #424245;
  white-space: nowrap;
  /* 新增：滚动吸附点 */
  scroll-snap-align: start;
  /* 核心增强：更顺滑的过渡曲线和更长过渡时间 */
  transition: background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
              transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
              box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* 激活状态增强：发光+底部装饰条 + 新增:active状态锁定 */
.tab-btn.active {
  background-color: #0066cc;
  color: white;
  /* 增强发光效果，增加层次感 */
  box-shadow: 0 4px 15px rgba(0, 102, 204, 0.25);
  /* 新增：激活态禁止点击反馈 */
  pointer-events: none;
}

/* 激活按钮底部装饰条（动态扩展效果） */
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 10%;
  width: 80%;
  height: 3px;
  background-color: #66ccff;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 激活按钮hover时装饰条扩展 */
.tab-btn.active:hover::after {
  width: 90%;
}

/* 非激活按钮hover效果：上浮+阴影加深 + 新增按压反馈优化 */
.tab-btn:hover:not(.active) {
  background-color: #e4e4e7;
  /* 增强上浮距离，更明显的交互反馈 */
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

/* 点击反馈：轻微下沉，模拟按压感 + 优化过渡速度 */
.tab-btn:active:not(.active) {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.1s ease;
}

.tab-content {
  width: 100%;
  min-height: calc(100vh - 300px); /* 稳定容器高度 */
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.5s ease;
  /* 新增：激活面板时的焦点管理（无障碍） */
  animation-delay: 0.1s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 产品网格布局 - 优化响应式断点 + 间距 */
.product-grid {
  display: grid;
  /* 优化：最小宽度调整为280px，适配更小屏幕 */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px; /* 调整间距，更紧凑 */
  /* 新增：网格项对齐 */
  align-items: start;
}

.product-card {
  background-color: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  position: relative;
  /* 新增：防止卡片内容溢出 */
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* 新增：卡片角标（示例，可根据业务调整） */
.product-card::before {
  content: '';
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  background-color: rgba(0, 102, 204, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0066cc;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.product-card:hover::before {
  opacity: 1;
  content: 'view';
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.product-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.7s ease;
  /* 新增：图片加载过渡 */
  opacity: 0;
  animation: imgFadeIn 0.5s ease forwards;
}

/* 新增：图片加载动画 */
@keyframes imgFadeIn {
  to { opacity: 1; }
}

.product-card:hover .product-img {
  transform: scale(1.03);
}

.product-info {
  padding: 25px;
  /* 新增：内容自适应高度 */
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: #1d1d1f;
  font-weight: 500;
  line-height: 1.3;
  /* 新增：文字溢出处理 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-Size,
.product-Weight,
.product-desc {
  color: #6e6e73;
  font-size: 0.95rem;
  margin-bottom: 8px;
  line-height: 1.6;
  /* 新增：描述文字溢出处理 */
}

.product-desc {
  /* 新增：描述多行溢出 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.product-Size:last-child,
.product-Weight:last-child {
  margin-bottom: 0;
}

/* 产品详情页样式 - 优化布局 + 交互 */
.product-detail {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 30px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  margin-bottom: 30px;
  color: #0066cc;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.3s ease, transform 0.3s ease;
  /* 新增：按钮触摸反馈 */
  padding: 8px 12px;
  border-radius: 6px;
}

.back-btn::before {
  content: '←';
  margin-right: 6px;
}

.back-btn:hover {
  color: #0052a3;
  background-color: rgba(0, 102, 204, 0.05);
  transform: translateX(-3px);
}

.back-btn:active {
  transform: translateX(-1px);
}

.detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  background-color: #fff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
  /* 新增：细节优化 */
  position: relative;
  overflow: hidden;
}

/* 新增：详情页顶部装饰 */
.detail-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #0066cc, #66ccff);
}

/* 图片预览容器增强 */
.main-img-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
  /* 新增：加载占位 */
  background-color: #f5f5f7;
}

.detail-img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  transition: all 0.4s ease;
  /* 新增：图片加载过渡 */
  opacity: 0;
  animation: imgFadeIn 0.5s ease forwards;
}

/* 图片预览遮罩层（点击放大） - 优化交互 */
.img-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
  /* 新增：防止页面滚动 */
  overflow: hidden;
}

.img-preview-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

/* 新增：预览图双击关闭 */
.preview-img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.preview-img:hover {
  transform: scale(1.01);
}

.thumbnail-container {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
  /* 新增：滚动吸附 */
  scroll-snap-type: x mandatory;
}

.thumbnail-container::-webkit-scrollbar {
  height: 4px;
}

.thumbnail-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.thumbnail {
  width: 90px;
  height: 90px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: all 0.3s ease;
  /* 新增：滚动吸附 + 加载过渡 */
  scroll-snap-align: start;
  opacity: 0;
  animation: imgFadeIn 0.5s ease forwards;
}

.thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.thumbnail.active {
  border-color: #0066cc;
  box-shadow: 0 0 0 1px rgba(0, 102, 204, 0.3);
}

.detail-info h1 {
  font-size: 2.1rem;
  margin-bottom: 25px;
  color: #1d1d1f;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.03em;
  /* 新增：标题溢出处理 */
  overflow-wrap: break-word;
}

/* 参数面板增强 - 优化布局 + 交互 */
.params {
  margin-top: 30px;
  border-top: 1px solid #f0f0f0;
  padding-top: 25px;
  /* 新增：参数面板内边距 */
  padding-right: 10px;
}

.param-item {
  margin-bottom: 18px;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #f7f7f7;
  transition: background-color 0.2s ease;
  padding: 10px 15px;
  border-radius: 8px;
  /* 新增：参数项动画 */
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

/* 新增：参数项逐行动画延迟 */
.param-item:nth-child(1) { animation-delay: 0.1s; }
.param-item:nth-child(2) { animation-delay: 0.2s; }
.param-item:nth-child(3) { animation-delay: 0.3s; }
.param-item:nth-child(4) { animation-delay: 0.4s; }
.param-item:nth-child(5) { animation-delay: 0.5s; }

/* 参数项hover高亮 */
.param-item:hover {
  background-color: #f9f9fc;
  transform: translateX(3px);
}

.param-item:last-child {
  border-bottom: none;
}

.param-label {
  font-weight: 500;
  color: #424245;
  /* 新增：标签宽度固定，对齐更整齐 */
  flex: 0 0 40%;
  max-width: 40%;
}

.param-value {
  color: #0066cc; /* 参数值高亮为主题色 */
  font-weight: 500; /* 加粗突出参数值 */
  text-align: right;
  flex: 0 0 55%;
  max-width: 55%;
  /* 新增：数值溢出处理 */
  overflow-wrap: break-word;
}

/* 加载中动画（图片切换时） - 优化样式 */
.loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f5f5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  /* 新增：加载动画背景渐变 */
  background: linear-gradient(145deg, #f5f5f7, #fafafa);
}

.loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid #e0e0e0;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  /* 新增：加载动画缩放效果 */
  animation: spin 1s linear infinite, pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 新增：加载动画脉冲效果 */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* 响应式调整 - 优化断点 + 交互 */
@media (max-width: 992px) {
  /* 新增：平板断点优化 */
  .detail-container {
    gap: 40px;
    padding: 30px;
  }
  
  .detail-img {
    height: 400px;
  }
}

@media (max-width: 768px) {
  .tab-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
  
  .detail-container {
    grid-template-columns: 1fr;
    padding: 25px;
    gap: 30px;
  }
  
  .detail-img {
    height: 350px;
  }
  
  .thumbnail {
    width: 70px;
    height: 70px;
  }
  
  /* 新增：移动端标签页间距优化 */
  .tab-nav {
    gap: 8px;
    margin-bottom: 30px;
  }
  
  /* 新增：移动端产品卡片图片高度 */
  .product-img {
    height: 240px;
  }
}

@media (max-width: 576px) {
  .page-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
  }
  
  .product-grid {
    gap: 25px;
    /* 新增：移动端网格1列 */
    grid-template-columns: 1fr;
  }
  
  .product-img {
    height: 220px;
  }
  
  .detail-img {
    height: 280px;
  }
  
  .detail-info h1 {
    font-size: 1.7rem;
  }
  
  .param-item {
    flex-direction: column;
    gap: 5px;
    padding: 8px 10px;
  }
  
  .param-label {
    flex: 1;
    max-width: 100%;
    margin-bottom: 5px;
  }
  
  .param-value {
    text-align: left;
    flex: 1;
    max-width: 100%;
    margin-top: 5px;
  }
  
  .preview-img {
    max-width: 95%;
    max-height: 80vh;
  }
  
  /* 新增：移动端返回按钮优化 */
  .back-btn {
    margin-bottom: 20px;
  }
  
  /* 新增：移动端详情容器内边距 */
  .detail-container {
    padding: 20px 15px;
  }
}

/* 新增：暗黑模式适配（可选） */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1c1c1e;
    color: #f5f5f7;
  }
  
  .nav {
    background-color: rgba(30, 30, 32, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .logo {
    color: #f5f5f7;
  }
  
  .page-title {
    color: #f5f5f7;
  }
  
  .tab-nav {
    border-bottom-color: #333;
  }
  
  .tab-btn {
    background-color: #2c2c2e;
    color: #e5e5e7;
  }
  
  .tab-btn:hover:not(.active) {
    background-color: #3a3a3c;
  }
  
  .product-card {
    background-color: #2c2c2e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  }
  
  .product-name {
    color: #f5f5f7;
  }
  
  .product-Size,
  .product-Weight,
  .product-desc {
    color: #d1d1d6;
  }
  
  .detail-container {
    background-color: #2c2c2e;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  }
  
  .param-label {
    color: #e5e5e7;
  }
  
  .loading {
    background: linear-gradient(145deg, #2c2c2e, #3a3a3c);
  }
  
  .loading::after {
    border-color: #444;
    border-top-color: #0066cc;
  }
}

/* 新增：打印样式优化 */
@media print {
  .nav, .back-btn, .tab-nav, .img-preview-overlay {
    display: none !important;
  }
  
  .product-card, .detail-container {
    box-shadow: none !important;
    border: 1px solid #ddd;
  }
  
  body {
    background-color: white !important;
  }
}
