/* REICIO 官网智能咨询窗口 — 样式 v3.1（完全隔离版 + LOGO/机器人头像）
   所有规则都带 #reicio-chat-root 前缀，权重高于官网主题的元素选择器，
   否则主题的 button/input 样式会漏进来把窗口比例撑坏（实测踩过）。 */

#reicio-chat-root *, #reicio-chat-root *::before, #reicio-chat-root *::after {
  box-sizing: border-box; margin: 0; padding: 0; border: 0; outline: none;
  background: none; font: inherit; color: inherit; line-height: 1.7;
  text-align: left; text-transform: none; letter-spacing: normal; text-shadow: none;
  float: none; box-shadow: none; min-width: 0; min-height: 0; max-width: none; max-height: none;
  width: auto; height: auto; position: static; display: block; list-style: none;
  -webkit-appearance: none; appearance: none;
}
#reicio-chat-root button, #reicio-chat-root input, #reicio-chat-root textarea { cursor: pointer; font-family: inherit; }
#reicio-chat-root textarea { cursor: text; resize: none; }
#reicio-chat-root span, #reicio-chat-root i, #reicio-chat-root em, #reicio-chat-root strong { display: inline; }

#reicio-chat-root { position: fixed; right: 20px; bottom: 20px; z-index: 99990; font-size: 14px; }
#reicio-chat-root .rc-wrap {
  position: relative; display: block;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px; line-height: 1.7; color: #282828;
}

/* 悬浮球 */
#reicio-chat-root .rc-ball {
  display: flex; align-items: center; gap: 8px; height: 48px;
  background: #1e3a8a; color: #fff; border-radius: 999px; padding: 0 18px 0 15px;
  box-shadow: 0 10px 26px rgba(30, 58, 138, .34);
}
#reicio-chat-root .rc-ball:hover { background: #172554; }
#reicio-chat-root .rc-ball-ic { font-size: 16px; line-height: 1; }
#reicio-chat-root .rc-ball-tx { font-size: 14px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
#reicio-chat-root .rc-wrap.rc-open .rc-ball { display: none; }

/* 面板：高度随屏幕自适应，短屏也不会被裁 */
#reicio-chat-root .rc-pn {
  display: none; flex-direction: column; width: 380px;
  height: min(560px, calc(100vh - 110px));
  height: min(560px, calc(100dvh - 110px));
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden;
  box-shadow: 0 22px 60px rgba(15, 25, 35, .3);
}
#reicio-chat-root .rc-wrap.rc-open .rc-pn { display: flex; }

/* 头部：固定 62px 单行 */
#reicio-chat-root .rc-hd {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: 62px; min-height: 62px; padding: 0 14px;
  background: linear-gradient(135deg, #1e3a8a, #172554); color: #fff;
}
#reicio-chat-root .rc-av {
  width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
  background: #fff; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
#reicio-chat-root .rc-av-img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: center; border-radius: 50%;
}
#reicio-chat-root .rc-hd-t { display: flex; flex-direction: column; justify-content: center; flex: 1; min-width: 0; }
#reicio-chat-root .rc-nm {
  font-size: 14.5px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#reicio-chat-root .rc-st { display: flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1.3; opacity: .92; white-space: nowrap; }
#reicio-chat-root .rc-st i { width: 7px; height: 7px; min-width: 7px; border-radius: 50%; background: #4ade80; }
#reicio-chat-root .rc-x {
  width: 26px; height: 26px; min-width: 26px; color: #fff; font-size: 17px;
  display: flex; align-items: center; justify-content: center; opacity: .85;
}

/* 消息区 */
#reicio-chat-root .rc-bd {
  flex: 1 1 auto; min-height: 120px; display: block;
  overflow-y: auto; padding: 12px 14px; background: #f6f7f9;
}
#reicio-chat-root .rc-msg { display: flex; margin-bottom: 10px; }
#reicio-chat-root .rc-bub {
  display: block; max-width: 84%; padding: 8px 11px;
  background: #fff; color: #282828; border-radius: 12px 12px 12px 3px;
  font-size: 13.3px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 3px rgba(20, 30, 40, .06);
}
#reicio-chat-root .rc-me { justify-content: flex-end; }
#reicio-chat-root .rc-me .rc-bub { background: #1e3a8a; color: #fff; border-radius: 12px 12px 3px 12px; }
#reicio-chat-root .rc-typing { display: flex; gap: 4px; align-items: center; }
#reicio-chat-root .rc-typing i { width: 6px; height: 6px; min-width: 6px; border-radius: 50%; background: #b9c1cf; animation: rc-blink 1.2s infinite; }
#reicio-chat-root .rc-typing i:nth-child(2) { animation-delay: .2s; }
#reicio-chat-root .rc-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes rc-blink { 0%, 60%, 100% { opacity: .35 } 30% { opacity: 1 } }

/* 快捷问题：两行内 */
#reicio-chat-root .rc-qs { display: flex; flex-wrap: wrap; gap: 6px; flex: none; padding: 8px 14px 10px; background: #f6f7f9; }
#reicio-chat-root .rc-qs button {
  display: inline-block; background: #fff; color: #1e3a8a;
  border: 1px solid #cfd8ea; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; line-height: 1.6; white-space: nowrap; height: 28px;
}
#reicio-chat-root .rc-qs button:hover { background: #eef2fc; }

