/* Topics List Sidebar Styles */
.topics-list-sidebar {
  background-color: #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  width: 246.4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

/* Sidebar Header */
.sidebar-nav__header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background-color: #1f1f1f;
  border-bottom: 1px solid #333;
  cursor: pointer;
}

.sidebar-nav__icon {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  display: block;
  flex-shrink: 0;
}

.sidebar-nav__title {
  color: #3E7DFF;
  text-align: center;
  font-family: "PingFang SC";
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 27px; /* 150% */
}

.sidebar-nav__arrow {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.sidebar-nav__arrow:hover {
  opacity: 0.8;
}

/* Sidebar List */
.sidebar-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav__item {
  border-bottom: 1px solid #353742;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-nav__item:last-child {
  border-bottom: none;
}

.sidebar-nav__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 68px;
  padding: 0 16px;
  color: #C6C6C6;
  text-align: center;
  font-family: "PingFang SC", sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 27px;
  transition: all 0.3s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.sidebar-nav__link:hover {
  color: #fff;
  background-color: #333;
}

.sidebar-nav__item.active .sidebar-nav__link {
  color: #3E7DFF;
  background-color: #333;
  font-weight: 400;
}

@media screen and (max-width: 1024px) {
  .topics-list-sidebar {
    width: 160px;
  }
}

/* Responsive Styles */
@media screen and (max-width: 824px) {
  .topics-list-sidebar {
    width: 100%;
    background-color: #2a2a2a;
    border-radius: 4px;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    align-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* header与其他item保持一致 */
  .sidebar-nav__header {
    display: none;
  }

  /* 全部选项只在移动端显示 */
  .sidebar-nav__item--all {
    display: flex;
  }

  /* 展开按钮样式 */
  .sidebar-nav__expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 6px;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    overflow: hidden;
  }


  .sidebar-nav__expand-btn .sidebar-nav__expand-text {
    display: none;
  }

  .sidebar-nav__expand-btn .sidebar-nav__expand-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
  }

  /* 展开状态下的按钮样式 */
  .sidebar-nav__expand-btn.expanded .sidebar-nav__expand-text {
    display: none;
  }

  .sidebar-nav__expand-btn.expanded .sidebar-nav__expand-icon {
    transform: rotate(180deg);
  }

  .sidebar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    align-content: flex-start;
    gap: 0;
    flex-wrap: wrap;
    align-self: stretch;
    width: 100%;
  }

  /* 列表改为横向，只显示一行，超出隐藏 */
  .sidebar-nav__list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    align-items: flex-start;
    align-content: flex-start;
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
  }

  /* 展开状态 */
  .sidebar-nav__list.expanded {
    flex-wrap: wrap;
  }

  .sidebar-nav__item {
    width: auto;
    border-bottom: none;
    flex-shrink: 0;
    display: flex;
    padding: 0px;
  }

  .sidebar-nav__link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 6px 4px;
    color: rgba(255, 255, 255, 0.90);
    text-align: center;
    font-family: "PingFang SC", sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: 18px;
    transition: all 0.3s ease;
    text-decoration: none;
    box-sizing: border-box;
    border-radius: 4px;
    background-color: transparent;
    white-space: nowrap;
  }

  .sidebar-nav__link:hover {
    color: rgba(255, 255, 255, 0.90);
    background-color: rgba(255, 255, 255, 0.1);
  }

  /* 选中状态 */
  .sidebar-nav__item.active .sidebar-nav__link {
    color: #3E7DFF;
    background-color: transparent;
    font-weight: 400;
  }

  .sidebar-nav__item.active .sidebar-nav__link:hover {
    color: #3E7DFF;
    background-color: rgba(253, 208, 0, 0.1);
  }
}

/* 桌面端隐藏全部选项和展开按钮 */
@media screen and (min-width: 825px) {
  .sidebar-nav__item--all {
    display: none;
  }

  .sidebar-nav__expand-btn {
    display: none;
  }

  /* 桌面端恢复列表的原始样式 */
  .sidebar-nav__list {
    width: 100% !important;
    flex-wrap: wrap !important;
  }
}
