/* ==========================================================================
   慢城美居乡建 · P0 增强样式（表单弹窗 / 移动端操作栏 / 微调）
   依赖 style.css 的 CSS 变量，需在其后加载
   ========================================================================== */

/* ---------- 移动端底部三按钮 ---------- */
.mcm-bar {
  display: none;
}
@media (max-width: 768px) {
  /* 隐藏旧版单按钮悬浮条（若存在） */
  .sticky-phone-bar { display: none !important; }

  .mcm-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1.3fr;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 998;
    background: #fff;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.14);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .mcm-bar a, .mcm-bar button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
  }
  .mcm-bar .mcm-bar-main {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }
  .mcm-bar svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
  /* 给页面底部留出操作栏高度 */
  body { padding-bottom: 68px; }
}

/* ---------- 弹窗 ---------- */
.mcm-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 18, 0.55);
  backdrop-filter: blur(2px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity .22s ease;
}
.mcm-mask.is-open { opacity: 1; }
.mcm-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
  transform: translateY(14px);
  transition: transform .24s ease;
  -webkit-overflow-scrolling: touch;
}
.mcm-mask.is-open .mcm-dialog { transform: translateY(0); }

.mcm-head {
  padding: 20px 22px 0;
  position: relative;
}
.mcm-head h3 {
  margin: 0 0 6px;
  font-size: 1.28rem;
  color: var(--primary);
  letter-spacing: .5px;
}
.mcm-head p {
  margin: 0;
  font-size: .88rem;
  color: var(--text-mid);
  line-height: 1.6;
}
.mcm-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 34px; height: 34px;
  border: 0;
  background: transparent;
  color: #999;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}
.mcm-close:hover { background: #f2f2f2; color: #333; }

.mcm-body { padding: 16px 22px 22px; }

.mcm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .mcm-row { grid-template-columns: 1fr; } }

.mcm-field { margin-bottom: 12px; }
.mcm-field label {
  display: block;
  font-size: .82rem;
  color: var(--text-mid);
  margin-bottom: 5px;
  font-weight: 600;
}
.mcm-field label .req { color: #c0392b; }
.mcm-field input,
.mcm-field select,
.mcm-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  font-size: 16px; /* iOS 防缩放 */
  font-family: inherit;
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fdfcfa;
  transition: border-color .18s ease, box-shadow .18s ease;
  -webkit-appearance: none;
  appearance: none;
}
.mcm-field select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}
.mcm-field input:focus,
.mcm-field select:focus,
.mcm-field textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45, 90, 39, .12);
}
.mcm-field textarea { min-height: 64px; resize: vertical; }

.mcm-submit {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s ease;
}
.mcm-submit:hover { background: var(--primary-dark); }
.mcm-submit:disabled { opacity: .6; cursor: not-allowed; }

.mcm-tip {
  margin: 10px 0 0;
  font-size: .78rem;
  color: var(--text-light);
  line-height: 1.6;
  text-align: center;
}
.mcm-tip a { color: var(--text-mid); }

.mcm-err {
  display: none;
  margin: 0 0 10px;
  padding: 9px 12px;
  background: #fdf0ee;
  border: 1px solid #f3d2cc;
  border-radius: 8px;
  color: #b03a2e;
  font-size: .85rem;
}
.mcm-err.show { display: block; }

/* 提交成功 */
.mcm-done { text-align: center; padding: 26px 10px 8px; }
.mcm-done .ok {
  width: 62px; height: 62px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(45, 90, 39, .1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mcm-done .ok svg { width: 32px; height: 32px; stroke: var(--primary); fill: none; stroke-width: 2.5; }
.mcm-done h4 { margin: 0 0 8px; font-size: 1.1rem; color: var(--primary); }
.mcm-done p { margin: 0 0 16px; font-size: .88rem; color: var(--text-mid); line-height: 1.7; }
.mcm-done .btn { display: inline-block; }

/* 二维码弹层 */
.mcm-qr { text-align: center; }
.mcm-qr img {
  width: 190px; height: 190px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
  margin: 0 auto 12px;
}
.mcm-qr .wxid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-warm);
  border-radius: 999px;
  font-size: .9rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}
.mcm-qr .copy {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: .8rem;
  cursor: pointer;
  font-family: inherit;
}

body.mcm-lock { overflow: hidden; }

/* ---------- 正文内嵌表单区块（案例页/计算器页底部用） ---------- */
.mcm-inline-cta {
  margin: 0 auto;
  max-width: 720px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 22px;
  box-shadow: var(--shadow);
}
@media (max-width: 768px) {
  .mcm-inline-cta { padding: 20px 16px; border-radius: 12px; }
}

/* ==========================================================================
   图纸预览（图片版查看器）
   ========================================================================== */
.pdf-viewer-wrapper { max-width: 1100px !important; }

.drawing-page {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  margin: 0 auto;
  transition: width .18s ease;
}
.pdf-canvas-container { max-height: 82vh; }

/* 缩略图条 */
.dw-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 4px;
  margin: 14px auto 0;
  max-width: 1100px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.dw-thumbs::-webkit-scrollbar { height: 6px; }
.dw-thumbs::-webkit-scrollbar-thumb { background: #cfc8bf; border-radius: 3px; }
.dw-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 86px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
}
.dw-thumb img { width: 100%; height: 62px; object-fit: cover; display: block; background: #eee; }
.dw-thumb span {
  position: absolute;
  right: 2px; bottom: 1px;
  font-size: 10px;
  line-height: 1.5;
  color: #fff;
  background: rgba(0, 0, 0, .5);
  padding: 0 4px;
  border-radius: 3px;
}
.dw-thumb.active { border-color: var(--primary); box-shadow: 0 2px 10px rgba(45, 90, 39, .35); }

/* 图纸说明 + 行动按钮 */
.dw-note {
  max-width: 1100px;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: .9rem;
  color: var(--text-mid);
  line-height: 1.7;
}
.dw-note span { flex: 1; min-width: 220px; }
.dw-note .btn { white-space: nowrap; }

/* 表单内「补充信息」折叠块 */
.mcm-more {
  border-top: 1px dashed var(--border);
  margin: 4px 0 14px;
  padding-top: 10px;
}
.mcm-more > summary {
  cursor: pointer;
  font-size: .85rem;
  color: var(--primary-light);
  font-weight: 600;
  list-style: none;
  padding: 4px 0;
}
.mcm-more > summary::-webkit-details-marker { display: none; }
.mcm-more > summary::before { content: '＋ '; }
.mcm-more[open] > summary::before { content: '－ '; }
.mcm-more .mcm-field { margin-top: 10px; }

/* 页脚备案行 */
.footer-legal {
  margin-top: 8px;
  font-size: .78rem;
  color: rgba(255, 255, 255, .55);
}
.footer-legal a { color: rgba(255, 255, 255, .7); text-decoration: none; }
.footer-legal a:hover { color: #fff; text-decoration: underline; }
