/* ==========================================================================
   特瑞纳官网 · 在线客服咨询窗（2026-10-19 V2.0）
   所有类名以 .trn-chat- 前缀，避免污染官网既有样式；
   不引用任何外部字体与图标，纯 CSS 绘制，首开 < 100ms。
   ========================================================================== */

.trn-chat-root,
.trn-chat-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.trn-chat-root {
  position: fixed;
  z-index: 9000;
  inset: auto 0 0 auto;
  width: 0;
  height: 0;
  --tc-main: #F05030;
  --tc-main2: #FF7A45;
  --tc-ink: #181820;
  --tc-ink2: #3d3d4a;
  --tc-sub: #82828f;
  --tc-line: #e9ebf1;
  --tc-bg: #ffffff;
}

.trn-chat-root[data-pos="left"] { left: 0; right: auto; }

/* ---------------- 气泡 ---------------- */
.trn-chat-bubble {
  position: fixed;
  right: 22px;
  bottom: 22px;
  height: 48px;
  padding: 0 20px 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--tc-main), var(--tc-main2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(240, 80, 48, .34);
  transition: transform .18s ease, box-shadow .18s ease;
  outline: none;
}
.trn-chat-root[data-pos="left"] .trn-chat-bubble { left: 22px; right: auto; }
.trn-chat-bubble:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(240, 80, 48, .4); }
.trn-chat-bubble svg { width: 22px; height: 22px; flex: 0 0 auto; }
.trn-chat-bubble .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #8dffb8; box-shadow: 0 0 0 3px rgba(141, 255, 184, .28);
}
.trn-chat-bubble.is-dot { width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 50%; }
.trn-chat-bubble.is-dot .txt { display: none; }

/* ---------------- 窗口 ---------------- */
.trn-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--tc-bg);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(24, 24, 32, .24), 0 0 0 1px rgba(24, 24, 32, .05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(.98);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.trn-chat-root[data-pos="left"] .trn-chat-panel { left: 22px; right: auto; }
.trn-chat-root[data-size="wide"] .trn-chat-panel { width: 440px; height: 620px; }
.trn-chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }

/* 头部 */
.trn-chat-hd {
  position: relative;
  background: linear-gradient(135deg, var(--tc-main), var(--tc-main2));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.trn-chat-hd .ava {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .35);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; overflow: hidden;
}
.trn-chat-hd .ava img { width: 100%; height: 100%; object-fit: cover; }
.trn-chat-hd .who { line-height: 1.35; min-width: 0; }
.trn-chat-hd .who b { font-size: 14px; display: block; font-weight: 700; }
.trn-chat-hd .who span { font-size: 11px; opacity: .92; display: flex; align-items: center; gap: 5px; }
.trn-chat-hd .who span i {
  width: 6px; height: 6px; border-radius: 50%; background: #8dffb8; display: inline-block;
}
.trn-chat-hd .x {
  margin-left: auto; background: transparent; border: 0; color: #fff;
  font-size: 20px; line-height: 1; opacity: .85; cursor: pointer; padding: 4px 6px;
}
.trn-chat-hd .x:hover { opacity: 1; }

