/* 基础样式重置与布局 */

body {
  background-color: #F8F8FB;
  margin: 0;
  padding: 0;
  overflow: hidden; /* 禁止页面整体滚动 */
}
/* 禁用浏览器默认的滚动行为优化，避免滚动位置记忆 */
html {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}
/* 布局容器 */
.container-cart {
  display: flex;
  flex-direction: row; /* 默认横向排列 */
  height: 100vh; /* 容器占满整个视口高度 */
  overflow: hidden; /* 隐藏容器的滚动条 */
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
  position: fixed;
  top: 60px;
  right: 16px;
  height: 40px;
  border-radius: 8px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
  display: none;
  transition: transform 0.3s ease;
  padding: 0 16px;
  margin-bottom: 10px;
}

.mobile-menu-btn span {
  margin-right: 6px;
  color: orange;
  font-weight: 600;
}

.mobile-menu-btn i {
  font-size: 20px;
  color: #2563eb;
}

.mobile-menu-btn.active {
  /*transform: translateX(-240px);*/
}

/* 左侧导航栏 - 独立滚动 */
.sidebar {
  width: 256px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  z-index: 1000;
  flex-shrink: 0; /* 不收缩 */
  height: 100vh; /* 高度占满视口 */
  overflow-y: auto; /* 导航栏自身滚动 */
  position: relative;
  margin-top: 50px;
}

.sidebar-header {
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; /* 导航标题固定 */
  top: 0;
  background-color: white;
  z-index: 10;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 600;
}

.close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: #6b7280;
  cursor: pointer;
}

.menu-container {
  padding: 8px;
}

.menu-group {
  margin-bottom: 4px;
}

