/* sidebar.css - 弹出侧边栏（100%还原设计图）*/

.sidebar {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  z-index: 20000;
  transform: translateX(100%);
  transition: transform .35s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  display: flex;
  flex-direction: column;
  will-change: transform;
  -webkit-overflow-scrolling: touch;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 19999;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  visibility: visible;
}

/* 侧边栏顶部 */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 30px;
  border-bottom: 1px solid #eee;
}

.sidebar-logo img {
  height: 50px;
}

.close-btn {
  font-size: 14px;
  font-weight: 700;
  color: #d90734;
  letter-spacing: 2px;
  padding: 8px 12px;
}

/* 导航区域 */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.nav-list > li {
  border-bottom: 1px solid #f0f0f0;
}

.nav-list > li > a {
  display: block;
  padding: 18px 30px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  letter-spacing: 1px;
  transition: color .2s ease;
}

.nav-list > li > a:hover,
.nav-list > li.active > a {
  color: #d90734;
}

/* 带子菜单的项 */
.has-sub {
  position: relative;
}

.has-sub > a {
  padding-right: 60px !important;
}

.sub-toggle {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #333;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s ease, color .2s ease;
  z-index: 2;
}

.has-sub.expanded > .sub-toggle {
  transform: translateY(-50%) rotate(180deg);
  color: #d90734;
}

/* ============== 二级菜单（100%还原设计图）============== */
/* 设计特点：
   - 浅灰背景 (#fafafa)
   - 3 列网格布局
   - 子项缩进对齐父项文字起始位置
   - 字号比父级小，颜色浅灰，hover/active 变红
   - 无边框分隔，靠间距区分
*/
.submenu {
  background: #fafafa;
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
  /* 子菜单缩进：与父菜单文字起始位置对齐 */
  padding: 0 30px;
}

.has-sub.expanded > .submenu {
  /* PRODUCTS 6 项 3×2 / FREY SERVICE 3 项 3×1 */
  max-height: 400px;
  padding: 20px 30px 24px;
}

.submenu li {
  display: block;
  /* 不显示分隔线，靠间距 */
}

.submenu li a {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 400;
  color: #999;
  letter-spacing: 0.5px;
  transition: color .2s ease;
  text-align: left;
}

.submenu li a:hover,
.submenu li.active a {
  color: #d90734;
}

/* ============== 子菜单分两类布局 ============== */

/* PRODUCTS：6 项 → 3 列 × 2 行网格 */
li[data-nav="products"] .submenu li {
  display: inline-block;
  width: 30%;
  box-sizing: border-box;
}

li[data-nav="products"] .submenu {
  white-space: normal;
}

li[data-nav="products"].expanded > .submenu {
  max-height: 180px;
}

/* FREY SERVICE：3 项 → 3 列 × 1 行网格 */
li[data-nav="frey-service"] .submenu li {
  display: inline-block;
  width: 30%;
  box-sizing: border-box;
}

li[data-nav="frey-service"].expanded > .submenu {
  max-height: 120px;
}

/* 移动端 */
@media (max-width: 768px) {
  .sidebar {
    width: 100vw;
  }
  .header-inner {
    padding: 0 20px;
  }
  li[data-nav="products"] .submenu li,
  li[data-nav="frey-service"] .submenu li {
    width: 50%;
  }
}