/* ========== 响应式布局核心样式 ========== */

/* 1. 全局布局设置 */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* 2. 顶部固定区域 */
.fixed-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 3. 底部固定区域 */
.fixed-footer {
  position: sticky;
  bottom: 0;
  z-index: 1000;
  background: white;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

/* 4. 中间内容区域 */
.main-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding-top: 20px;
  padding-bottom: 20px;
}

/* 5. 搜索栏响应式处理 */
.search-bar {
  /* 默认样式 - 在PC端隐藏 */
  display: none;
  width: 100%;
  height: 40px;
  background-color: #fff;
  padding: 5px 5%;
  box-sizing: border-box;
  border-bottom: 1px solid #eee;
}

/* 移动端搜索栏布局 */
.search-bar .sc_ipt {
  width: calc(100% - 50px);
  height: 30px;
  margin: 0;
  padding: 0;
  float: left;
}

.search-bar .sc_ipt input {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 30px;
  padding: 0 15px;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.search-bar .sc_btn {
  width: 50px;
  height: 30px;
  margin: 0;
  padding: 0;
  float: right;
}

.search-bar .sc_btn input {
  width: 100%;
  height: 100%;
  line-height: 30px;
  background-color: #c10326;
  background-image: url(../images/icon/top_ss.png);
  background-repeat: no-repeat;
  background-position: center center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* 6. 移动端底部导航 */
.ax-btmnav {
  text-align: center;
  height: 3.5rem;
  width: 100%;
  box-sizing: border-box;
  background-color: #fff;
  box-shadow: 0 -0.1rem 0 0 rgba(0, 0, 0, 0.1);
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 610;
  display: none;
}

/* 7. 媒体查询：768px以下（移动端） */
@media screen and (max-width: 768px) {
  .container { 
    width: 92vw; 
    margin: 0 auto;
  }
  
  /* 隐藏PC端元素 */
  .search-terms {
    display: none;
  }
  
  .nav.header-nav {
    display: none;
  }
  
  .site-footer {
    display: none;
  }
  
  .desktop-use {
    display: none;
  }
  
  /* 显示移动端元素 */
  .mobile-toggle {
    display: block;
  }
  
  .search-bar {
    display: block;
    position: static; /* 关键修改：取消固定定位，随文档流滚动 */
    z-index: 100;
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  /* 调整Logo大小 */
  .header-logo img {
    width: auto;
    height: 40px;
  }
  
  .header-slogan {
    display: none;
  }
  
  /* 移动端底部导航 */
  .ax-btmnav {
    display: block;
    background: linear-gradient(to right, #f03535, #ce0f0f);
    box-shadow: none;
  }
  
  .ax-btmnav a {
    color: #FFF;
  }
  
  /* 汉堡菜单图标 */
  #menuDrawer i {
    color: var(--word-color-2);
    font-size: 25px;
  }
  
  /* 确保中间内容不被遮挡 */
  .main-content-wrapper {
    padding-top: 10px;
    padding-bottom: 60px; /* 为底部导航留出空间 */
  }
}

/* 8. 中屏设备（769px-991px） */
@media screen and (min-width: 769px) and (max-width: 991px) {
  .container { 
    width: 90vw; 
    margin: 0 auto;
  }
  
  .search-bar {
    display: none; /* 中屏以上隐藏移动端搜索栏 */
  }
  
  .search-terms {
    display: flex;
  }
  
  .header-slogan {
    display: none;
  }
  
  .desktop-use {
    display: block;
  }
  
  .mobile-toggle {
    display: none;
  }
  
  .site-footer {
    display: block;
  }
}

/* 9. 大屏设备（992px-1199px） */
@media screen and (min-width: 992px) and (max-width: 1199px) {
  .container { 
    width: 90vw; 
    margin: 0 auto;
  }
  
  .header-slogan {
    display: block;
  }
}

/* 10. 超大屏设备（1200px-1399px） */
@media screen and (min-width: 1200px) and (max-width: 1399px) {
  .container { 
    width: 80vw; 
    margin: 0 auto;
  }
}

/* 11. 4K/超大屏设备（1400px以上） */
@media screen and (min-width: 1400px) {
  .container { 
    width: 70vw; 
    margin: 0 auto;
  }
  
  .search-terms {
    width: 65vw;
    margin: 0 auto;
  }
}

/* 12. 导航栏粘性定位 */
.nav.header-nav {
  position: sticky;
  top: 0;
  z-index: 600;
  background: #FFF;
  border-top: 1px var(--rgba-005) solid;
  transition: all 0.3s ease;
  box-shadow: 0 0.1rem 0 0 rgba(0, 0, 0, 0.1);
}

/* 13. 防止内容被固定元素遮挡 */
@media screen and (max-width: 768px) {
  body {
    padding-top: 0; /* 移动端顶部不需要额外padding */
    padding-bottom: 3.5rem; /* 为底部导航留出空间 */
  }
  
  .fixed-header {
    position: sticky;
    top: 0;
  }
  
  .fixed-footer {
    position: fixed;
    bottom: 0;
  }
}

/* 14. 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 15. 防止iOS Safari的弹性滚动问题 */
@supports (-webkit-overflow-scrolling: touch) {
  .main-content-wrapper {
    -webkit-overflow-scrolling: touch;
  }
}

/* 16. 返回顶部按钮样式优化 */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(193, 3, 38, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  display: none;
  z-index: 1001;
  transition: all 0.3s ease;
}

.back-to-top:hover {
  background: rgba(193, 3, 38, 1);
  transform: translateY(-3px);
}

@media screen and (max-width: 768px) {
  .back-to-top {
    bottom: 70px;
    right: 15px;
    width: 45px;
    height: 45px;
  }
}