/* 主体 */
.trn-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 4px;
  background: #fbfbfd;
  overscroll-behavior: contain;
}
.trn-chat-body::-webkit-scrollbar { width: 6px; }
.trn-chat-body::-webkit-scrollbar-thumb { background: #d9dce5; border-radius: 3px; }

.trn-chat-time { text-align: center; font-size: 10px; color: #b9bcc7; margin: 2px 0 10px; }

.trn-chat-msg { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-start; }
.trn-chat-msg .ava {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #ffb199, #ff6a4d);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.trn-chat-msg .ava img { width: 100%; height: 100%; object-fit: cover; }
.trn-chat-msg .bub {
  max-width: 254px;
  background: #fff;
  border: 1px solid var(--tc-line);
  border-radius: 3px 12px 12px 12px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.72;
  color: var(--tc-ink2);
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.trn-chat-msg.me { flex-direction: row-reverse; }
.trn-chat-msg.me .bub {
  background: linear-gradient(135deg, var(--tc-main), var(--tc-main2));
  color: #fff; border: 0; border-radius: 12px 3px 12px 12px;
}
.trn-chat-msg.sys { justify-content: center; }
.trn-chat-msg.sys .bub {
  background: transparent; border: 0; box-shadow: none;
  color: #a9adba; font-size: 11px; padding: 2px 0;
}
.trn-chat-msg .meta { font-size: 10px; color: #b9bcc7; margin-top: 4px; }

/* 引导问题 */
.trn-chat-guides { display: flex; flex-direction: column; gap: 7px; margin: -2px 0 12px 36px; }
.trn-chat-guides button {
  text-align: left; background: #fff; border: 1px solid #ffd9cd; color: var(--tc-main);
  border-radius: 10px; padding: 9px 12px; font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: .16s;
  font-family: inherit;
}
.trn-chat-guides button:hover { background: #fff6f3; border-color: #ffbfa9; transform: translateX(2px); }
.trn-chat-guides button b {
  width: 17px; height: 17px; border-radius: 5px; background: #fff0ea;
  display: flex; align-items: center; justify-content: center; font-size: 10px; flex: 0 0 auto;
}

/* 卡片 / 留资卡 */
.trn-chat-card {
  margin: 0 0 12px 36px; background: #fff; border: 1px solid var(--tc-line);
  border-radius: 12px; padding: 11px 12px; box-shadow: 0 2px 8px rgba(24, 24, 32, .05);
}
.trn-chat-card h5 { margin: 0 0 5px; font-size: 12.5px; font-weight: 700; color: var(--tc-ink); }
.trn-chat-card p { margin: 0; font-size: 11.5px; color: var(--tc-sub); line-height: 1.7; }

.trn-chat-lead {
  margin: 0 0 12px 36px; background: #fff8f5; border: 1px solid #ffdccf;
  border-radius: 12px; padding: 12px;
}
.trn-chat-lead h5 { margin: 0 0 9px; font-size: 12.5px; font-weight: 700; color: #b8351a; }
.trn-chat-lead .row { display: flex; gap: 7px; margin-bottom: 7px; }
.trn-chat-lead input, .trn-chat-lead select, .trn-chat-lead textarea {
  flex: 1; min-width: 0; width: 100%; border: 1px solid #f0d9d0; background: #fff;
  border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--tc-ink2);
  outline: none; font-family: inherit;
}
.trn-chat-lead input:focus, .trn-chat-lead select:focus, .trn-chat-lead textarea:focus { border-color: #ffab8f; }
.trn-chat-lead .go {
  width: 100%; border: 0; border-radius: 8px; padding: 10px;
  background: linear-gradient(135deg, var(--tc-main), var(--tc-main2));
  color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.trn-chat-lead .go:disabled { opacity: .6; cursor: not-allowed; }
.trn-chat-lead .tip { font-size: 11px; color: #b8644a; margin-top: 7px; line-height: 1.6; }
.trn-chat-lead .privacy { display: flex; align-items: flex-start; gap: 6px; font-size: 11px; color: var(--tc-sub); margin: 4px 0 8px; }
.trn-chat-lead .privacy input { flex: 0 0 auto; width: auto; margin-top: 2px; }

/* 评价 */
.trn-chat-rate { margin: 0 0 12px 36px; background: #fff; border: 1px solid var(--tc-line); border-radius: 12px; padding: 12px; }
.trn-chat-rate h5 { margin: 0 0 8px; font-size: 12.5px; color: var(--tc-ink); }
.trn-chat-rate .stars { display: flex; gap: 6px; font-size: 22px; color: #e2e5ee; cursor: pointer; }
.trn-chat-rate .stars span.on { color: #ffb020; }
.trn-chat-rate .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.trn-chat-rate .tags i {
  font-style: normal; font-size: 11px; border: 1px solid var(--tc-line);
  border-radius: 6px; padding: 4px 9px; color: var(--tc-ink2); cursor: pointer;
}
.trn-chat-rate .tags i.on { border-color: var(--tc-main); color: var(--tc-main); background: #fff4f0; }
.trn-chat-rate .go { width: 100%; border: 0; border-radius: 8px; padding: 9px; background: linear-gradient(135deg, var(--tc-main), var(--tc-main2)); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* 底部 */
.trn-chat-foot {
  flex: 0 0 auto; border-top: 1px solid var(--tc-line);
  background: #fff; padding: 10px 12px 8px;
}
.trn-chat-inp { display: flex; align-items: center; gap: 8px; background: #f6f7fa; border-radius: 10px; padding: 7px 8px 7px 12px; }
.trn-chat-inp textarea {
  flex: 1; min-width: 0; border: 0; background: transparent; resize: none;
  font-size: 13px; line-height: 1.5; color: var(--tc-ink2); outline: none;
  max-height: 74px; font-family: inherit; padding: 4px 0;
}
.trn-chat-inp textarea::placeholder { color: #b0b3be; }
.trn-chat-send {
  width: 30px; height: 30px; flex: 0 0 auto; border: 0; border-radius: 9px;
  background: linear-gradient(135deg, var(--tc-main), var(--tc-main2));
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.trn-chat-send:disabled { opacity: .45; cursor: not-allowed; }
.trn-chat-tools {
  display: flex; gap: 14px; padding: 8px 4px 2px;
  font-size: 11.5px; color: var(--tc-sub); flex-wrap: wrap;
}
.trn-chat-tools button {
  display: flex; align-items: center; gap: 4px; background: none; border: 0;
  color: inherit; font-size: inherit; cursor: pointer; padding: 0; font-family: inherit;
}
.trn-chat-tools button:hover { color: var(--tc-main); }
.trn-chat-tools .off { opacity: .45; cursor: default; }

/* 提示条 */
.trn-chat-note {
  background: #fff8f5; border-bottom: 1px solid #ffe6dc;
  color: #a8532f; font-size: 11.5px; padding: 8px 14px; line-height: 1.6;
}

/* 移动端 */
@media (max-width: 640px) {
  .trn-chat-bubble { right: 14px; bottom: 16px; height: 44px; font-size: 13px; }
  .trn-chat-root[data-pos="left"] .trn-chat-bubble { left: 14px; }
  .trn-chat-panel,
  .trn-chat-root[data-size="wide"] .trn-chat-panel {
    left: 8px; right: 8px; width: auto; height: auto;
    top: 8px; bottom: 8px; max-height: none; border-radius: 14px;
  }
  .trn-chat-root[data-pos="left"] .trn-chat-panel { left: 8px; }
  .trn-chat-msg .bub { max-width: 72vw; }
}

/* 加载骨架 */
.trn-chat-loading { text-align: center; padding: 26px 0; color: #b9bcc7; font-size: 12px; }
