/* ==========================================================================
   基础布局与容器
   ========================================================================== */
.product-container {
  display: -ms-flexbox;
  /* IE10 兼容 */
  display: flex;
  align-items: flex-start;
  /* 关键：防止侧边栏高度填满父容器 */
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  /* 为 IE 绝对定位做准备 */
}

.sidebar {
  width: 20%;
  background: #fff;
  border-right: 1px solid #e0e0e0;

  /* 现代浏览器原生固定 */
  position: -webkit-sticky;
  position: sticky;
  top: 85px;
  /* 距离顶部的距离，根据你的 Header 高度调整 */
  z-index: 100;

  /* 防止在某些浏览器下溢出 */
  align-self: flex-start;
}

.sidebar.ie-fixed {
  position: fixed;
  top: 85px;
  /* 宽度会由 JS 动态计算 */
  z-index: 1000;
}

.sidebar.ie-absolute {
  position: absolute;
  bottom: 0;
  top: auto;
  left: 0;
}

.product-content {
  -ms-flex: 1;
  flex: 1;
  padding: 0 15px;
  min-width: 0;
  box-sizing: border-box;
}

/* ==========================================================================
   侧边栏导航 (Sidebar)
   ========================================================================== */
.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-item {
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  cursor: pointer;
}

.sidebar-parent-link {
  text-decoration: none;
  color: #333;
  flex: 1;
}

.sidebar-toggle {
  font-size: 12px;
  color: #666;
  margin-left: 5px;
  transition: transform 0.2s;
}

.sidebar-children {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 5px 0;
  background: #f9f9f9;
}

.sidebar-children li a {
  display: block;
  padding: 12px 10px;
  text-decoration: none;
  color: #333;
  font-size: 13px;
}

.sidebar-parent:hover,
.sidebar-children li a:hover {
  background: #f2f6ff;
}

.sidebar-item.open>.sidebar-children {
  display: block;
}

.sidebar-item.open .sidebar-toggle {
  transform: rotate(180deg);
}

.sidebar-item.active>.sidebar-parent {
  background: #3b82d4;
}

.sidebar-item.active .sidebar-parent-link,
.sidebar-item.active .sidebar-toggle {
  color: #fff;
  font-weight: bold;
}

.sidebar-children li.active {
  background-color: #f0f7ff;
}

.sidebar-children li.active a {
  color: #1e6dc9;
  font-weight: bold;
}

/* ==========================================================================
   分类列表卡片 (Category Cards)
   ========================================================================== */
.sub-category-list {
  display: flex;
  flex-wrap: wrap;
}

.category-card {
  width: 21.5%;
  border: 1px solid #ccc;
  margin: 18px;
  text-align: center;
  box-sizing: border-box;
  background: #fff;
}

.category-card a {
  display: block;
  color: #333;
  text-decoration: none;
}

.card-image-box {
  width: 100%;
  position: relative;
  height: 0;
  padding-bottom: 74.074%;
  overflow: hidden;
}

.category-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  padding: 16px;
}

.category-card-placeholder {
  width: 100%;
  height: 120px;
  background: #eee;
}

.category-card-name {
  padding: 6px;
  font-weight: bold;
}

/* ==========================================================================
   分类简介部分 (Category Intro)
   ========================================================================== */
.category-intro-container {
  display: -ms-flexbox;
  display: flex;
  margin-bottom: 30px;
}

.category-intro-image {
  -ms-flex: 0 0 280px;
  flex: 0 0 280px;
  padding: 20px;
  text-align: center;
  box-sizing: border-box;
  background-color: #fff;
}

.category-intro-image img {
  max-width: 100%;
  height: auto;
}

.category-intro-text {
  width: 100%;
  box-sizing: border-box;
  margin-left: 20px;
  background: #fff;
}

.category-intro-text h2 {
  color: #333;
  margin: 0;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}

