/* doc
----------------------------------------------- */
#doc {
}
#doc .doc-head {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  border-bottom: 1px solid #ddd;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 54px;
  padding: 0 30px;
}
#doc .head-placeholder {
  height: 54px;
}
#doc .doc-head .logo {
  font-size: 16px;
  font-weight: bold;
}
/* 移动端菜单触发按钮 */
#doc .doc-head .mobile-menu-trigger {
  display: none;
  cursor: pointer;
  font-size: 25px;
  color: #333;
  padding: 8px;
  transition: color 0.2s;
}
#doc .doc-head .mobile-menu-trigger:hover {
  color: #10af88;
}
@media (max-width: 992px) {
  #doc .doc-head {
    padding: 0 20px 0 10px;
  }
  #doc .doc-head .logo {
    display: flex;
    align-items: center;
  }
  #doc .doc-head .mobile-menu-trigger {
    display: inline-block;
  }
}
#doc .doc-head .action-box {
  display: flex;
  gap: 10px;
}
#doc .doc-head .action-box a {
  padding: 6px 12px;
  border: 1px solid #ccc;
  color: #333;
  border-radius: 4px;
}
#doc .doc-head .action-box a.green {
  border: 1px solid #10af88;
  color: #fff;
  background-color: #10af88;
}
#doc .doc-head .action-box a i {
  margin-right: 5px;
}
#doc .doc-head .action-box a:hover {
  background-color: #e6e6e6;
}
#doc .doc-head .action-box a.green:hover {
  background-color: #10af72;
}
#doc .doc-main {
}
#doc .doc-main .tree-sidebar {
  position: fixed;
  top: 55px;
  width: 270px;
  background-color: #fafafa;
  border-right: 1px solid #ddd;
  left: 0;
  z-index: 999;
  transform: translateX(0);
  transition: transform 0.3s ease;
}
@media (max-width: 992px) {
  /* 侧边栏默认隐藏在左侧外 */
  #doc .doc-main .tree-sidebar {
    transform: translateX(-100%);
  }
  /* 当有 active 类时显示侧边栏 */
  #doc .doc-main .tree-sidebar.active {
    transform: translateX(0);
  }
}
#doc .doc-main .tree-sidebar .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  border-bottom: 1px solid #ddd;
  padding: 0 10px;
  font-weight: bold;
  position: relative;
  z-index: 10;
}
#doc .doc-main .tree-sidebar .head .action-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
#doc .doc-main .tree-sidebar .head .action-box .action {
  cursor: pointer;
  color: #000;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 14px;
  transition: color 0.2s;
}
#doc .doc-main .tree-sidebar .head .action-box .action:hover {
  color: #10af88;
  background-color: #eef;
}
/* 搜索弹出面板 */
#doc .doc-main .tree-sidebar .search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  background-color: #fafafa;
  border-bottom: 1px solid #ddd;
  display: none;
  z-index: 20;
}
#doc .doc-main .tree-sidebar .search-panel {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px;
}
#doc .doc-main .tree-sidebar .search-input {
  flex: 1;
  padding: 2px 10px;
  border: 1px solid #ddd;
  font-size: 12px;
  outline: none;
}
#doc .doc-main .tree-sidebar .search-input:focus {
  border-color: #10af88;
}
#doc .doc-main .tree-sidebar .search-close {
  cursor: pointer;
  margin-left: 8px;
  padding: 4px;
  color: #666;
  font-size: 16px;
  transition: color 0.2s;
}
#doc .doc-main .tree-sidebar .search-close:hover {
  color: #10af88;
}
#doc .doc-main .tree-sidebar .tree {
  width: 100%;
  height: calc(100vh - 91px);
  overflow-y: auto;
  overflow-x: hidden;
}
#doc .doc-main .tree-sidebar .tree::-webkit-scrollbar {
  width: 6px;
}
#doc .doc-main .tree-sidebar .tree::-webkit-scrollbar-thumb {
  background-color: #999;
}
#doc .doc-main .tree-sidebar .tree > div {
  padding: 0;
}
#doc .doc-main .tree-sidebar .tree a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}
#doc .doc-main .tree-sidebar .tree a:hover {
  background-color: #e8f5e9;
}
#doc .doc-main .tree-sidebar .tree .has-child > a {
  padding-left: 10px;
}
#doc .doc-main .tree-sidebar .tree .sub-tree.tree-sub-1 > div > a {
  padding-left: 30px;
}
#doc .doc-main .tree-sidebar .tree .sub-tree.tree-sub-2 > div > a {
  padding-left: 46px;
}
#doc .doc-main .tree-sidebar .tree .tree-toggle {
  flex-shrink: 0;
  cursor: pointer;
  font: normal normal normal 14px/1 bootstrap-icons;
  font-size: 12px;
  color: #999;
  transition: color 0.2s;
}
#doc .doc-main .tree-sidebar .tree .tree-toggle::before {
  content: "\F231";
}
#doc .doc-main .tree-sidebar .tree .has-child.active > a > .tree-toggle::before {
  content: "\F229";
}
#doc .doc-main .tree-sidebar .tree .has-child > a:hover > .tree-toggle {
  color: #10af88;
}
#doc .doc-main .tree-sidebar .tree a.cur > .tree-toggle,
#doc .doc-main .tree-sidebar .tree a.cur:hover > .tree-toggle {
  color: #fff;
}
#doc .doc-main .tree-sidebar .tree .sub-tree {
  display: none;
}
#doc .doc-main .tree-sidebar .tree .has-child.active > .sub-tree {
  display: block;
}
#doc .doc-main .tree-sidebar .tree a.cur {
  background-color: #10af88;
  color: #fff;
}
#doc .doc-main .main {
  margin: 0 300px 0 270px;
  padding: 20px 30px 50px 80px;
  transition: margin-left 0.3s ease;
}
@media (max-width: 992px) {
  #doc .doc-main .main {
    margin-left: 0;
    margin-right: 0;
    padding: 20px 15px 50px 15px;
  }
}
#doc .doc-main .main .title {
  font-size: 38px;
  font-weight: bold;
  color: #000;
}
#doc .doc-main .main .content {
  color: #444;
  margin-top: 40px;
}
#doc .doc-main .main .time {
  margin-top: 30px;
  border-top: 1px solid #EEE;
  padding-top: 15px;
  text-align: right;
  font-size: 12px;
  color: #999;
}
#doc .doc-main .toc-sidebar {
  position: fixed;
  top: 170px;
  right: 50px;
  width: 250px;
  max-height: calc(100vh - 260px);
  overflow-y: scroll;
  overflow-x: hidden;
  border: 1px solid #eee;
  padding: 20px;
  font-size: 12px;
}
@media (max-width: 992px) {
  #doc .doc-main .toc-sidebar {
    display: none !important;
  }
}
#doc .doc-main .toc-sidebar::-webkit-scrollbar {
  width: 2px;
}
#doc .doc-main .toc-sidebar::-webkit-scrollbar-thumb {
  background-color: #999;
}
#doc .doc-main .toc-sidebar li {
  padding: 5px 0;
}
#doc .doc-main .toc-sidebar li a {
  color: #999;
}
/* TOC 层级缩进 */
#doc .doc-main .toc-sidebar li.toc-level-2 {
  padding-left: 0;
}
#doc .doc-main .toc-sidebar li.toc-level-3 {
  padding-left: 12px;
}
#doc .doc-main .toc-sidebar li.toc-level-4 {
  padding-left: 24px;
}
#doc .doc-main .toc-sidebar li.toc-level-5 {
  padding-left: 36px;
}
#doc .doc-main .toc-sidebar li.current a {
  color: #25b864;
}
#doc .doc-foot {
  margin: 0 300px 0 270px;
  padding: 30px 50px;
  text-align: center;
  color: #999;
  transition: margin-left 0.3s ease;
}
@media (max-width: 992px) {
  #doc .doc-foot {
    margin-left: 0;
    margin-right: 0;
  }
}
#doc .doc-foot p {
  margin-top: 8px;
}
/* 分类页 */
#doc .category {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px; /* 间距 */
  margin: 30px 0;
}
@media (max-width: 992px) {
  #doc .category {
    grid-template-columns: 2fr;
  }
}
#doc .category .item {
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  border-radius: 8px;
  padding: 15px;
  background-color: #fff;
}
#doc .category .item .img image {
  width: 100%;
}
#doc .category .item .name {
  margin-top: 4px;
  font-size: 18px;
}
/* 普通屏幕样式 - 正常显示 */
.header,
.footer {
  background: #f5f5f5;
  padding: 10px;
}
/* 打印样式 */
@media print {
  /* 隐藏不需要打印的元素 */
  .doc-head,
  .doc-foot,
  .tree-sidebar,
  .toc-sidebar {
    display: none !important;
  }
  /* 确保打印区域显示并调整样式 */
  #doc .doc-main .main {
    margin: 0;
    padding: 0;
  }
  /* 设置页面边距 */
  @page {
    margin: 2cm;
  }
}
@media (max-width: 992px) {
  /* 遮罩层 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 55px;
    left: 0;
    width: 100%;
    height: calc(100vh - 55px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* 分享弹出框样式 */
.share-dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.share-dialog-overlay.active {
  display: flex;
}

.share-dialog {
  background-color: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.share-dialog-title {
  padding: 20px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.share-dialog-content {
  padding: 20px;
}

.share-dialog-content p {
  margin: 0 0 20px 0;
  color: #666;
  line-height: 1.6;
}

.share-info {
  background-color: #f9f9f9;
  border-radius: 4px;
  padding: 15px;
}

.share-item {
  margin-bottom: 12px;
  word-break: break-all;
}

.share-item:last-child {
  margin-bottom: 0;
}

.share-item .label {
  color: #999;
  font-size: 13px;
  display: block;
  margin-bottom: 5px;
}

.share-item .value {
  color: #333;
  font-size: 14px;
  display: block;
  line-height: 1.5;
}

.share-dialog-footer {
  padding: 15px 20px;
  text-align: center;
  border-top: 1px solid #eee;
}

.share-confirm-btn {
  background-color: #10af88;
  color: #fff;
  border: none;
  padding: 10px 30px;
  font-size: 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.share-confirm-btn:hover {
  background-color: #0e9a78;
}

/* 返回顶部按钮 */
.back-to-top {
  display: none;
  position: fixed;
  right: 30px;
  bottom: 50px;
  width: 50px;
  height: 50px;
  background-color: rgba(16, 175, 136, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 9998;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top:hover {
  background-color: rgba(16, 175, 136, 1);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 992px) {
  .back-to-top {
    right: 15px;
    bottom: 30px;
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}

/* 文档切换加载动画 */
#doc .doc-loading {
  display: none;
  position: fixed;
  top: 54px;
  /* 仅覆盖正文区域，左侧菜单保持可见（当前项高亮即为点击反馈） */
  left: 270px;
  width: calc(100% - 270px);
  height: calc(100% - 54px);
  background-color: rgba(255, 255, 255, 0.65);
  z-index: 9997;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
@media (max-width: 992px) {
  #doc .doc-loading {
    left: 0;
    width: 100%;
  }
}
#doc .doc-loading.active {
  display: flex;
  animation: docLoadingFadeIn 0.15s ease;
}
@keyframes docLoadingFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
#doc .doc-loading .doc-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(16, 175, 136, 0.2);
  border-top-color: #10af88;
  border-radius: 50%;
  animation: docLoadingSpin 0.8s linear infinite;
}
@keyframes docLoadingSpin {
  to {
    transform: rotate(360deg);
  }
}
#doc .doc-loading .doc-loading-text {
  margin-top: 14px;
  font-size: 13px;
  color: #10af88;
}

/* 正文切换淡入动画 */
#doc .doc-main .main.doc-fade-in {
  animation: docContentFadeIn 0.35s ease;
}
@keyframes docContentFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media print {
  #doc .doc-loading {
    display: none !important;
  }
}

/* Mermaid 图表容器：渲染后居中、背景透明并防止横向溢出 */
#doc .content pre.mermaid {
  margin: 1.5em auto;
  text-align: center;
  background: transparent;
  border: none;
  padding: 0;
  overflow-x: auto;
}
#doc .content pre.mermaid svg {
  max-width: 100%;
  height: auto;
}