/* 留资条：固定 46px 单行 */
#reicio-chat-root .rc-lead {
  display: flex; align-items: center; gap: 8px; flex: none;
  height: 46px; min-height: 46px; padding: 0 12px;
  background: #eef2fc; border-top: 1px solid #d7e0f5; font-size: 12.5px; color: #172554;
}
#reicio-chat-root .rc-lead-hot { background: #fff5ec; border-top-color: #f7d3b4; color: #9a3412; }
#reicio-chat-root .rc-lead-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reicio-chat-root .rc-lead button {
  flex: none; background: #f97316; color: #fff; border-radius: 8px; padding: 0 12px;
  height: 30px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 30px;
}
#reicio-chat-root .rc-lead button:hover { background: #ea6a0a; }

/* 输入区：固定 62px */
#reicio-chat-root .rc-ft {
  display: flex; align-items: center; gap: 8px; flex: none;
  height: 62px; min-height: 62px; padding: 0 12px; background: #fff; border-top: 1px solid #e5e7eb;
}
#reicio-chat-root .rc-ft textarea {
  flex: 1; height: 40px; min-height: 40px; max-height: 40px;
  background: #fff; color: #282828; border: 1px solid #e2e4e8; border-radius: 10px;
  padding: 8px 11px; font-size: 13px; line-height: 1.6;
}
#reicio-chat-root .rc-ft textarea::placeholder { color: #9aa3ad; }
#reicio-chat-root .rc-ft textarea:focus { border-color: #1e3a8a; }
#reicio-chat-root .rc-send {
  flex: none; width: 42px; height: 40px; background: #1e3a8a; color: #fff;
  border-radius: 10px; font-size: 16px; display: flex; align-items: center; justify-content: center;
}
#reicio-chat-root .rc-send:hover { background: #172554; }

/* 留资表单 */
#reicio-chat-root .rc-form {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  background: #fff; border-top: 1px solid #e5e7eb; padding: 14px;
  box-shadow: 0 -6px 24px rgba(15, 25, 35, .12);
}
#reicio-chat-root .rc-form-t { font-size: 13.5px; font-weight: 700; color: #172554; margin-bottom: 9px; }
#reicio-chat-root .rc-in {
  display: block; width: 100%; height: 38px; margin-bottom: 8px;
  background: #fff; color: #282828; border: 1px solid #e2e4e8; border-radius: 9px;
  padding: 8px 11px; font-size: 13px; line-height: 1.6;
}
#reicio-chat-root .rc-in::placeholder { color: #9aa3ad; }
#reicio-chat-root .rc-in:focus { border-color: #1e3a8a; }
#reicio-chat-root .rc-in-area { height: 58px; min-height: 58px; }
#reicio-chat-root .rc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#reicio-chat-root .rc-form-b { display: flex; gap: 8px; }
#reicio-chat-root .rc-ok {
  flex: 1; height: 42px; background: #f97316; color: #fff; border-radius: 9px;
  font-size: 13.5px; font-weight: 700; line-height: 42px; text-align: center;
}
#reicio-chat-root .rc-ok:hover { background: #ea6a0a; }
#reicio-chat-root .rc-no { flex: none; height: 42px; padding: 0 16px; background: #f1f2f4; color: #444; border-radius: 9px; font-size: 13.5px; line-height: 42px; }
#reicio-chat-root .rc-form-msg { font-size: 12.5px; margin-top: 7px; color: #0f7a4d; min-height: 16px; line-height: 1.5; }

/* 小气泡提示 */
#reicio-chat-root .rc-hint {
  position: absolute; right: 0; bottom: 62px; z-index: 4;
  background: #fff; color: #282828; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 9px 13px; font-size: 13px; white-space: nowrap;
  box-shadow: 0 10px 26px rgba(15, 25, 35, .14);
}
#reicio-chat-root .rc-hint::after {
  content: ""; position: absolute; right: 22px; bottom: -6px; width: 11px; height: 11px;
  background: #fff; border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb;
  transform: rotate(45deg);
}

/* 手机端 */
@media (max-width: 640px) {
  #reicio-chat-root { right: 12px; bottom: 12px; left: auto; }
  #reicio-chat-root .rc-ball { height: 46px; padding: 0 16px 0 13px; }
  #reicio-chat-root .rc-ball-tx { font-size: 13.5px; }
  #reicio-chat-root .rc-wrap.rc-open { position: fixed; left: 0; right: 0; bottom: 0; }
  #reicio-chat-root .rc-pn { width: 100vw; height: 78vh; height: 78dvh; max-height: 660px; border-radius: 14px 14px 0 0; border-left: 0; border-right: 0; }
  #reicio-chat-root .rc-ft textarea, #reicio-chat-root .rc-in { font-size: 16px; }
  #reicio-chat-root .rc-bub { max-width: 88%; }
  #reicio-chat-root .rc-hint { white-space: normal; max-width: 78vw; }
  #reicio-chat-root .rc-form { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
@media print { #reicio-chat-root { display: none !important; } }
