/* ============================================================
   知牛网 · 移动端适配层（mobile.css）
   ------------------------------------------------------------
   设计原则：
   · 仅在窄屏（手机，≤820px）生效；≥821px 的桌面端完全不受影响
   · 必须在 style.css 之后引入（同优先级规则后者覆盖）
   · 覆盖范围：导航（汉堡菜单）/ 首页 Hero / 商标网格 / 筛选区 /
     详情页 / 弹窗 / 用户中心 / 页脚 / 触控与输入体验
   ============================================================ */

@media (max-width: 820px) {

  /* ---------- 基础：防横向溢出 ---------- */
  html, body { overflow-x: hidden; }
  body { -webkit-text-size-adjust: 100%; }
  .container { max-width: 100%; padding-left: 14px; padding-right: 14px; }

  /* ---------- 顶栏（欢迎语 + 客服热线） ---------- */
  .top-bar-inner { flex-direction: column; gap: 2px; padding: 5px 12px; font-size: 12px; }
  .top-bar-inner a { margin-left: 10px !important; }

  /* ---------- 导航：汉堡菜单 ---------- */
  .navbar { position: sticky; top: 0; z-index: 900; box-shadow: 0 1px 0 rgba(17,24,39,.06); }
  .navbar-inner { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 14px; position: relative; }
  .logo { display: flex; align-items: center; }
  .logo img { height: 32px; width: auto; }

  /* 汉堡按钮（桌面端由下方 max-width:821px 规则隐藏） */
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px;
    width: 42px; height: 42px; padding: 0; margin: 0;
    border: none; background: transparent; cursor: pointer; border-radius: 8px;
  }
  .nav-toggle:active { background: var(--gray-100, #f3f4f6); }
  .nav-toggle span { display: block; width: 22px; height: 2px; background: var(--gray-800, #1f2937); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  .navbar.menu-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .navbar.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .navbar.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* 链接列表 → 下拉面板 */
  .nav-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; align-items: stretch;
    background: #fff; margin: 0; padding: 2px 14px 12px;
    border-top: 1px solid var(--gray-100, #f3f4f6);
    box-shadow: 0 14px 26px rgba(17, 24, 39, .14);
  }
  .navbar.menu-open .nav-links { display: flex; }
  .nav-links > a { display: block; font-size: 15px; font-weight: 500; padding: 13px 2px; border-bottom: 1px solid var(--gray-100, #f3f4f6); }
  .nav-links > a.active { border-bottom: 1px solid var(--gray-100, #f3f4f6); }
  .nav-user { margin: 12px 0 2px; gap: 10px; }
  .nav-user .btn { flex: 1; min-height: 42px; font-size: 15px; }

  /* ---------- 首页 Hero ---------- */
  .hero { padding: 34px 16px 52px; }
  .hero h1 { font-size: 25px; line-height: 1.35; word-break: break-word; }
  .hero .subtitle { font-size: 14px; line-height: 1.7; }
  .hero-stats { flex-wrap: wrap; gap: 18px; }
  .hero-stat b { font-size: 24px; }
  .hero-search { width: 100%; }
  .hero-search input { font-size: 15px; }

  /* ---------- 商标卡片网格：手机固定 2 列 ---------- */
  .trademark-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .trademark-card .badge { font-size: 11px; }

  /* ---------- 筛选区（列表页） ---------- */
  .filter-section { padding: 12px 14px; }
  .filter-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .filter-label { min-width: 0; padding-top: 0; }
  .filter-items { gap: 6px; }
  .filter-tag { padding: 6px 12px; font-size: 13px; }
  .filter-bar { flex-wrap: wrap; }
  .filter-price-input input { width: 76px; }
  .filter-select { max-width: 100%; }

  /* ---------- 详情页 ---------- */
  .detail-layout { grid-template-columns: 1fr; gap: 16px; }
  .detail-meta { grid-template-columns: repeat(2, 1fr); }
  .product-zoom-float { display: none; }   /* 悬停放大是鼠标交互，手机端禁用 */

  /* ---------- 弹窗：全宽 + 可滚动 ---------- */
  .form-modal { width: calc(100vw - 24px); max-width: 100%; max-height: 88vh; }
  .form-modal-header { padding: 16px; }
  .form-modal-body { padding: 16px; }

  /* ---------- 用户中心 ---------- */
  .user-center-layout { grid-template-columns: 1fr; }

  /* ---------- 页脚 ---------- */
  .footer-inner { padding: 26px 14px 18px; }
  .footer-bottom { padding: 14px; font-size: 12px; }
  /* 页脚栏目 2 列排布，公司信息占整行 */
  .footer-inner { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
  .footer-inner .footer-col:first-child { grid-column: 1 / -1; }
  .footer-col h4 { margin-bottom: 8px; font-size: 14px; }
  .footer-col a { margin-bottom: 5px; font-size: 13px; }

  /* ---------- 首页长区块压缩（解决手机端页面过长） ---------- */
  .section { padding: 26px 0; }
  .section-header { margin-bottom: 18px; }
  .section-header h2 { font-size: 20px; }
  .section-header .desc { font-size: 13px; }

  /* 类别导航 45 卡：1 列 → 2 列紧凑卡（隐藏描述行） */
  .all-cats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .cat-card { padding: 10px 12px; border-radius: 8px; }
  .cat-card-head { gap: 8px; margin-bottom: 0; }
  .cat-card-num { width: 24px; height: 24px; border-radius: 5px; font-size: 12px; flex: none; }
  .cat-card-name { font-size: 13.5px; }
  .cat-card-sub { display: none; }

  /* 热门知产服务 5 卡：1 列 → 2 列紧凑卡 */
  .service-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .service-card { padding: 14px 10px; }
  .service-card .icon { font-size: 28px; margin-bottom: 6px; }
  .service-card h3 { font-size: 14px; margin-bottom: 4px; }
  .service-card p { font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .service-card .price-hint { margin-top: 4px; font-size: 12px; }

  /* 为什么选择 4 卡：1 列 → 2 列紧凑卡 */
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .why-card { padding: 14px 10px; border-radius: 10px; }
  .why-icon { width: 40px; height: 40px; font-size: 20px; margin-bottom: 6px; }
  .why-card h3 { font-size: 14px; margin-bottom: 4px; }
  .why-card p { font-size: 12px; line-height: 1.5; }

  /* 专家团队：压缩头像与内边距 */
  .team-grid { gap: 8px; }
  .team-card { padding: 14px 10px; }

  /* ---------- 触控与输入体验 ---------- */
  .btn { min-height: 40px; }
  /* 输入框 16px：避免 iOS 聚焦时自动放大页面 */
  input, select, textarea { font-size: 16px; }
  .filter-tag, .chip, .tab { cursor: default; }

  /* 表格类内容防撑破（看板/帮助等页面的小表格） */
  .site-footer table, .help-content table { display: block; overflow-x: auto; }
}

/* ---------- 更窄屏（≤480px）微调 ---------- */
@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .hero-stats { gap: 14px; }
  .hero-stat b { font-size: 21px; }
  .trademark-grid { gap: 8px; }
  .detail-meta { grid-template-columns: 1fr; }
}

/* ---------- 桌面端兜底：>820px 永远隐藏汉堡按钮 ---------- */
@media (min-width: 821px) {
  .nav-toggle { display: none !important; }
}
