/* =============================================
   宇浩智联 - 全站交互组件
   悬浮操作条 · 在线留言弹窗 · 智能问答机器人
   与 style.css 的 #4632CD 主色保持一致
   ============================================= */

/* ---------------- 悬浮操作条 ---------------- */
.yh-fab {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.yh-fab-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(70, 50, 205, 0.18);
  box-shadow: 0 6px 20px rgba(70, 50, 205, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  padding: 0;
}
.yh-fab-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateX(-3px);
}
.yh-fab-btn svg { width: 22px; height: 22px; display: block; }
.yh-fab-btn.yh-fab-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.yh-fab-btn.yh-fab-primary:hover { background: var(--primary-dark); }
.yh-fab-top { display: none; }
.yh-fab-top.show { display: flex; }

/* 电话悬浮面板 */
.yh-fab-panel {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
  width: 232px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(28, 24, 80, 0.18);
  padding: 16px 18px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.yh-fab-item:hover .yh-fab-panel,
.yh-fab-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
.yh-fab-panel h4 { font-size: 0.9rem; color: #111; margin-bottom: 10px; font-weight: 700; }
.yh-fab-panel a.yh-tel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  padding: 9px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}
.yh-fab-panel a.yh-tel svg { width: 18px; height: 18px; flex-shrink: 0; }
.yh-fab-panel a.yh-tel:last-of-type { border-bottom: none; }
.yh-fab-panel a.yh-tel:hover { color: var(--primary-dark); }
.yh-fab-panel .yh-panel-note { font-size: 0.78rem; color: #777; margin-top: 8px; line-height: 1.6; }
.yh-fab-panel img.yh-qr { width: 150px; display: block; margin: 0 auto 8px; border-radius: 8px; }
.yh-fab-panel .yh-qr-tip { font-size: 0.78rem; color: #777; text-align: center; }

/* 电话面板：复制号码按钮 */
.yh-fab-panel .yh-copy-tel {
  display: block;
  width: 100%;
  margin: 10px 0 0;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(70, 50, 205, 0.08);
  border: 1px solid rgba(70, 50, 205, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.yh-fab-panel .yh-copy-tel:hover { background: rgba(70, 50, 205, 0.16); }

/* 电话面板：电话 / 二维码之间的分隔线 */
.yh-fab-panel .yh-panel-split {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  font-size: 0.76rem;
  color: #999;
}
.yh-fab-panel .yh-panel-split::before,
.yh-fab-panel .yh-panel-split::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
}
.yh-fab-arrow {
  position: absolute;
  right: -6px;
  top: 50%;
  margin-top: -6px;
  width: 12px; height: 12px;
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  transform: rotate(45deg);
}

/* 移动端：底部操作条 */
@media (max-width: 980px) {
  body.yh-has-fab { padding-bottom: 62px; }
  .yh-fab {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    flex-direction: row;
    gap: 0;
    background: #fff;
    border-top: 1px solid rgba(70, 50, 205, 0.16);
    box-shadow: 0 -4px 20px rgba(28, 24, 80, 0.1);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .yh-fab-btn {
    flex: 1;
    width: auto;
    height: 48px;
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 10px;
    font-size: 0.68rem;
    gap: 1px;
  }
  .yh-fab-btn:hover { transform: none; background: rgba(70, 50, 205, 0.07); color: var(--primary); }
  .yh-fab-btn.yh-fab-primary { background: transparent; color: var(--primary); }
  .yh-fab-btn.yh-fab-primary:hover { background: rgba(70, 50, 205, 0.07); }
  .yh-fab-btn svg { width: 20px; height: 20px; }
  .yh-fab-panel {
    right: auto;
    left: 12px;
    top: auto;
    bottom: 62px;
    transform: translateY(8px);
    width: calc(100vw - 24px);
    max-width: 300px;
  }
  .yh-fab-item:hover .yh-fab-panel,
  .yh-fab-panel.open { transform: translateY(0); }
  .yh-fab-arrow { display: none; }
}

/* ---------------- 通用遮罩与弹窗 ---------------- */
.yh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 60, 0.5);
  backdrop-filter: blur(3px);
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.yh-overlay.open { opacity: 1; visibility: visible; }
.yh-modal {
  width: min(680px, 100%);
  max-height: min(90vh, 860px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(20, 16, 60, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(0.99);
  transition: transform 0.25s ease;
}
.yh-overlay.open .yh-modal { transform: translateY(0) scale(1); }
.yh-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(135deg, rgba(70, 50, 205, 0.07), rgba(0, 212, 232, 0.07));
}
.yh-modal-head h3 { font-size: 1.08rem; font-weight: 800; color: #111; margin: 0; }
.yh-modal-head p { font-size: 0.82rem; color: #666; margin: 3px 0 0; }
.yh-close {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #444;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.yh-close:hover { background: rgba(0, 0, 0, 0.12); color: #111; }
.yh-modal-body { padding: 22px; overflow-y: auto; }

/* ---------------- 留言表单 ---------------- */
.yh-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.yh-field { display: flex; flex-direction: column; gap: 6px; }
.yh-field.yh-full { grid-column: 1 / -1; }
.yh-field label { font-size: 0.85rem; font-weight: 700; color: #222; }
.yh-field label .req { color: #d33; margin-left: 2px; }
.yh-field input,
.yh-field select,
.yh-field textarea {
  font-family: inherit;
  font-size: 0.92rem;
  color: #111;
  background: #fbfbfe;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 11px 13px;
  transition: var(--transition);
  width: 100%;
}
.yh-field textarea { min-height: 96px; resize: vertical; }
.yh-field input:focus,
.yh-field select:focus,
.yh-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(70, 50, 205, 0.12);
}
.yh-field .yh-err { font-size: 0.78rem; color: #d33; min-height: 0; }
.yh-field.yh-invalid input,
.yh-field.yh-invalid select,
.yh-field.yh-invalid textarea { border-color: #d33; background: #fff6f6; }
.yh-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.yh-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.yh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}
.yh-btn-primary { background: var(--primary); color: #fff; }
.yh-btn-primary:hover { background: var(--primary-dark); }
.yh-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.yh-btn-ghost { background: transparent; border: 1.5px solid rgba(70, 50, 205, 0.4); color: var(--primary); }
.yh-btn-ghost:hover { border-color: var(--primary); background: rgba(70, 50, 205, 0.06); }
.yh-form-note { font-size: 0.8rem; color: #777; line-height: 1.6; }
.yh-form-side {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.yh-form-side .yh-side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #333;
}
.yh-form-side .yh-side-item svg { width: 20px; height: 20px; color: var(--primary); flex-shrink: 0; }
.yh-form-side .yh-side-item a { color: var(--primary); font-weight: 700; }
.yh-success {
  text-align: center;
  padding: 12px 4px 4px;
}
.yh-success .yh-success-icon {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: rgba(70, 50, 205, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 1.6rem;
}
.yh-success h4 { font-size: 1.05rem; color: #111; margin-bottom: 8px; font-weight: 800; }
.yh-success p { font-size: 0.9rem; color: #444; line-height: 1.75; }
.yh-success .yh-success-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.yh-preview {
  margin-top: 14px;
  text-align: left;
  background: #f7f7fc;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: #444;
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
}

/* ---------------- 智能问答机器人 ---------------- */
.yh-chat {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 940;
  width: 384px;
  height: min(620px, calc(100vh - 120px));
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(20, 16, 60, 0.26);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.yh-chat.open { opacity: 1; visibility: visible; transform: translateY(0); }
.yh-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deeper));
  color: #fff;
}
.yh-chat-head .yh-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.yh-chat-head .yh-avatar svg { width: 20px; height: 20px; }
.yh-chat-head strong { display: block; font-size: 0.95rem; font-weight: 700; }
.yh-chat-head span { display: block; font-size: 0.75rem; opacity: 0.75; }
.yh-chat-head .yh-close { background: rgba(255, 255, 255, 0.16); color: #fff; margin-left: auto; }
.yh-chat-head .yh-close:hover { background: rgba(255, 255, 255, 0.3); color: #fff; }
.yh-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f7f7fc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.yh-msg { display: flex; gap: 8px; max-width: 92%; }
.yh-msg .yh-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.yh-msg-bot .yh-bubble {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #222;
  border-top-left-radius: 4px;
}
.yh-msg-user { margin-left: auto; flex-direction: row-reverse; }
.yh-msg-user .yh-bubble {
  background: var(--primary);
  color: #fff;
  border-top-right-radius: 4px;
}
.yh-msg .yh-bubble a { color: var(--primary); font-weight: 700; text-decoration: underline; }
.yh-msg-user .yh-bubble a { color: #fff; }
.yh-msg-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.yh-msg-links .yh-btn { padding: 8px 14px; font-size: 0.82rem; }
.yh-msg-src { display: block; margin-top: 8px; font-size: 0.76rem; color: #888; }
.yh-typing { display: flex; gap: 4px; padding: 12px 14px; }
.yh-typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: yhBlink 1.2s infinite ease-in-out;
}
.yh-typing i:nth-child(2) { animation-delay: 0.2s; }
.yh-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes yhBlink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.yh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 0;
  background: #f7f7fc;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.yh-chip {
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--primary);
  background: #fff;
  border: 1px solid rgba(70, 50, 205, 0.28);
  border-radius: 100px;
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.yh-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.yh-chat-foot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.yh-chat-foot textarea {
  flex: 1;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 10px 12px;
  resize: none;
  height: 44px;
  max-height: 120px;
}
.yh-chat-foot textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(70, 50, 205, 0.12); }
.yh-chat-foot .yh-send {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.yh-chat-foot .yh-send:hover { background: var(--primary-dark); }
.yh-chat-foot .yh-send svg { width: 20px; height: 20px; }

@media (max-width: 980px) {
  .yh-chat {
    right: 10px;
    left: 10px;
    bottom: 72px;
    width: auto;
    height: min(70vh, 560px);
  }
}

/* ---------------- 产品实拍图 ---------------- */
.duo-photo {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
}
.duo-photo img {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 8px;
}
.duo-photo.duo-photo-wide img { max-width: 100%; }
.duo-photo figcaption {
  font-size: 0.8rem;
  color: #777;
  text-align: center;
  margin-top: 10px;
}
.duo-photo-block { display: block; }
.duo-photo-block figcaption { margin-top: 8px; text-align: center; }

/* ---------------- 轻提示 ---------------- */
.yh-toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(28, 24, 80, 0.94);
  color: #fff;
  font-size: 0.86rem;
  padding: 11px 20px;
  border-radius: 100px;
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.yh-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------------- 页面内留言区 ---------------- */
.yh-inline-form {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  box-shadow: 0 10px 34px rgba(28, 24, 80, 0.07);
}
.yh-inline-form .yh-form-head { margin-bottom: 20px; }
.yh-inline-form .yh-form-head h3 { font-size: 1.25rem; font-weight: 800; color: #111; margin-bottom: 6px; }
.yh-inline-form .yh-form-head p { font-size: 0.9rem; color: #555; }
.yh-message-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 30px;
  align-items: start;
}
.yh-contact-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
}
.yh-contact-card h4 { font-size: 1rem; font-weight: 800; color: #111; margin-bottom: 14px; }
.yh-contact-card .yh-contact-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  color: #333;
}
.yh-contact-card .yh-contact-row:last-child { border-bottom: none; }
.yh-contact-card .yh-contact-row svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; margin-top: 3px; }
.yh-contact-card .yh-contact-row strong { display: block; color: #111; margin-bottom: 2px; font-size: 0.88rem; }
.yh-contact-card .yh-contact-row a { color: var(--primary); font-weight: 700; }
.yh-contact-card .yh-qr { width: 100%; max-width: 200px; margin: 14px auto 6px; display: block; border-radius: 10px; }
.yh-contact-card .yh-qr-cap { text-align: center; font-size: 0.8rem; color: #777; }

@media (max-width: 980px) {
  .yh-message-grid { grid-template-columns: 1fr; gap: 22px; }
  .yh-inline-form { padding: 22px 18px; }
}
@media (max-width: 720px) {
  .yh-form-grid { grid-template-columns: 1fr; }
  .yh-modal-body { padding: 18px 16px; }
  .yh-toast { bottom: 76px; }
}
