/* ==========================================
   mobile.css — 企业培训平台 移动端统一适配
   应用于：首页 + supplychain/oms/wms/erp/special
   ========================================== */

/* === 1. 平板适配 (≤900px) === */
@media (max-width: 900px) {
  /* 顶部标签栏 → 横向可滚动 */
  .topbar {
    padding: 0 10px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .topbar .tb-title {
    font-size: 14px;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .tb-title span {
    display: none; /* 隐藏副标题 */
  }
  .topbar .tb-tabs {
    display: flex !important;  /* 强制显示，覆盖 training.css 的 display:none */
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE */
    mask-image: linear-gradient(to right, black 0%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 0%, black 92%, transparent 100%);
    padding: 0 4px;
  }
  .topbar .tb-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  .topbar .tb-tabs a {
    flex-shrink: 0;
    padding: 5px 11px;
    font-size: 12px;
    border-radius: 16px;
  }
  .topbar .tb-search {
    display: none; /* 手机端隐藏搜索框 */
  }

  /* 汉堡菜单按钮 */
  .menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    position: static !important; /* 覆盖 OMS/WMS/ERP 内联 position:fixed，防止遮挡标签 */
    top: auto !important;
    left: auto !important;
    z-index: 50;
    order: -1; /* 放在最左边 */
  }
  .menu-btn:hover {
    background: rgba(255,255,255,0.2);
  }
  .menu-btn:active {
    background: rgba(255,255,255,0.3);
  }

  /* 侧边栏 → 抽屉模式 */
  .sidebar {
    position: fixed !important;
    top: 52px !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    min-width: auto !important;
    height: auto !important;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 45 !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
    padding-top: 0 !important;
    background: #fff;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }

  /* 遮罩层 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.35);
    z-index: 44;
  }
  .sidebar-overlay.show {
    display: block;
  }

  /* 主内容区 */
  .main, #main {
    margin-left: 0 !important;
    padding: 56px 14px 100px !important;
  }
  .chapter-title {
    font-size: 20px !important;
  }
  .section-title-bar {
    font-size: 15px !important;
    padding: 12px 16px !important;
  }
  .images-area {
    padding: 14px !important;
  }
  .dual-images {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .content-card {
    border-radius: 8px !important;
  }

  /* 图片点击放大提示 */
  .images-area img {
    max-height: 350px !important;
  }

  /* 顶部标签栏高度微调 */
  .topbar {
    height: 48px;
  }

  /* 签到按钮缩小 */
  .tb-signin {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }
}

/* === 2. 手机适配 (≤640px) === */
@media (max-width: 640px) {
  .topbar {
    padding: 0 6px;
    gap: 3px;
  }
  .topbar .tb-title {
    font-size: 12px;
    max-width: 50px;           /* 更激进地压缩标题，给标签栏让位 */
    white-space: nowrap;
  }
  .topbar .tb-title a {
    margin-right: 2px;
    font-size: 10px;
  }
  .topbar .tb-tabs {
    display: flex !important;  /* 强制显示 */
    flex: 2;                   /* 标签栏获得更多空间 */
    mask-image: none;          /* 去渐变遮罩，让所有标签都可见 */
    -webkit-mask-image: none;
  }
  .topbar .tb-tabs a {
    padding: 4px 7px;
    font-size: 11px;
    border-radius: 14px;
  }
  .menu-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  .sidebar {
    width: 260px !important;
  }
  .main, #main {
    padding: 50px 10px 110px !important;
  }
  .chapter-title {
    font-size: 18px !important;
  }
  .images-area img {
    max-height: 250px !important;
  }
}

/* === 2b. 小屏手机 (≤400px) — 标题完全收起 === */
@media (max-width: 400px) {
  .topbar .tb-title {
    display: none;             /* 小屏彻底隐藏标题，全部空间给标签 */
  }
  .topbar .tb-tabs {
    display: flex !important;
    flex: 3;
  }
  .topbar .tb-tabs a {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 12px;
  }
}

/* === 3. 首页卡片 badge 防遮盖 === */
@media (max-width: 760px) {
  .card-badge {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    display: inline-block;
    margin-left: 8px;
    font-size: 10px !important;
    padding: 2px 7px !important;
    vertical-align: middle;
  }
  .card-head {
    flex-wrap: wrap;
  }
  .card-head > div {
    flex: 1;
    min-width: 0;
  }
  .card-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding-right: 0;
  }
}

/* === 4. 底部翻页导航按钮 === */
@media (max-width: 900px) {
  .page-nav {
    display: flex !important;
    position: fixed;
    left: 14px;
    bottom: 24px;
    z-index: 40;
    gap: 10px;
  }
  .page-nav button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(37,99,235,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }
  .page-nav button:active {
    transform: scale(0.92);
    box-shadow: 0 1px 6px rgba(37,99,235,0.3);
  }
  .page-nav button:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
  }
}

@media (max-width: 640px) {
  .page-nav {
    left: 10px;
    bottom: 20px;
    gap: 8px;
  }
  .page-nav button {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}
