/* ============================================================
   AI 客服挂件
   侧边浮标 + 聊天面板。不依赖任何框架。
   ============================================================ */

.egc-launch {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--ink, #0B0C0D);
  color: var(--bone, #EDEAE3);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55), 0 0 0 1px rgba(237, 234, 227, .14) inset;
  transition: transform .22s var(--ease, cubic-bezier(.2, .8, .2, 1)), box-shadow .22s;
}
.egc-launch:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .6); }
.egc-launch:focus-visible { outline: 2px solid var(--signal, #E4512B); outline-offset: 3px; }
.egc-launch svg { width: 26px; height: 26px; }

/* 有人在线时的小红点 */
.egc-launch::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--signal, #E4512B);
  box-shadow: 0 0 0 2.5px var(--ink, #0B0C0D);
}

.egc-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 91;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 556px;
  max-height: calc(100vh - 140px);
  background: #FBFAF7;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .5), 0 0 0 1px rgba(11, 12, 13, .09);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  pointer-events: none;
  transition: opacity .2s ease, transform .22s var(--ease, cubic-bezier(.2, .8, .2, 1));
}
.egc-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

.egc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px;
  background: var(--ink, #0B0C0D);
  color: var(--bone, #EDEAE3);
  flex: none;
}
.egc-head__mark { width: 26px; height: 26px; flex: none; }
.egc-head__t { font-size: 15px; font-weight: 600; letter-spacing: .02em; line-height: 1.2; }
.egc-head__s { font-size: 11.5px; color: rgba(237, 234, 227, .55); margin-top: 3px; }
.egc-close {
  margin-left: auto;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: rgba(237, 234, 227, .1);
  color: var(--bone, #EDEAE3);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px; line-height: 1;
}
.egc-close:hover { background: rgba(237, 234, 227, .2); }

.egc-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}
.egc-body::-webkit-scrollbar { width: 6px; }
.egc-body::-webkit-scrollbar-thumb { background: rgba(11, 12, 13, .16); border-radius: 3px; }

.egc-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  animation: egcIn .18s ease both;
}
@keyframes egcIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.egc-msg--bot {
  align-self: flex-start;
  background: #EFEAE0;
  color: #202325;
  border-bottom-left-radius: 4px;
}
.egc-msg--me {
  align-self: flex-end;
  background: var(--ink, #0B0C0D);
  color: var(--bone, #EDEAE3);
  border-bottom-right-radius: 4px;
}
.egc-msg--note {
  align-self: stretch;
  max-width: 100%;
  background: transparent;
  color: #6E6A63;
  font-size: 12.5px;
  text-align: center;
  padding: 2px 0;
}

.egc-typing { display: inline-flex; gap: 4px; align-items: center; height: 8px; }
.egc-typing i {
  width: 5px; height: 5px; border-radius: 50%;
  background: #9A948B;
  animation: egcDot 1s infinite ease-in-out;
}
.egc-typing i:nth-child(2) { animation-delay: .15s; }
.egc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes egcDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.egc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 14px 12px;
  flex: none;
}
.egc-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(11, 12, 13, .16);
  background: #fff;
  color: #33373A;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.egc-chip:hover { border-color: var(--signal, #E4512B); color: var(--signal, #E4512B); }

.egc-foot {
  flex: none;
  border-top: 1px solid rgba(11, 12, 13, .09);
  padding: 10px 12px 12px;
  background: #FBFAF7;
}
.egc-form { display: flex; gap: 8px; align-items: flex-end; }
.egc-input {
  flex: 1;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(11, 12, 13, .16);
  background: #fff;
  color: #202325;
  resize: none;
  max-height: 88px;
  min-height: 40px;
}
.egc-input:focus { outline: none; border-color: var(--signal, #E4512B); box-shadow: 0 0 0 3px rgba(228, 81, 43, .12); }
.egc-send {
  flex: none;
  width: 40px; height: 40px;
  border: 0; border-radius: 10px;
  background: var(--signal, #E4512B);
  color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 17px;
}
.egc-send:disabled { opacity: .45; cursor: default; }
.egc-tip { margin-top: 8px; font-size: 11.5px; color: #8B857C; line-height: 1.5; }
.egc-tip a { color: #6E6A63; text-decoration: underline; }

@media (max-width: 560px) {
  .egc-launch { right: 16px; bottom: 16px; width: 54px; height: 54px; }
  .egc-panel {
    right: 0; bottom: 0; left: 0;
    width: auto; max-width: none;
    height: 76vh; max-height: 76vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .egc-panel, .egc-launch, .egc-msg { transition: none; animation: none; }
}