/* 一级菜单 */
.menu-item {
  width: 100%;
  padding: 12px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.menu-item:hover {
  background-color: #eff6ff;
}

.menu-item.active {
  background-color: #2563eb;
  color: white;
}

.menu-item .menu-icon {
  margin-right: 8px;
}

.menu-item .arrow-icon {
  font-size: 12px;
  transition: transform 0.3s ease;
}

.menu-item.active .arrow-icon {
  transform: rotate(180deg);
}

/* 二级菜单 */
.submenu {
  margin-left: 16px;
  margin-top: 4px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.submenu.open {
  max-height: 500px;
  transition: max-height 0.5s ease-in;
}

.submenu-item {
  width: 100%;
  padding: 8px 24px;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.submenu-item:hover {
  background-color: #eff6ff;
}

.submenu-item.active {
  color: #2563eb;
}

.hot-tag {
  margin-left: 8px;
  background-color: #f97316;
  color: white;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
}

/* 右侧内容区 - 独立滚动 */
.content {
  flex: 1;
  padding: 16px;
  transition: margin-left 0.3s ease;
  overflow-y: auto; /* 内容区自身滚动 */
  box-sizing: border-box; /* 确保padding不影响高度计算 */
  margin-top: 42px;
  max-height: calc(100vh - 42px); /* 关键：限制最大高度并启用滚动 */
  /*padding-bottom: 60px; !* 增加底部缓冲空间 *!*/
}

.action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-outline {
  background-color: white;
  border: 1px solid #2563eb;
  color: #2563eb;
}

.btn-primary {
  background-color: #2563eb;
  color: white;
}

/* 产品卡片区域 */
.products-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 20px;
  margin-bottom: 40px; /* 最后一个卡片的底部缓冲 */
}

.product-card {
  position: relative;
  flex-basis: calc(33.9% - 19.6px);
  background-color: #fff;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #dbeafe;
  transition: box-shadow 0.3s ease;
}

/* 媒体查询，用于不同屏幕尺寸 */
@media (min-width: 1299px) {
  .product-card {
    flex-basis: calc(25% - 15px);
  }
}

@media (max-width: 768px) {
  .product-card {
    flex-basis: 100%;
  }
}

.product-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.product-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* 库存 */
.inventory {
  position: absolute;
  top: 22px;
  right: 10px;
  border-left: 1px solid #d4d6d9;
  padding-left: 10px;
  height: 15px;
  line-height: 12px;
}

.product-features {
  list-style: none;
  margin-bottom: 6px;
  padding-left: 0;
  flex: 1;
}

.product-features li {
  margin-bottom: 8px;
  font-size: 14px;
}

.product-features li i {
  margin-right: 9px;
}

.feature-warning {
  color: #ef4444;
  font-size: 12px;
}

.feature-success {
  color: #10b981;
  font-size: 12px;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.product-footer a {
  border: 1px solid #2563eb;
}

.product-footer a:hover {
  color: #2563eb;
  background-color: white;
  border: 1px solid #0147e5;
}

.product-price {
  color: #e64a19;
  font-size: 16px;
}

/* 遮罩层 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.active {
  display: block;
  opacity: 1;
}

/* 产品介绍 */
.note {
  display: flex;
  align-items: center; /* 垂直居中对齐子元素 */
  position: relative;
  width: 100%;
  background-color: #d6f3e9;
  color: #1b654a;
  border-color: #c6eee0;
  margin-bottom: 10px;
  padding: 10px; /* 适当增加内边距，让内容更美观 */
}

.note i {
  margin-right: 10px; /* 与文字保持一定距离 */
  font-size: 16px;
}

.note span {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

.ad {
  display: flex;
  align-items: center; /* 垂直居中对齐子元素 */
  position: relative;
  width: 100%;
  background-color: #E3ECFF;
  color: #161719;
  border-color: #c0d6fd;
  margin-bottom: 20px;
  padding: 10px; /* 适当增加内边距，让内容更美观 */
}

.ad i {
  margin-right: 10px; /* 与文字保持一定距离 */
  font-size: 16px;
}

.ad span {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* 响应式设计 - 平板及以上 */
@media (min-width: 768px) {
  .content {
    padding: 24px;
    scroll-margin-top: 0;
    scroll-padding-top: 0;
  }
}

/* 响应式设计 - 移动端 */
@media (max-width: 767px) {
  .mobile-menu-btn {
    display: flex;
  }

  .close-sidebar {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 256px;
    transform: translateX(-100%);
    z-index: 1000;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .content {
    padding-top: 69px;
    max-height: calc(100vh); /* 匹配移动端顶部高度 */
    -webkit-overflow-scrolling: touch; /* 启用移动端平滑滚动 */
  }

  .product-price {
    font-size: 18px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* 新版header样式表，PC端显示 */
@media screen and (min-width: 961px) {
  .header .top-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 101;
    background-color: rgba(255, 255, 255, 0.13);
    backdrop-filter: saturate(5) blur(20px);
    box-shadow: 0px 1px 3px rgba(166, 166, 166, 0.695);
  }

  .head {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 9999;
    padding: 0;
    height: auto !important;
    min-width: 100% !important;
  }

  .head .head-nav {
    height: auto !important;
  }

  .head .right {
    width: auto !important;
    max-width: 100% !important;
  }

  .head .user,
  .head .menu,
  .head .close {
    display: none !important;
  }

  .head .nav {
    width: 100%;
    margin-right: 60px;
    display: flex !important;
  }

  .head .nav li {
    padding: 0px 32px;
  }

  .head .nav li > i {
    display: block;
  }

  .head .btn > span {
    position: relative;
    cursor: pointer;
  }

  .head .nav li > a {
    font-size: 16px;
    color: #000000;
    position: relative;
    display: block;
    line-height: 44px;
    cursor: pointer;
    white-space: nowrap;
  }

  .head .btn > span::after,
  .head .nav li > a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    width: 0;
    height: 1px;
    background: #006eff;
    top: 100%;
    margin: 0 auto;
    transition: all 0.2s ease 0s;
  }

  .head .nav li:hover > a,
  .head .nav .on > a {
    color: #006eff;
  }

  .head .btn:hover > span::after,
  .head .nav li:hover > a::after,
  .head .nav .on > a::after {
    width: 100%;
  }

  .head .btn {
    position: relative;
    display: flex !important;
  }

  .head .btn > a {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    width: 68px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.7);
    line-height: 32px;
    border-radius: 3px;
    transition: all .3s ease 0s;
  }

  .head .btn > a + a {
    margin-left: 10px;
  }

  .head .btn > a:hover {
    color: #123c8f00;
    background: #006eff;
    border-color: #006eff;
  }

  .head .btn > span {
    color: #006eff;
  }

  .head .btn > .userinfo {
    position: absolute;
    width: 160px;
    top: 100%;
    left: 50%;
    margin-left: -80px;
    padding-top: 20px;
    z-index: -300;
    opacity: 0;
    pointer-events: none;
    transition: all .5s ease 0s;
  }

  .head .btn:hover > .userinfo {
    z-index: 100;
    opacity: 1;
    pointer-events: all;
  }

  .head .btn > .userinfo .gcont {
    background: #fff;
    padding: 10px 5px;
    border-radius: 5px;
    text-align: center;
    font-size: 15px
  }

  .head .btn > .userinfo .gcont > * + * {
    margin-top: 10px;
  }

  .head .nav li dl {
    position: absolute;
    width: 156px;
    left: 50%;
    margin-left: -72px;
    top: 100%;
    padding-top: 20px;
    z-index: -300;
    opacity: 0;
    transition: all .5s ease 0s;
    pointer-events: none;
    display: block !important;
    -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  }

  /* 产品 */
  .head .nav .idcproduct {
    position: absolute;
    width: 1000px;
    left: 50%;
    margin-left: -72px;
    top: 100%;
    padding: 0px;
    z-index: -300;
    opacity: 0;
    transition: all .5s ease 0s;
    pointer-events: none;
    display: block !important;
    -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    background-color: #ffffff;
    border-radius: 9.5px;
  }

  .head .nav li:hover .idcproduct {
    z-index: 100;
    opacity: 1;
    pointer-events: all;
  }

  .head .nav li:hover dl {
    z-index: 100;
    opacity: 1;
    pointer-events: all;
  }

  .head .nav li > i::after {
    width: 8px;
    height: 8px;
    right: 10px;
    border-color: #006eff;
    top: 15px;
    border-width: 1px;
  }

  .head .nav li:hover > i::after {
    transform: rotate(45deg);
    top: 20px;
  }

  .head .nav li dl dd {
    background: #fff;
    padding: 0 !important;
    text-align: center;
    border-radius: 0 !important;
  }

  .head .nav li dl dd a {
    display: block;
    font-size: 15px
  }

  .head .nav li dl dd .flex {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    justify-content: flex-start;
    text-align: left;
  }

  .head .nav li dl dd .flex img {
    width: 48px;
    height: 48px;
  }

  .head .nav li dl dd .flex .s_navr {
    line-height: 1;
    margin-left: 20px;
  }

  .head .nav li dl dd .flex .s_navr h3 {
    font-size: 17px;
  }

  .head .nav li dl dd .flex .s_navr p {
    font-size: 13px;
    color: #525666;
    font-weight: 100;
    margin-top: 15px;
  }

  .head .nav li dl dd a:hover {
    background-color: rgb(238, 244, 255);
  }

  .p-user-empty {
    display: inline-block;
    font-size: 16px;
    color: rgba(0, 110, 255, 0.7);
    width: 68px;
    text-align: center;
    border: 1px solid rgba(0, 110, 255, 0.7);
    line-height: 32px;
    border-radius: 3px;
    transition: all .3s ease 0s;
  }

  .p-user-empty:hover {
    color: #ffffff;
    background: #006eff;
    border-color: #006eff;
  }
}
