/* Global mobile-first overrides for all pages */
:root {
  --site-header-height: 80px;
}

/* ================= 核心：全局防止移动端横向溢出 ================= */
html, body {
  max-width: 100vw;
  overflow-x: hidden;
  width: 100%; /* 新增：确保body完全匹配视口 */
  margin: 0;
  padding: 0;
}
/* 强制所有容器内的元素不超出宽度 */
* {
  max-width: 100vw;
  box-sizing: border-box; /* 新增：全局应用border-box以确保padding不增加宽度 */
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* 恢复部分需要横向滚动的特定容器（如表格）的宽容度 */
.table-responsive, table, .slider-nav {
  max-width: none;
}
table {
  width: 100%;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
img, video, iframe {
  max-width: 100%;
  height: auto;
}

/* 版权区域基础排版 */
.copyright-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

@media (max-width: 768px) {
  /* 移动端底部悬浮按钮留出空间 */
  body {
    padding-bottom: 75px !important;
  }
  
  /* 精简移动端页脚，隐藏前三个版块及联系方式版块（改为纯底部导航替代） */
  .footer-col:nth-child(1),
  .footer-col:nth-child(2),
  .footer-col:nth-child(3),
  .footer-col:nth-child(4) {
    display: none !important;
  }
  
  /* 版权区域换行显示 */
  .copyright-inner {
    flex-direction: column;
    gap: 4px; /* 极小化上下行间距 */
    text-align: center;
  }
  .copyright-inner .copyright-right {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    font-size: 12px; /* 缩小字号 */
  }

  .footer-content {
    grid-template-columns: 1fr !important;
  }

  /* ========== 全新设计的移动端悬浮底部导航 ========== */
  .mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: #0F52BA; /* 主色调蓝色 */
    display: flex;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  }
  .mobile-bottom-bar a.nav-item {
    flex: 1;
    display: flex;
    flex-direction: row; /* 图标在左，文字在右 */
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 14px; /* 文字稍微放大 */
    text-decoration: none;
    position: relative;
    transition: background 0.2s;
  }
  .mobile-bottom-bar a.nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
  }
  .mobile-bottom-bar a.nav-item i {
    font-size: 16px; /* 适应横向排版 */
    margin-bottom: 0;
    margin-right: 6px; /* 图标与文字间距 */
    color: #ffffff;
    opacity: 0.9;
    transition: transform 0.2s;
  }
  .mobile-bottom-bar a.nav-item:active {
    background: rgba(0, 0, 0, 0.15);
  }
  .mobile-bottom-bar a.nav-item:active i {
    transform: scale(1.15);
  }

  /* Toast Message */
  .toast-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
  }
  .toast-msg.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* PC 端隐藏移动端悬浮按钮 */
@media (min-width: 769px) {
  .mobile-bottom-bar {
    display: none !important;
  }
}

/* 二级分类悬停特效 */
.sub-cat-item {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
}
.sub-cat-item:hover {
  background: #eef4ff !important;
  color: #0F52BA !important;
  font-weight: bold;
  padding-left: 38px !important;
  box-shadow: 0 4px 12px rgba(15,82,186,0.15);
  border-radius: 4px;
  transform: translateX(4px);
}

body.menu-open {
  overflow: hidden;
}

/* Avoid media overflow on narrow devices */
img,
video,
iframe,
table {
  max-width: 100%;
}

