/* ===== 创图设计 AI 客服组件 (Chloe) ===== */
.ctsj-chat-btn {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ctsj-chat-btn:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(0,0,0,0.32); }
.ctsj-chat-btn .ctsj-dot {
  position: absolute; top: 6px; right: 6px; width: 11px; height: 11px;
  background: #07c160; border: 2px solid #fff; border-radius: 50%;
}

.ctsj-chat-panel {
  position: fixed;
  left: 24px;
  bottom: 92px;
  width: 366px;
  max-width: calc(100vw - 32px);
  height: 524px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .22s ease;
}
.ctsj-chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.ctsj-chat-panel.dragging { transition: none !important; pointer-events: auto; }

.ctsj-chat-header {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}
.ctsj-chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.ctsj-chat-title { flex: 1; line-height: 1.25; }
.ctsj-chat-title b { font-size: 14px; }
.ctsj-chat-title small { display: block; font-size: 11px; opacity: .75; }
.ctsj-chat-lang {
  background: rgba(255,255,255,.15); color: #fff; border: none;
  border-radius: 6px; padding: 4px 8px; font-size: 11px; cursor: pointer;
}
.ctsj-chat-lang:hover { background: rgba(255,255,255,.28); }
.ctsj-chat-close {
  background: transparent; border: none; color: #fff; font-size: 20px;
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.ctsj-chat-sound {
  background: rgba(255,255,255,.15); color: #fff; border: none;
  border-radius: 6px; padding: 4px 8px; font-size: 13px; cursor: pointer;
  line-height: 1;
}
.ctsj-chat-sound:hover { background: rgba(255,255,255,.28); }

.ctsj-chat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f5f6f8;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ctsj-msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.ctsj-msg.ai { background: #fff; color: #1a1a1a; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ctsj-msg.user { background: #1a1a1a; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ctsj-msg .ctsj-time { display: block; font-size: 10px; opacity: .5; margin-top: 4px; }

.ctsj-typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 14px; background: #fff; border-radius: 14px; border-bottom-left-radius: 4px; }
.ctsj-typing span { width: 7px; height: 7px; background: #bbb; border-radius: 50%; animation: ctsj-bounce 1.2s infinite; }
.ctsj-typing span:nth-child(2) { animation-delay: .2s; }
.ctsj-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ctsj-bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

.ctsj-chat-input {
  display: flex;
  border-top: 1px solid #ececec;
  background: #fff;
  padding: 8px;
  gap: 8px;
}
.ctsj-chat-input textarea {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 80px;
  line-height: 1.4;
}
.ctsj-chat-input textarea:focus { border-color: #1a1a1a; }
.ctsj-chat-send {
  background: #1a1a1a; color: #fff; border: none; border-radius: 10px;
  padding: 0 16px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.ctsj-chat-send:disabled { opacity: .5; cursor: not-allowed; }

.ctsj-chat-foot { font-size: 10px; color: #aaa; text-align: center; padding: 5px 0 7px; background: #fff; }

/* 隐藏左侧独立按钮（已合并到右下角浮窗） */
.ctsj-chat-btn { display: none !important; }

/* 拉伸手柄 */
.ctsj-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.18) 50%);
  border-radius: 0 0 16px 0;
}

/* ===== 转接表单 ===== */
.ctsj-handoff { background: #fff; border-radius: 14px; padding: 12px; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ctsj-handoff-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #1a1a1a; }
.ctsj-handoff-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ctsj-handoff-row input, .ctsj-handoff-row textarea {
  width: 100%; border: 1px solid #e0e0e0; border-radius: 10px; padding: 9px 11px; font-size: 13.5px; outline: none; font-family: inherit; resize: none;
}
.ctsj-handoff-row input:focus, .ctsj-handoff-row textarea:focus { border-color: #1a1a1a; }
.ctsj-handoff-row textarea { min-height: 56px; }
.ctsj-handoff-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ctsj-handoff-cancel {
  background: #f2f2f2; color: #333; border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.ctsj-handoff-submit {
  background: #1a1a1a; color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px; cursor: pointer;
}
.ctsj-handoff-submit:disabled { opacity: .5; cursor: not-allowed; }
.ctsj-handoff-success { font-size: 13px; color: #07c160; text-align: center; padding: 10px 0; }

@media (max-width: 480px) {
  .ctsj-chat-panel { left: 16px; right: 16px; bottom: 84px; width: auto; }
  .ctsj-chat-btn { left: 16px; bottom: 16px; }
}
