/* ui-override.css — 重建版本地 UI 优化补丁（不修改原版 CSS 文件） */

/* 0. 侧栏 200px 下 logo（图标 51px + 文字 100px）会换行被裁：
      收掉左右内边距、图标与文字间距，一行放得下 */
.side-menu .logo {
  padding-left: 12px !important;
  padding-right: 8px !important;
}
.side-menu .logo h1 {
  margin-left: 8px !important;
}

/* 1. 工具栏自适应：按钮区 + 搜索区在空间不足时换行，
      避免被 .btn_box 的 overflow:hidden 直接裁掉（搜索按钮看不见的原因） */
.btn_box > .flex {
  flex-wrap: wrap;
  row-gap: 8px;
}
.btn_box > .flex > .flex {
  min-width: 0;
}

/* 2. 搜索框随窗口宽度收窄：>=1600 保持 500px；1280~1600 收到 380px；<1280 独占一行 */
@media (max-width: 1600px) {
  .btn_box .big-search {
    width: 380px !important;
    margin-right: 12px !important;
  }
}
@media (max-width: 1280px) {
  .btn_box .big-search {
    width: 100% !important;
    margin-right: 0 !important;
  }
}

/* 3. 列表页卡片撑满可视高度：只拉伸卡片/内容容器，表格与分页保持原高度和原位置，
      避免分页跑左、表格内部被拉出空白。
      仅匹配同时含 .btn_box 和 .ant-table-wrapper 的页面。 */
.admin-layout-content:has(.btn_box):has(.ant-table-wrapper) {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 88px) !important;
}
.admin-layout-content:has(.btn_box):has(.ant-table-wrapper) > div {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) > div,
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) > div > div,
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) > div > div > div {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) .ant-card,
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) .ant-card-body,
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) .advanced-table,
.tabs-view-content:has(.btn_box):has(.ant-table-wrapper) .table {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 4. 外层 #popContainer 在 index.html 里写死了 overflow-y:scroll，
      内容没超出也会常驻一条竖向滚动条；改成 auto，只有真超出才出现。 */
#popContainer {
  overflow-y: auto !important;
}

/* 5. 窗口较矮（<=800px）时略收卡片内边距，给 20px 高的 footer 留出空间，避免出现竖向滚动条 */
@media (max-height: 800px) {
  .tabs-view-content:has(.btn_box):has(.ant-table-wrapper) .ant-card-body {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }
}

/* 6. 标签栏固定左对齐：.tabs-head 宽度随标签数收缩，原 margin:0 auto 会把少量标签居中 */
.tabs-head {
  margin-left: 0 !important;
  margin-right: auto !important;
}

/* 7. 固定标签栏（点锁后 affixed）左侧偏移跟随 200px 侧栏；原 CSS 写死 256px */
.tabs-container.affixed.side,
.tabs-container.affixed.mix {
  left: 200px !important;
}
.tabs-container.affixed.side.collapsed,
.tabs-container.affixed.mix.collapsed {
  left: 80px !important;
}

/* 8. 全屏时表格体仍按进入前的 scroll.y 固定高度，导致下方大片空白、行被截断；
      全屏状态下改成按视口高度计算（160px = 顶部工具栏 + 表头 + 分页） */
.advanced-table:fullscreen {
  background: #fff;
}
.advanced-table:fullscreen .ant-table-body {
  height: calc(100vh - 160px) !important;
  max-height: none !important;
}