/* Shared nav panel behavior */
@media (max-width: 768px) {
  .container {
    padding-left: 20px !important; /* 加大两边内边距 */
    padding-right: 20px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  .detail-layout,
  .detail-layout > *,
  .news-detail-wrap,
  .news-content,
  .markdown-body,
  .article-nav,
  .article-nav a {
    min-width: 0 !important;
  }

  .news-detail-wrap {
    width: 100% !important;
    max-width: 100% !important;
  }

  .section {
    padding: 44px 0 !important;
  }

  .section-title {
    font-size: 24px !important;
    margin-bottom: 26px !important;
  }

  .breadcrumb {
    font-size: 13px !important;
    padding: 12px 0 !important;
  }

  .nav {
    height: 68px !important;
  }

  .logo {
    font-size: 20px !important;
  }

  .nav-menu {
    top: 68px !important;
    height: calc(100vh - 68px) !important;
    overflow-y: auto;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: 12px;
  }

  .nav-menu li {
    width: 100%;
    border-bottom: 1px solid #f2f2f2;
  }

  .nav-menu a {
    display: block;
    width: 100%;
    padding: 14px 8px;
    font-size: 16px;
  }

  .btn,
  .page-btn,
  .page-item {
    min-height: 40px;
  }

  /* Mobile tabs should stay visually centered */
  .tabs-head {
    justify-content: center !important;
    align-items: center !important;
  }

  .tab-head .tab-btn,
  .tabs-head .tab-btn {
    text-align: center !important;
  }

  /* Mobile footer redesign: compact card layout */
  .footer {
    padding: 10px 0 0 !important; /* 大幅减小整体顶部内边距 */
  }

  .service-box {
    display: none !important;
  }

  .footer-content {
    display: none !important;
    margin-bottom: 0 !important;
  }

  .footer-col {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    text-align: left !important;
  }

  .footer-col h3 {
    font-size: 14px !important;
    margin-bottom: 10px !important;
    padding-bottom: 6px !important;
  }

  .footer-col h3::after {
    left: 0 !important;
    transform: none !important;
    width: 24px !important;
  }

  .footer-col ul li,
  .footer-col p {
    font-size: 12px !important;
    margin-bottom: 6px !important;
    line-height: 1.5 !important;
  }

  .footer .qrcode {
    width: 90px !important;
    height: 90px !important;
    margin: 8px 0 8px !important;
    padding: 6px !important;
  }

  .copyright {
    font-size: 11px !important; /* 缩小版权文字字号 */
    padding-top: 5px !important; /* 极小化内边距 */
    border-top: none !important; /* 移除多余边框 */
    margin-bottom: 10px; /* 控制与最底部的距离 */
  }

  /* 免责声明等额外文本的紧凑化 */
  .footer-copyright-notice {
    margin-top: 10px !important;
    padding: 10px 15px !important;
    line-height: 1.4 !important;
    font-size: 11px !important;
    border-top: none !important;
  }
}

/* Phone-specific layout fix */
@media (max-width: 768px) {
  .banner {
    height: auto !important;
    min-height: 320px;
    padding: 48px 0;
  }

  .banner h1 {
    font-size: 30px !important;
    line-height: 1.25;
  }

  .banner p {
    font-size: 15px !important;
  }

  .product-list,
  .related-list,
  .double-col,
  .news-container,
  .contact-wrap {
    grid-template-columns: 1fr !important;
  }
  .industry-double-col {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px 12px !important;
  }

  .about-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .about-info {
    grid-template-columns: 1fr !important;
    display: flex;
    flex-direction: column-reverse;
  }

  .news-card {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  .news-img {
    width: 96px !important;
    height: 72px !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }

  .product-wrap {
    gap: 18px !important;
  }

  .product-title,
  .news-title {
    font-size: 26px !important;
  }

  .list-item {
    gap: 6px;
  }

  .list-date {
    min-width: 0 !important;
    font-size: 13px !important;
  }

  .page-btn,
  .page-item {
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 13px !important;
  }

  .map-iframe {
    height: 280px !important;
  }

  .related-scroll {
    gap: 10px !important;
  }

  .related-card {
    min-width: calc(50% - 6px) !important;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .news-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 10px !important;
    white-space: normal !important;
  }
  
  .news-meta span {
    white-space: nowrap;
    margin-right: 0 !important; /* 移除之前固定右边距，靠gap控制 */
  }

  .news-tags {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .news-tag {
    margin: 0 !important; /* 移除两边边距，靠gap控制 */
  }
  
  .news-title {
    font-size: 22px !important;
    word-break: break-word !important;
  }

  .news-content,
  .markdown-body {
    overflow-x: hidden !important;
    padding-right: 1px;
  }

  .article-nav,
  .article-nav a,
  .article-nav a[style] {
    text-align: left !important;
    align-items: flex-start !important;
  }
  
  /* 保护移动端新闻详情页长代码块防溢出 */
  .markdown-body pre {
    max-width: 100vw;
    overflow-x: auto !important;
    white-space: pre !important;
    word-wrap: normal !important;
  }
  
  .markdown-body p,
  .markdown-body li,
  .news-content p,
  .news-content {
    word-wrap: break-word;
    word-break: break-all;
    max-width: 100vw;
  }
  .markdown-body img,
  .markdown-body video,
  .markdown-body iframe {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Keep large parameter tables usable on phone */
  .param-table,
  .markdown-body table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

/* Ensure grids are 2 columns on mobile (up to 768px) */
@media (max-width: 768px) {
  .product-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .left-category {
    position: static !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    top: auto !important;
  }
  .cat-title {
    font-size: 16px !important;
    text-align: center !important;
    border-radius: 6px 6px 0 0 !important;
  }
  .product-layout .cat-title {
    display: none !important;
  }
  .cat-list {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    padding: 10px 8px !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .cat-list li {
    display: inline-block !important;
    margin: 5px 4px !important;
    border-bottom: none !important;
  }
  .cat-list a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 12px !important;
    border-radius: 20px !important;
    background: #f5f7fa !important;
    font-size: 13px !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
  }
  .cat-list a:hover,
  .cat-list a.active {
    background: #0F52BA !important;
    color: #fff !important;
    padding-left: 12px !important;
  }
  .cat-list .cat-child a {
    padding: 8px 12px !important;
  }
  .category-card h3 {
    font-size: 15px !important;
    min-height: 42px !important;
    margin-bottom: 6px !important;
  }
  .product-desc {
    min-height: 34px !important;
    margin-bottom: 6px !important;
  }
}

@media (max-width: 576px) {
  .product-grid,
  .category-grid,
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .product-body {
    padding: 10px !important;
  }
  .product-desc {
    font-size: 12px !important;
    margin-bottom: 8px !important;
  }
  .product-params {
    font-size: 12px !important;
  }
  .param-row {
    grid-template-columns: auto 1ch 1fr !important;
  }
  .update-time {
    font-size: 11px !important;
  }
  .category-card h3 {
    font-size: 14px !important;
    min-height: 40px !important;
    margin-bottom: 4px !important;
  }
  .product-img {
    height: 120px !important;
  }
  .btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 420px) {
  .footer-content {
    grid-template-columns: 1fr !important;
  }
}

/* PC footer slot swap: 联系我们放在二维码前 */
@media (min-width: 769px) {
  .footer-content .footer-col:nth-child(3) {
    order: 4;
  }

  .footer-content .footer-col:nth-child(4) {
    order: 3;
  }
}

/* Category demo block */
.cat-demo-wrap {
  margin-top: 22px;
  border: 1px solid #e8eef9;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.cat-demo-title {
  color: #0F52BA;
  font-weight: 600;
  margin-bottom: 10px;
}

.cat-demo-list {
  display: grid;
  gap: 8px;
}

.cat-l1-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-l1-btn {
  border: 1px solid #d8e4f8;
  background: #fff;
  color: #2b4f86;
  border-radius: 14px;
  font-size: 12px;
  padding: 3px 9px;
  cursor: pointer;
}

.cat-l1-btn.active,
.cat-l1-btn:hover {
  border-color: #0F52BA;
  color: #0F52BA;
  background: #eef4ff;
}

.cat-l2-panel {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #667;
  font-size: 12px;
}

.cat-l2 {
  font-size: 12px;
  background: #f5f8ff;
  border: 1px solid #d8e4f8;
  color: #456;
  border-radius: 12px;
  padding: 2px 8px;
}
