/* ===== Alnook 站内接待助手 · 样式 ===== */
.ank-chat-fab,
.ank-chat-panel,
.ank-chat-panel * {
  box-sizing: border-box;
}

/* ---------- 悬浮按钮 ---------- */
.ank-chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--dark, #0a1128);
  color: var(--gold, #d4a76b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(10, 17, 40, 0.28);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ank-chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(10, 17, 40, 0.36);
}
.ank-chat-fab svg {
  width: 26px;
  height: 26px;
}
.ank-chat-fab .ank-chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2574c;
  border: 2px solid #fff;
  display: none;
}
.ank-chat-fab.ank-has-badge .ank-chat-badge {
  display: block;
}

/* ---------- 面板 ---------- */
.ank-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 1201;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(10, 17, 40, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: #333;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.ank-chat-panel.ank-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ank-chat-head {
  background: var(--dark, #0a1128);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.ank-chat-head .ank-chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold, #d4a76b);
  color: var(--dark, #0a1128);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.ank-chat-head .ank-chat-title {
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
}
.ank-chat-head .ank-chat-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.4;
}
.ank-chat-close {
  margin-inline-start: auto;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
}
.ank-chat-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------- 消息区 ---------- */
.ank-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  background: var(--light, #f8f9fa);
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ank-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
}
.ank-msg.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e8eaee;
  border-start-start-radius: 4px;
}
.ank-msg.user {
  align-self: flex-end;
  background: var(--dark, #0a1128);
  color: #fff;
  border-start-end-radius: 4px;
}
.ank-msg.sys {
  align-self: center;
  background: rgba(212, 167, 107, 0.14);
  color: #7a5a26;
  font-size: 12.5px;
  max-width: 92%;
  text-align: center;
}
.ank-typing {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.ank-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b7bcc6;
  animation: ankBlink 1.2s infinite;
}
.ank-typing i:nth-child(2) {
  animation-delay: 0.18s;
}
.ank-typing i:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes ankBlink {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- 输入区 ---------- */
.ank-chat-foot {
  flex: 0 0 auto;
  border-top: 1px solid #ececf1;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.ank-chat-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid #dfe2e8;
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  max-height: 96px;
  outline: none;
  color: #333;
  background: #fff;
}
.ank-chat-input:focus {
  border-color: var(--gold, #d4a76b);
  box-shadow: 0 0 0 3px rgba(212, 167, 107, 0.16);
}
.ank-chat-send {
  flex: 0 0 auto;
  width: 40px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--gold, #d4a76b);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
}
.ank-chat-send:hover {
  background: var(--gold-hover, #b8935a);
}
.ank-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ank-chat-send svg {
  width: 18px;
  height: 18px;
}
.ank-chat-note {
  font-size: 11px;
  color: #98a0ad;
  text-align: center;
  padding: 0 12px 10px;
  background: #fff;
  line-height: 1.4;
}

/* ---------- 手机端 ---------- */
@media (max-width: 640px) {
  .ank-chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 14px 14px 0 0;
  }
  .ank-chat-fab {
    right: 16px;
    bottom: 16px;
    width: 54px;
    height: 54px;
  }
}

/* ---------- 阿语 RTL ---------- */
.ank-chat-panel[dir='rtl'] .ank-msg.bot {
  border-start-start-radius: 12px;
  border-start-end-radius: 4px;
}
.ank-chat-panel[dir='rtl'] .ank-msg.user {
  border-start-start-radius: 4px;
  border-start-end-radius: 12px;
}
.ank-chat-panel[dir='rtl'] .ank-chat-send svg {
  transform: scaleX(-1);
}

/* ---------- 与 WhatsApp 悬浮按钮错开 ---------- */
/* 页面已有 .float-wa（右下 28px、56×56），同角会完全重叠，故上移一层 */
.ank-chat-fab.ank-shift {
  bottom: 96px;
}
.ank-chat-panel.ank-shift {
  bottom: 168px;
  /* 抬升后必须同步压缩高度，否则顶层溢出视口、并压住站点头部的语言切换按钮 */
  max-height: calc(100vh - 260px);
}
@media (max-width: 640px) {
  .ank-chat-fab.ank-shift {
    bottom: 88px;
  }
  .ank-chat-panel.ank-shift {
    bottom: 0;
    max-height: 88vh;
  }
}

/* ---------- 移动端：右下角三个浮层按钮统一尺寸与圆心线 ---------- */
/* 与 .float-wa、.back-top 一致：48×48、右距 24px，圆心全部落在距屏幕右侧 48px，
   垂直依次 24 / 88 / 152 排布，间距 16px。三者圆心共线，不再错位。 */
@media (max-width: 768px) {
  .ank-chat-fab {
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
  }
  .ank-chat-fab svg {
    width: 22px;
    height: 22px;
  }
  .ank-chat-fab.ank-shift {
    bottom: 88px;
  }
}
