/* ============================================================
   树洞 · 主题配色适配（拾音集 A-Sleek）
   ============================================================ */

:root{
  --hc-accent:#3b82f6; --hc-accent-hover:#2563eb; --hc-accent-soft:#eff6ff;
  --hc-bg:#f1f5f9; --hc-panel:#ffffff; --hc-border:#e5eaf2; --hc-text:#0f172a; --hc-text-muted:#64748b;
  --hc-own-bubble:#dbeafe; --hc-other-bubble:#ffffff;
  --hc-sidebar-bg:#0f172a; --hc-sidebar-bg-2:#1e293b; --hc-sidebar-text:#e2e8f0; --hc-sidebar-muted:#94a3b8;
}
/* 只给聊天应用内部的链接上色（不限定范围会把侧栏图标等全站链接染蓝） */
.page-chat-page .hc-root a,
.page-chat-page .hc-root .hc-chat-header__back{color:var(--hc-accent)}
.nav_menu_btn:focus,.nav_menu_btn:focus-visible{color:inherit !important;border-color:inherit !important;box-shadow:inherit !important}

/* ---------- 博客内嵌树洞：自适应高度，不错位，不上下滑动 ----------
   高度链：.page_content(calc(100vh - 191px)) → #app(100%) → .hc-root(100%)
   191px = 页头菜单 92 + 标题栏 40 + 页脚 61 及呼吸空间 */
.page-chat-page .page_content{
  height: calc(100vh - 191px) !important;
  overflow: hidden !important;
}
.page-chat-page #app{
  height: 100% !important;
}
.page-chat-page .hc-root{
  height: 100% !important;
  max-height: none !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  display: block !important;
  background: var(--hc-bg) !important;
}
.page-chat-page .hc-main{
  height: 100% !important;
  width: 100% !important;
  flex: 1 1 100% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* ---------- 侧栏：浮层，可展开/收起，不挤压聊天区 ----------
   展开/收起由 hc-root 上的 sidebar-open 类控制：
   默认展开（page-treehole.php 挂载后写入）；
   点 ← 按钮或右侧聊天区（遮罩）即收起 */
.page-chat-page .hc-root .hc-sidebar{
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 292px !important;
  min-width: 292px !important;
  flex: 0 0 292px !important;
  z-index: 500 !important;
  display: flex !important;
  box-shadow: 8px 0 30px rgba(0,0,0,.25) !important;
}
.page-chat-page .hc-root:not(.sidebar-open) .hc-sidebar{
  display: none !important;
}

/* 遮罩：侧栏展开时盖住聊天区，点击即收起 */
.page-chat-page .hc-sidebar-mask{
  position: absolute !important;
  inset: 0 !important;
  z-index: 400 !important;
  display: none !important;
  background: rgba(15, 23, 42, .18) !important;
  cursor: pointer;
}
.page-chat-page .hc-root.sidebar-open .hc-sidebar-mask{
  display: block !important;
}

/* ---------- ← 按钮：换成侧栏展开/收起图标（remixicon） ----------
   应用自带的按钮文字是「←」，这里隐藏文字、用图标代替：
   侧栏展开时显示「收起菜单」，收起时显示「展开菜单」 */
.page-chat-page .hc-root .hc-chat-header__back{
  display: inline-block !important;
  flex: 0 0 auto !important;
  font-size: 0 !important;
  color: var(--hc-text-muted) !important;
  transition: color .2s ease, margin-left .2s ease;
}
/* 侧栏展开时把图标挪到侧栏右缘，避免被浮层盖住 */
.page-chat-page .hc-root.sidebar-open .hc-chat-header__back{
  margin-left: 292px !important;
}
.page-chat-page .hc-root .hc-chat-header__back::before{
  content: '\ef3d';   /* ri-menu-fold-line：收起侧栏 */
  font-family: 'remixicon' !important;
  font-style: normal;
  font-size: 20px !important;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}
.page-chat-page .hc-root:not(.sidebar-open) .hc-chat-header__back::before{
  content: '\ef40';   /* ri-menu-unfold-line：展开侧栏 */
}
.page-chat-page .hc-root .hc-chat-header__back:hover{
  color: var(--hc-accent) !important
}

/* 侧栏链接不要变蓝 */
.page-chat-page .hc-sidebar a,
.page-chat-page .hc-sidebar a:focus,
.page-chat-page .hc-sidebar a:focus-visible{
  color: inherit !important;
  border-color: inherit !important;
  box-shadow: inherit !important;
}

/* ---------- 表情面板 ---------- */
.hc-emoji-panel{
  position: static !important; width:100% !important; max-height:240px !important; overflow-y:auto !important;
  margin-top:8px !important; transform:none !important; border-radius:12px !important; z-index:20 !important;
  display:grid !important; grid-template-columns:repeat(10,1fr) !important; gap:6px !important;
}
.hc-emoji-panel button{ width:100% !important; height:34px !important; padding:0 !important; display:flex !important; align-items:center !important; justify-content:center !important; }
.hc-emoji-panel img{ width:26px; height:26px; display:block; }
.hc-wx-emoji{ width:20px; height:20px; vertical-align:-4px; }

/* ---------- 窄屏自适应 ---------- */
@media (max-width:820px){
  .page-chat-page .hc-root .hc-sidebar{
    width: 78% !important;
    min-width: 0 !important;
    flex-basis: 78% !important;
  }
  .hc-chat-header{padding:8px 10px !important}
  .hc-composer{padding:8px 10px !important}
  .hc-message{padding:8px 10px !important}
  .hc-channel{padding:9px 10px !important}
  html,body{background:var(--hc-bg)}
}

/* ---------- 移动端：页脚隐藏，可用高度更大，避免底部空白 ----------
   可用高度 = 100vh - 132px（页头 92 + 标题栏 40，页脚在移动端不显示） */
@media (max-width:767px){
  .page-chat-page .page_content,
  .page-chat-page .hc-root{
    height: calc(100vh - 132px) !important;
  }
}
