/* ══════════════════════════════════════════════════════════════════
   JsonUI-demo 响应式层（B21）：不同分辨率下的布局与组件显隐配置。
   断点（对齐 JsonUIadmin / antd 惯例）：
     ≥1200      桌面（默认样式，无需规则）
     992~1199   笔记本（部件收缩）
     768~991    平板（侧栏收为抽屉式，☰ 唤起）
     <768       手机（JS 识别后根节点挂 vd-shell--mobile：底部导航 + 移动端布局）
     <576       小屏手机
   说明：JS 内联 display 的场景（标签栏/顶栏部件）由 main.js applyShellPrefs
   按断点联动；本文件内 !important 仅用于覆盖组件自带内联样式。
   ══════════════════════════════════════════════════════════════════ */

/* ── 笔记本 992~1199：部件收缩，网格降列 ── */
@media (max-width: 1199px) {
  .vd-header__search { width: 120px !important; }
  .vd-hmenu__label { padding: 6px 8px; font-size: 13px; }
  .vd-content { padding: 12px; }
  .vd-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .vd-pref__panel { width: 340px; }
}

/* ── 平板 768~991：侧栏收为抽屉式 ── */
@media (max-width: 991px) {
  .vd-header__crumb { display: none !important; }
  .vd-header__search { width: 100px !important; }
  .vd-sider {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 800;
    width: var(--vd-sidebar-w) !important;
    transform: translateX(-105%); transition: transform .25s ease;
    box-shadow: 6px 0 24px rgba(0, 0, 0, .18);
  }
  .vd-shell--menu-open .vd-sider { transform: translateX(0); }
  .vd-sider__resizer { display: none !important; }
  .vd-shell--collapsed .vd-sider { width: var(--vd-sidebar-w) !important; }
  .vd-shell--collapsed .vd-sider__arrow,
  .vd-shell--collapsed .vd-sider__label,
  .vd-shell--collapsed .vd-sider__logo-text { display: inline; }
  .vd-shell--collapsed .vd-sider__group--open .vd-sider__items { display: block; }
  .vd-shell--collapsed .vd-sider__item { padding-left: 42px; }
  .vd-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .vd-grid-2 { grid-template-columns: 1fr; }
}

/* ── 手机 <768：底部导航 + 移动端布局（JS 挂 vd-shell--mobile） ── */
.vd-bottombar { display: none; }
.vd-sider-mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 790; }

