/* 全站右下角 AI 客服：与 keenyoda-www-new 的 ai-chat-widget.css 对齐
   白底圆形 + SVG；right:44px；bottom:30px */
.kyd-ai-chat {
  position: fixed;
  z-index: 9800;
  right: calc(44px + env(safe-area-inset-right, 0px));
  bottom: 30px;
  pointer-events: none;
  font-family: "HarmonyOS Sans SC Regular", "PingFang SC", sans-serif;
}

.kyd-ai-chat-fab,
.kyd-ai-chat-panel,
.kyd-ai-chat-close {
  pointer-events: auto;
}

.kyd-ai-chat-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
  color: #00a1e9;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
}

.kyd-ai-chat-fab:hover,
.kyd-ai-chat-fab:focus,
.kyd-ai-chat-fab:active {
  background: #fff !important;
  background-color: #fff !important;
  background-image: none !important;
  outline: none;
}

.kyd-ai-chat-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.kyd-ai-chat-fab.is-open {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}

.kyd-ai-chat-fab-img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

.kyd-ai-chat-fab-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e53935;
  border: 2px solid #fff;
  display: none;
}

.kyd-ai-chat-fab-badge--active {
  display: block;
}

.kyd-ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  z-index: 9801;
  width: 380px;
  height: min(560px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 35, 61, 0.28);
  border: 1px solid rgba(0, 35, 61, 0.08);
}

.kyd-ai-chat-panel.is-open {
  display: flex;
}

.kyd-ai-chat-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 16px;
  background: #00233d;
  color: #fff;
}

.kyd-ai-chat-bar-text {
  flex: 1;
  min-width: 0;
}

.kyd-ai-chat-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
}

.kyd-ai-chat-sub {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.72);
}

.kyd-ai-chat-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.kyd-ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.kyd-ai-chat-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #f6f8fa;
}

.kyd-ai-chat-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid #e8eaed;
  background: #f8f9fa;
  font-size: 12px;
  color: #5f6368;
}

.kyd-ai-chat-foot a {
  color: #00a1e9;
  text-decoration: none;
  font-weight: 500;
  margin-left: auto;
}

.kyd-ai-chat-foot a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .kyd-ai-chat {
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: 30px;
  }

  .kyd-ai-chat-panel {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    max-height: none;
    bottom: 0;
    right: 0;
    border-radius: 0;
    z-index: 9801;
  }

  body.kyd-ai-chat-open {
    overflow: hidden;
  }
}
