/* ============================================================
   Endless Jewelry — 前台在线客服对话框
   右下角悬浮窗，全站通用
   ============================================================ */

/* ---------- 悬浮按钮 ---------- */
.ejc-btn {
  position: fixed; right: 24px; bottom: 24px; z-index: 9000;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #3f7d63 0%, #2f6350 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(63,125,99,.42), 0 3px 8px rgba(0,0,0,.14);
  cursor: pointer; border: none; transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
}
.ejc-btn:hover { transform: scale(1.08); box-shadow: 0 14px 38px rgba(63,125,99,.55); }
.ejc-btn svg { width: 27px; height: 27px; }
.ejc-btn .ejc-ico-close { display: none; width: 24px; height: 24px; }
.ejc-btn.open .ejc-ico-chat { display: none; }
.ejc-btn.open .ejc-ico-close { display: block; }

/* 未读/在线提示小圆点 */
.ejc-btn .ejc-ping {
  position: absolute; top: 2px; right: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #e74c3c; border: 2px solid #fff;
  animation: ejc-pulse 2s infinite;
}
@keyframes ejc-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: .75; }
}

/* 首次进入的引导气泡 */
.ejc-teaser {
  position: fixed; right: 96px; bottom: 34px; z-index: 8999;
  background: #fff; color: var(--ink, #202020); padding: 11px 16px;
  border-radius: 12px 12px 2px 12px; font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 8px 26px rgba(0,0,0,.14); border: 1px solid #ececec;
  max-width: 230px; opacity: 0; transform: translateX(10px);
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.ejc-teaser.on { opacity: 1; transform: translateX(0); }
.ejc-teaser strong { color: #3f7d63; }

/* ---------- 面板 ---------- */
.ejc-panel {
  position: fixed; right: 24px; bottom: 96px; z-index: 9001;
  width: 372px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.24), 0 4px 14px rgba(0,0,0,.09);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(16px) scale(.97); pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.34,1.3,.64,1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ejc-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---------- 头部 ---------- */
.ejc-head {
  background: linear-gradient(135deg, #202020 0%, #2e2a24 100%);
  color: #fff; padding: 16px 18px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.ejc-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #3f7d63, #78bca1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; letter-spacing: .02em;
}
.ejc-head-info { flex: 1; min-width: 0; }
.ejc-head-info h4 { font-size: 14.5px; font-weight: 600; margin: 0 0 2px; letter-spacing: .01em; }
.ejc-head-info span { font-size: 11.5px; color: rgba(255,255,255,.62); display: flex; align-items: center; gap: 5px; }
.ejc-head-info span i {
  width: 6px; height: 6px; border-radius: 50%; background: #4ade80; display: inline-block;
  box-shadow: 0 0 0 2px rgba(74,222,128,.25);
}
.ejc-head-info span.busy i { background: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.25); }
.ejc-min {
  background: none; border: none; color: rgba(255,255,255,.66); cursor: pointer;
  padding: 5px; border-radius: 6px; line-height: 0; transition: all .2s;
}
.ejc-min:hover { color: #fff; background: rgba(255,255,255,.12); }

/* ---------- 消息区 ---------- */
.ejc-body {
  flex: 1; overflow-y: auto; padding: 18px 16px; background: #f7f7f7;
  display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth;
}
.ejc-body::-webkit-scrollbar { width: 6px; }
.ejc-body::-webkit-scrollbar-thumb { background: #d8d5d0; border-radius: 3px; }

.ejc-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.ejc-row.me { flex-direction: row-reverse; }
.ejc-bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.62; word-break: break-word; white-space: pre-wrap;
}
.ejc-row.bot .ejc-bubble {
  background: #fff; color: #202020; border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.ejc-row.me .ejc-bubble {
  background: linear-gradient(135deg, #3f7d63, #2f6350); color: #fff;
  border-bottom-right-radius: 4px;
}
.ejc-row.human .ejc-bubble {
  background: #eef4ee; color: #202020; border-bottom-left-radius: 4px;
  border-left: 3px solid #2e8b57;
}
.ejc-row .ejc-mini-av {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.ejc-row.bot .ejc-mini-av, .ejc-row.human .ejc-mini-av { background: linear-gradient(135deg,#3f7d63,#78bca1); }

.ejc-time { font-size: 10.5px; color: #a8a5a0; text-align: center; margin: 2px 0; }

/* 正在输入动画 */
.ejc-typing { display: flex; gap: 4px; padding: 4px 2px; }
.ejc-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: #b8b5b0;
  animation: ejc-bounce 1.3s infinite ease-in-out;
}
.ejc-typing i:nth-child(2) { animation-delay: .18s; }
.ejc-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes ejc-bounce {
  0%,60%,100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* 快捷问题 */
.ejc-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; background: #f7f7f7; }
.ejc-quick button {
  border: 1px solid #e0ddd8; background: #fff; color: #555555;
  font-size: 12px; padding: 6px 12px; border-radius: 16px; cursor: pointer;
  transition: all .18s; font-family: inherit;
}
.ejc-quick button:hover { border-color: #3f7d63; color: #3f7d63; background: #f4f9f6; }

/* ---------- 输入区 ---------- */
.ejc-foot { border-top: 1px solid #ececec; padding: 12px 14px; background: #fff; flex-shrink: 0; }
.ejc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.ejc-input-row textarea {
  flex: 1; resize: none; border: 1px solid #e0ddd8; border-radius: 10px;
  padding: 10px 13px; font-size: 13.5px; font-family: inherit; line-height: 1.5;
  max-height: 110px; min-height: 42px; color: #202020; background: #fbfbfc;
  transition: border-color .2s, background .2s;
}
.ejc-input-row textarea:focus { outline: none; border-color: #3f7d63; background: #fff; }
.ejc-send {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 10px; border: none;
  background: linear-gradient(135deg,#3f7d63,#2f6350); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s, transform .15s;
}
.ejc-send:hover:not(:disabled) { transform: translateY(-1px); }
.ejc-send:disabled { opacity: .4; cursor: not-allowed; }
.ejc-send svg { width: 18px; height: 18px; }
.ejc-foot-note { font-size: 10.5px; color: #a8a5a0; text-align: center; margin-top: 7px; }

/* 联系方式留存卡片 */
.ejc-lead { background: #f4f9f6; border: 1px solid #d5e5dc; border-radius: 10px; padding: 12px; margin: 4px 0; }
.ejc-lead p { font-size: 12.5px; color: #555555; margin-bottom: 9px; line-height: 1.5; }
.ejc-lead input {
  width: 100%; padding: 8px 11px; border: 1px solid #e0ddd8; border-radius: 7px;
  font-size: 12.5px; margin-bottom: 7px; font-family: inherit; background: #fff;
}
.ejc-lead input:focus { outline: none; border-color: #3f7d63; }
.ejc-lead button {
  width: 100%; padding: 9px; border: none; border-radius: 7px; cursor: pointer;
  background: #202020; color: #fff; font-size: 12.5px; font-weight: 600; font-family: inherit;
  transition: background .2s;
}
.ejc-lead button:hover { background: #3f7d63; }

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .ejc-btn { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .ejc-panel {
    right: 0; left: 0; bottom: 0; width: 100%; max-width: 100%;
    height: 100%; max-height: 100%; border-radius: 0;
  }
  .ejc-teaser { right: 80px; bottom: 26px; }
}