@media (max-width: 767px) {
  /* 侧栏抽屉遮罩（平板同） */
  .vd-shell--menu-open .vd-sider-mask { display: block; }

  /* 顶栏：紧凑 + 当前页标题替代面包屑 */
  .vd-shell--mobile .vd-header { padding: 0 6px; gap: 2px; }
  .vd-shell--mobile .vd-header__title {
    display: inline-block; font-size: 15px; font-weight: 600; margin-left: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
  }
  .vd-shell--mobile .vd-header__menu,
  .vd-shell--mobile .vd-menubar { display: none !important; }

  /* 内容区 */
  .vd-shell--mobile .vd-content { padding: 10px; }
  .vd-shell--mobile .vd-grid-4,
  .vd-shell--mobile .vd-grid-3,
  .vd-shell--mobile .vd-grid-2 { grid-template-columns: 1fr; }
  .vd-shell--mobile .vd-footer { font-size: 11px; padding: 8px 6px; }

  /* 偏好抽屉全屏宽 */
  .vd-pref__panel { width: 100vw; max-width: 100vw; }

  /* 表格等宽内容允许横向滑动 */
  .vd-shell--mobile .vd-content { -webkit-overflow-scrolling: touch; }
  .vd-shell--mobile .jsui-table { display: block; overflow-x: auto; }

  /* 底部主导航（主菜单移至最下面） */
  .vd-shell--mobile .vd-bottombar {
    display: flex; flex: none;
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-bg-card, #fff);
    border-top: 1px solid var(--color-border-base, #e5e6eb);
  }
}

/* 底部导航与底部弹出层（结构样式，显隐由 vd-shell--mobile 门控） */
.vd-bottombar__item {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 18px; color: var(--color-fg-secondary, #646a73); padding: 4px 0;
}
.vd-bottombar__item small { font-size: 10px; white-space: nowrap; }
.vd-bottombar__item--active { color: var(--vd-primary); }

.vd-sheet { position: fixed; inset: 0; z-index: 950; }
.vd-sheet__mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.vd-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 60vh; overflow-y: auto;
  background: var(--color-bg-card, #fff); border-radius: 16px 16px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: vd-sheet-up .22s ease;
}
@keyframes vd-sheet-up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
.vd-sheet__title { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--color-fg-base, #1f2329); }
.vd-sheet__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vd-sheet__item {
  border: 1px solid var(--color-border-base, #e5e6eb); background: none; border-radius: 10px;
  padding: 12px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 18px; color: var(--color-fg-base, #1f2329);
}
.vd-sheet__item small { font-size: 11px; color: var(--color-fg-secondary, #646a73); white-space: nowrap; }
.vd-sheet__item--active { border-color: var(--vd-primary); color: var(--vd-primary); }
.vd-sheet__item--active small { color: var(--vd-primary); }

/* ── 小屏手机 <576 ── */
@media (max-width: 575px) {
  .vd-shell--mobile .vd-header__title { font-size: 14px; max-width: 38vw; }
  .vd-sheet__grid { grid-template-columns: repeat(3, 1fr); }
  .vd-login__panel { width: 100%; padding: 0 16px; }
  .vd-login__box { width: 100%; max-width: 340px; }
}

/* ── 平板抽屉遮罩复用 ── */
@media (min-width: 768px) and (max-width: 991px) {
  .vd-shell--menu-open .vd-sider-mask { display: block; }
}

/* ══════════ B22 手机端顶部二级菜单条（每组 sub.mobile=top-bar 时显示） ══════════ */
.vd-submenu-bar { display: none; }
.vd-shell--mobile .vd-submenu-bar {
  display: flex; flex: none; align-items: center; gap: 8px; padding: 8px 10px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--color-bg-card, #fff); border-bottom: 1px solid var(--color-border-base, #e5e6eb);
}
.vd-shell--mobile .vd-submenu-bar::-webkit-scrollbar { display: none; }
.vd-submenu-bar__item {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer;
  padding: 5px 14px; font-size: 13px; color: var(--color-fg-secondary, #646a73);
  border: 1px solid var(--color-border-base, #e5e6eb); background: none;
}
.vd-submenu-bar--rounded .vd-submenu-bar__item { border-radius: 999px; }
.vd-submenu-bar--plain .vd-submenu-bar__item { border-radius: 4px; }
.vd-submenu-bar__item--active {
  background: var(--vd-primary); border-color: var(--vd-primary); color: #fff;
}

/* ══════════ B22 PC 侧栏：每组二级菜单样式变体 / 无二级菜单组 ══════════ */
.vd-sider__items--rounded .vd-sider__item { border-radius: 8px; margin: 2px 8px; }
.vd-sider__items--plain .vd-sider__item { border-radius: 0; margin: 0; }
.vd-sider__group--nosub .vd-sider__group-title { font-weight: 400; }
.vd-sider__group--active > .vd-sider__group-title { background: var(--vd-sidebar-active); color: #fff; border-radius: 8px; margin: 2px 8px; padding: 10px 8px; }
.vd-shell--light-sider .vd-sider__group--active > .vd-sider__group-title { background: var(--color-primary-1, #e6f0fb); color: var(--vd-primary); }

/* ══════════ 手机端：全局隐藏滚动条 + 原生惯性滚动（跟手机一样） ══════════ */
.vd-shell--mobile, .vd-shell--mobile * { scrollbar-width: none; }
.vd-shell--mobile *::-webkit-scrollbar { display: none; width: 0; height: 0; }
.vd-shell--mobile .vd-content-wrap, .vd-shell--mobile .vd-content { -webkit-overflow-scrolling: touch; }