.category-intro-body {
  padding: 20px;
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.category-intro-body ul {
  margin: 10px 0 0 18px;
  color: #666;
  font-size: 13px;
}

.description-text {
  line-height: 2;
}

/* ==========================================================================
   产品规格表格 (Spec Table) - 兼容性修改版
   ========================================================================== */
.product-group-label {
  color: #1e6dc9;
  padding-left: 10px;
  margin: 25px 0 15px 0;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  text-transform: capitalize;
}

.product-table-wrapper {
  width: 100%;
  margin-bottom: 25px;
  display: block;
  /* 关键：在IE下必须设为visible，配合JS进行表头模拟固定 */
  overflow: visible;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
  background: #fff;
}

.spec-table thead tr {
  background: #1e6dc9;
}

.spec-table th {
  padding: 10px 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: normal;
  text-align: start;
  color: #fff;
  position: -webkit-sticky;
  position: sticky;
  top: 85px;
  z-index: 900;
  background-color: #3b82d4;
  transition: background 0.2s;
  background-clip: padding-box;
  white-space: normal !important;
  word-wrap: break-word;
  word-break: normal;
  text-align: center;
}

.spec-table td {
  padding: 8px 5px;
  text-align: center;
  border: 1px solid #e0e0e0;
  color: #333;
  background-clip: padding-box;
}

.spec-table tbody tr:hover {
  background-color: #f2f7ff;
}

.spec-table td a {
  color: #0056b3;
  text-decoration: underline;
  font-weight: bold;
}

.spec-table td a:hover {
  text-decoration: underline;
  color: #d9534f;
}

.spec-table tbody tr:nth-child(even) {
    background-color: #f9f9f9; /* 浅灰色背景，你可以根据需要修改颜色 */
}

/* 排序箭头样式 */
th::after {
  content: '\25B4';
  font-size: 20px;
  margin-left: 5px;
  display: inline-block;
  color: #fff;
  opacity: 0;
  line-height: 1;
  transition: all 0.2s;
}

th:hover::after {
  opacity: 0.5;
}

th.sort-asc::after {
  content: '\25B4';
  opacity: 1;
}

th.sort-desc::after {
  content: '\25BE';
  opacity: 1;
}

/* ==========================================================================
   面包屑与文章内容
   ========================================================================== */
.product-details-container {
  background: #fff;
}

.product-details {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px;
  min-height: 400px;
}

.breadcrumb {
  padding: 10px 0 20px 0;
  font-size: 14px;
  color: #666;
  border-bottom: 1px solid #f5f5f5;
}

.breadcrumb a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: #1e6dc9;
  text-decoration: underline;
}

.breadcrumb .sep {
  margin: 0 8px;
  color: #ccc;
  font-family: Arial, sans-serif;
}

.breadcrumb .current {
  color: #1e6dc9;
  font-weight: bold;
}

.entry-content>p:first-child {
  margin-top: 72px;
  text-align: center;
}

.entry-content>p:first-child strong {
  font-size: 32px;
}

.entry-content table {
  border-collapse: collapse;
  width: 100%;
}

.entry-content table th,
.entry-content td {
  border: 1px solid #ddd;
  padding: 8px;
  white-space: nowrap !important;
}

.entry-content table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.entry-content table tr:nth-child(odd) {
  background-color: #fff;
}

.entry-content img {
  width: 100%;
  height: auto;
}

/* ==========================================================================
   响应式布局优化 (Media Queries)
   ========================================================================== */

/* 针对大屏幕 (1200px) */
@media (max-width: 1200px) {
  .category-card {
    width: calc(50% - 36px);
  }

  .product-table-wrapper {
    overflow: auto;
    max-height: 75vh;
    border: 1px solid #eee;
  }

  .spec-table thead th {
    top: 0 !important;
    text-align: left;
    word-break: keep-all;
    overflow-wrap: normal;
    white-space: normal;
  }
}

@media (max-width: 768px) {
  body {
    background: #fff !important;
  }

  .product-container {
    padding: 10px;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
  }

  .sidebar-list {
    display: none;
  }

  .sidebar.active .sidebar-list {
    display: block;
  }

  .product-content {
    padding: 0;
  }

  .category-intro-container {
    flex-direction: column;
  }

  .category-intro-image {
    width: 92vw;
    margin-bottom: 15px;
  }

  .category-intro-text {
    width: 92vw;
    margin-left: 0;
  }

  .product-main-content {
    overflow: auto;
  }
}

/* 针对移动端 (768px 以下) */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .category-card {
    width: calc(100% - 36px);
    margin: 10px 18px;
  }

  .product-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #eee;
  }

  .spec-table {
    min-width: 600px;
  }

  .product-table-wrapper {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #eee;
    max-height: 65vh;
  }

  .spec-table {
    min-width: 800px;
  }

  .spec-table thead th {
    top: 0 !important;
  }

  .entry-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid #ddd;
  }
}

/* 产品详情页辅助组件 */
.product-action-bar {
  margin-top: 50px;
  padding: 20px 0;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
}

.product-header-action {
  position: relative;
  margin-top: 20px;
}

.btn-pdf-top {
  position: absolute;
  top: 0;
  right: 0;
  color: #1e6cbf;
  font-weight: 600;
  padding: 16px;
  border-radius: 4px;
  text-decoration: underline;
}

.entry-content table:first-of-type tr:first-child {
  background-color: #1e6cbf !important;
  color: #fff !important;
}