/* widget.css — AI 获客助手聊天浮窗（品牌色 #12BCA9 青绿） */
#yj-lead-widget * { box-sizing: border-box; margin: 0; padding: 0; }

#yj-lead-widget {
  --brand: #12BCA9;
  --brand-dark: #0EA394;
  --brand-light: #E6F7F5;
  --text: #1F2937;
  --text-sub: #6B7280;
  --bg: #FFFFFF;
  --border: #E5E7EB;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* 悬浮按钮 */
#yj-widget-fab {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #12BCA9 0%, #0EA394 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(18, 188, 169, 0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s;
}
#yj-widget-fab:hover { transform: scale(1.06); }
#yj-widget-fab svg { width: 30px; height: 30px; fill: #fff; }
#yj-widget-fab .yj-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #FF4D4F; color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

/* 聊天面板 */
#yj-widget-panel {
  position: fixed; right: 24px; bottom: 96px;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 140px);
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  border: 1px solid var(--border);
  display: none; flex-direction: column;
  overflow: hidden;
}
#yj-widget-panel.yj-open { display: flex; }

/* 头部 */
#yj-widget-head {
  background: linear-gradient(135deg, #12BCA9 0%, #0EA394 100%);
  color: #fff; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
#yj-widget-head .yj-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
#yj-widget-head .yj-title { font-weight: 600; font-size: 15px; }
#yj-widget-head .yj-sub { font-size: 12px; opacity: .85; }
#yj-widget-close {
  margin-left: auto; background: none; border: none; color: #fff;
  font-size: 20px; cursor: pointer; opacity: .8; line-height: 1;
}
#yj-widget-close:hover { opacity: 1; }

/* 消息区 */
#yj-widget-msgs {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  background: #F9FAFB;
  scroll-behavior: smooth;
}
.yj-msg { display: flex; margin-bottom: 12px; }
.yj-msg .yj-bubble {
  max-width: 82%; padding: 9px 13px;
  border-radius: 12px; font-size: 13.5px; word-break: break-word;
  white-space: pre-wrap;
}
.yj-msg.yj-user { justify-content: flex-end; }
.yj-msg.yj-user .yj-bubble {
  background: var(--brand); color: #fff;
  border-bottom-right-radius: 4px;
}
.yj-msg.yj-ai { justify-content: flex-start; }
.yj-msg.yj-ai .yj-bubble {
  background: #fff; border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.yj-msg .yj-typing { color: var(--text-sub); font-size: 12px; }
.yj-cursor {
  display: inline-block; width: 2px; height: 14px;
  background: var(--brand); vertical-align: -2px;
  animation: yj-blink .8s infinite;
}
@keyframes yj-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* 快捷问题 */
#yj-widget-quick {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px;
  background: #F9FAFB;
}
.yj-quick {
  font-size: 12px; padding: 4px 10px;
  border-radius: 12px; border: 1px solid var(--brand);
  color: var(--brand-dark); background: var(--brand-light);
  cursor: pointer;
}
.yj-quick:hover { background: #D3F1EC; }

/* 留资卡片 */
#yj-lead-card {
  margin: 0 12px 10px; padding: 12px;
  border: 1px solid var(--brand); border-radius: 12px;
  background: var(--brand-light);
}
#yj-lead-card .yj-lc-title { font-weight: 600; color: var(--brand-dark); font-size: 14px; margin-bottom: 8px; }
#yj-lead-card input {
  width: 100%; padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
#yj-lead-card input:focus { border-color: var(--brand); }
#yj-lead-card .yj-lc-row { display: flex; gap: 6px; }
#yj-lead-card .yj-lc-row input { flex: 1; }
#yj-lead-submit {
  width: 100%; padding: 9px; margin-top: 2px;
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
#yj-lead-submit:hover { background: var(--brand-dark); }
#yj-lead-ok { color: var(--brand-dark); font-weight: 600; text-align: center; padding: 8px; }

/* 输入区（工具栏 + 输入行 两段式） */
#yj-widget-inputbar {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 12px 10px;
  border-top: 1px solid var(--border); background: #fff;
}
/* 工具栏：语音 / 图片 / 视频 */
#yj-widget-toolbar {
  display: flex; align-items: center; gap: 6px;
}
#yj-widget-toolbar button {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand-light); border: 1px solid transparent;
  font-size: 15px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all .15s;
}
#yj-widget-toolbar button:hover { border-color: var(--brand); transform: translateY(-1px); }
#yj-widget-toolbar button.yj-rec {
  background: #FF4D4F; color: #fff;
  animation: yj-blink 1s infinite;
}
#yj-upload-tip {
  font-size: 11px; color: var(--text-sub);
  margin-left: 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 180px;
}
.yj-input-row { display: flex; gap: 8px; }
#yj-widget-input {
  flex: 1; border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 14px; font-size: 13.5px; outline: none; resize: none;
  max-height: 80px;
}
#yj-widget-input:focus { border-color: var(--brand); }
#yj-widget-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#yj-widget-send:hover { background: var(--brand-dark); }
#yj-widget-send:disabled { opacity: .5; cursor: not-allowed; }
#yj-widget-send svg { width: 18px; height: 18px; fill: #fff; }

/* 富媒体消息：图片 / 视频 */
.yj-media-img {
  max-width: 220px; max-height: 200px; border-radius: 10px;
  display: block; margin-bottom: 6px; cursor: zoom-in;
  border: 1px solid var(--border);
}
.yj-media-video {
  max-width: 240px; max-height: 220px; border-radius: 10px;
  display: block; margin-bottom: 6px; background: #000;
}
.yj-msg.yj-user .yj-media-img,
.yj-msg.yj-user .yj-media-video { border-color: rgba(255,255,255,.3); }

/* AI 富媒体卡片（产品演示视频） */
.yj-bubble.yj-media-card { padding: 8px; width: 250px; }
.yj-bubble.yj-media-card video {
  width: 100%; border-radius: 8px; background: #000; display: block;
}
.yj-media-title {
  font-size: 12.5px; font-weight: 600; color: var(--brand-dark);
  padding: 6px 2px 0; display: flex; align-items: center; gap: 4px;
}

/* 微信引导卡片 */
#yj-wechat-card {
  margin: 0 12px 10px; padding: 14px;
  border: 1px solid #07C160; border-radius: 12px;
  background: #F2FBF6;
}
#yj-wechat-card .yj-lc-title { font-weight: 600; color: #07C160; font-size: 14px; margin-bottom: 8px; }
#yj-wechat-card .yj-wc-qr {
  width: 150px; height: 150px; object-fit: contain;
  display: block; margin: 0 auto 8px; border-radius: 8px;
  background: #fff; padding: 4px;
}
#yj-wechat-card .yj-wc-tip {
  font-size: 12px; color: var(--text-sub); text-align: center;
  margin-bottom: 8px; line-height: 1.5;
}
#yj-wechat-card input {
  width: 100%; padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
#yj-wechat-card input:focus { border-color: #07C160; }
#yj-wc-submit {
  width: 100%; padding: 9px; margin-top: 2px;
  background: #07C160; color: #fff; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
#yj-wc-submit:hover { background: #06AD56; }
#yj-wc-ok { color: #07C160; font-weight: 600; text-align: center; padding: 8px; }

.yj-hidden { display: none !important; }
