/**
 * 沃大师农资SaaS - 响应式适配（店主端/平台后台侧栏抽屉）
 * 农户端采用独立 PC/Mobile 双模板机制，见 BaseController::h5Fetch()
 */

/* ========== 店主端响应式 ========== */

/* 侧栏遮罩：手机端默认隐藏 */
.m-sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 80;
}

/* 汉堡菜单按钮：默认隐藏，手机端显示 */
.m-menu-btn {
  display: none !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin-right: 10px;
  flex-shrink: 0;
}
.m-menu-btn:active { background: rgba(255,255,255,0.15); }

/* 平板：侧栏折叠为图标 */
@media (max-width: 1100px) and (min-width: 701px) {
  .m-shell {
    grid-template-columns: 64px 1fr !important;
  }
  .m-sidebar .user-info,
  .m-sidebar .logo b,
  .m-sidebar .nav-group-title,
  .m-sidebar .nav-item span,
  .m-sidebar .nav-item .badge,
  .m-sidebar .nav-item .nav-arrow,
  .m-sidebar .sub-nav,
  .m-sidebar .sidebar-foot {
    display: none !important;
  }
  .m-sidebar .logo { justify-content: center; padding: 14px 0; }
  .m-sidebar .nav-item {
    justify-content: center;
    padding: 14px 0;
    font-size: 20px;
  }
  .m-main { padding: 12px; }
}

/* 手机端 */
@media (max-width: 700px) {
  .m-shell {
    grid-template-columns: 1fr !important;
  }
  .m-menu-btn { display: inline-flex !important; }
  .m-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 260px;
    z-index: 90;
    transition: left 0.28s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }
  .m-sidebar.m-open {
    left: 0;
  }
  .m-sidebar-mask.m-show {
    display: block;
  }
  .m-topbar {
    padding: 0 12px !important;
    height: 52px !important;
  }
  .m-main { padding: 10px; }
  /* 开单页三栏手机堆叠 */
  .bl-three {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .bl-col-body { padding: 10px; }
  /* 表单两列变一列 */
  .sf-row { grid-template-columns: 1fr !important; gap: 10px; }
  /* 订单/商品列表小屏优化 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  /* 表格横滑 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data-table { min-width: 600px; }
  /* 弹窗宽度 */
  .modal, .dialog, .pop-box {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    max-height: 85vh;
    margin: 0 12px;
  }
}

/* ========== 平台后台响应式 ========== */
.a-sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 80;
}

/* 后台侧栏在手机端也走抽屉 */
@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr !important;
  }
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    z-index: 90;
    transition: left 0.25s ease;
  }
  .sidebar.a-open { left: 0; }
  .a-sidebar-mask.a-show { display: block; }
  .topbar-toggle { display: inline-flex !important; }
  .main-content { padding: 10px; }
  .topbar { padding: 0 10px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .form-row.two-col,
  .form-row.three-col { grid-template-columns: 1fr !important; }
  .panel-card { padding: 12px; }
  .list-toolbar { flex-wrap: wrap; gap: 8px; }
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data-table { min-width: 700px; }
}

/* ========== 农户端 PC 布局辅助（不强行居中手机壳，由 pc_*.html 专用模板自行布局） ========== */
@media (max-width: 767px) {
  body { -webkit-text-size-adjust: 100%; }
}
