/* ===== WeKnora 移动端修复 v2 =====
   1. .main 硬编码 min-width:600px 导致横向溢出
   2. 侧边栏改成底部悬浮导航条
*/

@media (max-width: 768px) {

  /* --- 1. 解除宽度锁死 --- */
  .main { min-width: 0 !important; flex-direction: column !important; }
  .platform-route-outlet, .kb-list-container, .kb-list-content { min-width: 0 !important; }

  /* --- 2. 侧边栏 -> 底部悬浮导航 --- */
  .aside_box {
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    width: 100vw !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    flex-direction: row !important;
    z-index: 900;
    border-top: 1px solid var(--td-component-stroke, #e7e7e7);
    background: var(--td-bg-color-container, #fff);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .08);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* 隐藏 logo / 拖拽把手 / 底部用户信息 */
  .aside_box > .logo_row,
  .aside_box > .panel-resize-handle,
  .aside_box > .menu_bottom { display: none !important; }

  .menu_top {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    align-items: stretch;
    overflow: hidden !important;
    padding: 0 !important;
  }

  /* 隐藏历史会话列表 */
  .menu_top > .submenu { display: none !important; }
  /* 隐藏低频入口：产物(3)、自动化(5)、工具箱(6) —— 保留 新对话/知识库/智能体/共享空间 */
  .menu_top > .menu_box:nth-child(3),
  .menu_top > .menu_box:nth-child(5),
  .menu_top > .menu_box:nth-child(6) { display: none !important; }

  .menu_top > .menu_box {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .menu_item {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    gap: 3px;
  }
  .menu_item-box {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    gap: 3px !important;
  }
  .menu_title {
    font-size: 10px !important;
    line-height: 1 !important;
    width: auto !important;
    max-width: 100% !important;
  }
  .menu_icon {
    width: 20px !important;
    height: 20px !important;
    font-size: 20px !important;
  }

  /* 主内容让出底部导航高度（flex 子项需显式固定） */
  .platform-route-outlet {
    width: 100% !important;
    height: calc(100vh - 60px) !important;
    min-height: 0 !important;
    max-height: calc(100vh - 60px) !important;
    flex: 0 0 auto !important;
    padding-bottom: 0 !important;
  }

  /* --- 3. 头部操作区不再撑出 --- */
  .header, .header-title, .title-row { min-width: 0 !important; max-width: 100% !important; }
  .header-actions { flex-wrap: wrap !important; max-width: 100% !important; }
  .resource-sort-trigger { max-width: 100% !important; }
}

@media (max-width: 420px) {
  .header-actions { flex-wrap: wrap !important; }
  .resource-sort-trigger { flex: 0 1 auto !important; min-width: 0 !important; }
}
