/* =====================================================
   qing 手册咨询弹窗
   前缀: qmm-

   开合靠 .qmm-is-open 类切换（JS 只加减类，动画全在这里）。
   进出场：遮罩渐隐渐显，弹窗同时缩放 + 上移，形成"弹出"感。
   ===================================================== */

/* 弹窗根节点铺满视口。
   hidden 属性由 JS 控制：关闭动画走完才置 hidden，否则
   display:none 会立刻掐断过渡。
   这里显式写 [hidden] 是因为下面给了 display:flex —— 它会覆盖
   浏览器对 hidden 的默认 display:none。 */
.qmm {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.qmm[hidden] {
  display: none;
}

/* 打开时锁住页面滚动，避免背景跟着滑动 */
body.qmm-lock {
  overflow: hidden;
}

/* ---------- 遮罩 ---------- */
.qmm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 40, 0.55);
  opacity: 0;
  transition: opacity 0.26s ease;
}

.qmm-is-open .qmm-overlay {
  opacity: 1;
}

/* ---------- 弹窗主体 ----------
   初始态：略微缩小并下移，配合透明度做进场。
   transition 的 260ms 要和 JS 里 closeModal 的 setTimeout 对齐，
   否则动画没走完就被 hidden 掐断。
   cubic-bezier 末段回弹一点，比线性更有"弹出"的手感。 */
.qmm-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-sizing: border-box;
  background: #fff;
  /* 直角：弹窗、输入框、按钮、标签全部无圆角 */
  border-radius: 0;
  padding: 34px 36px 36px;
  box-shadow: 0 24px 60px rgba(8, 20, 40, 0.28);
  opacity: 0;
  transform: translateY(24px) scale(0.96);
  transition: opacity 0.26s ease,
    transform 0.26s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.qmm-is-open .qmm-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 用户在系统里开了「减少动态效果」就取消位移与缩放。
   只留透明度变化——完全去掉过渡会让弹窗生硬地闪现。 */
@media (prefers-reduced-motion: reduce) {
  .qmm-dialog {
    transform: none;
    transition: opacity 0.2s ease;
  }

  .qmm-is-open .qmm-dialog {
    transform: none;
  }
}

/* ---------- 关闭按钮 ---------- */
.qmm-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #8a94a6;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.qmm-close:hover {
  background: #f1f4f9;
  color: #333;
}

/* ---------- 头部 ---------- */
.qmm-title {
  margin: 0 0 10px;
  padding-right: 36px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
  color: #111;
}

.qmm-sub {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.7;
  color: #666;
}

/* ---------- 表单 ---------- */
.qmm-field {
  margin-bottom: 16px;
}

.qmm-label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 700;
  color: #222;
}

.qmm-req {
  margin-left: 2px;
  color: #e5484d;
}

.qmm-input,
.qmm-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 14px;
  border: 1px solid #e2e6ec;
  border-radius: 0;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: #222;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.qmm-textarea {
  min-height: 76px;
  resize: vertical;
}

.qmm-input:focus,
.qmm-textarea:focus {
  outline: none;
  border-color: #1f6feb;
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.12);
}

.qmm-input::placeholder,
.qmm-textarea::placeholder {
  color: #a7b0c0;
}

/* 校验失败的字段 */
.qmm-field--error .qmm-input,
.qmm-field--error .qmm-textarea,
.qmm-field--error .qmm-picker-select {
  border-color: #e5484d;
}

.qmm-error {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #e5484d;
}

/* ---------- 蜜罐字段 ----------
   给机器人看的诱饵，真人不可见也不可聚焦。
   不用 display:none：部分爬虫会跳过隐藏字段，反而失效。 */
.qmm-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- 产品多选（输入搜索 + 下拉建议） ----------
   输入名称 → AJAX 搜索 → 从下拉里选 → 变成一枚标签。
   不平铺全部产品：产品多了会占掉半屏。
   已选值由 JS 汇总进隐藏 input 一起提交。 */
.qmm-picker {
  position: relative;
}

/* 已选标签区。没选东西时不占高度，免得输入框上方空一条。 */
.qmm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.qmm-chips--empty {
  display: none;
}

.qmm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 12px;
  border-radius: 0;
  background: #1f6feb;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.qmm-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qmm-chip-del {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.qmm-chip-del:hover {
  background: rgba(255, 255, 255, 0.42);
}

/* ---------- 下拉建议面板 ----------
   绝对定位浮在后续字段之上，所以 .qmm-picker 需要 position: relative。
   z-index 只需压过同级的表单字段，不必很高。 */
.qmm-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 240px;
  overflow-y: auto;
  margin-top: -1px;
  border: 1px solid #dbe2ee;
  background: #fff;
  box-shadow: 0 10px 26px rgba(8, 20, 40, 0.12);
}

.qmm-suggest[hidden] {
  display: none;
}

.qmm-sug {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #333;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

/* hover 与键盘高亮共用一套观感，上下键浏览时视觉一致 */
.qmm-sug:hover,
.qmm-sug.qmm-sug--active {
  background: #eef4ff;
  color: #1550b3;
}

/* 已在标签里的项：仍然列出但不可再选，避免用户反复点同一个没反应 */
.qmm-sug[aria-disabled="true"] {
  color: #a7b0c0;
  cursor: default;
}

.qmm-sug[aria-disabled="true"]:hover {
  background: transparent;
  color: #a7b0c0;
}

/* 加载中 / 无结果 / 出错的提示行 */
.qmm-suggest-state {
  padding: 10px 14px;
  color: #9aa3b2;
  font-size: 14px;
  line-height: 1.6;
}

.qmm-suggest-state--error {
  color: #c1272d;
}

/* ---------- 提交区 ---------- */
.qmm-actions {
  margin-top: 22px;
}

.qmm-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  padding: 15px 32px;
  border: none;
  border-radius: 0;
  background: #1f6feb;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.qmm-submit:hover {
  background: #1858c8;
}

.qmm-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* 提交中把整个表单调淡并挡住交互，防止重复提交 */
.qmm-form--busy {
  opacity: 0.75;
  pointer-events: none;
}

/* ---------- 结果提示 ---------- */
.qmm-notice {
  margin-top: 14px;
  padding: 11px 14px;
  border-radius: 0;
  font-size: 14px;
  line-height: 1.6;
}

.qmm-notice--success {
  background: #e8f7ee;
  color: #1a7f42;
}

.qmm-notice--error {
  background: #fdeced;
  color: #c1272d;
}

/* ---------- 响应式 ---------- */
@media (max-width: 600px) {
  .qmm {
    padding: 14px;
  }

  .qmm-dialog {
    max-height: calc(100vh - 28px);
    padding: 26px 20px 28px;
    border-radius: 0;
  }

  .qmm-title {
    font-size: 20px;
  }

  .qmm-submit {
    width: 100%;
  }
}
