/* ── WhatsApp 嵌入式聊天组件 CSS v3 ── */

.wa-chat-section {
  scroll-margin-top: 80px;
  padding: 60px 20px;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
}

.wa-section-title {
  text-align: center;
  margin-bottom: 32px;
}

.wa-section-title h2 {
  font-size: 28px;
  font-weight: 700;
  color: #1F2937;
  margin: 0 0 8px;
}

.wa-section-title p {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}

/* ── 聊天气泡容器 ── */
.wa-chat-container {
  width: 100%;
  max-width: 480px;
  min-height: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10);
  border: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.3s;
}
.wa-chat-container:hover {
  box-shadow: 0 12px 48px rgba(0,0,0,0.14);
}

/* ── 头部 ── */
.wa-chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #075E54, #128C7E);
  color: #fff;
  flex-shrink: 0;
}
.wa-chat-header .wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #25D366;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.wa-chat-header .wa-header-text h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #fff;
  letter-spacing: 0.3px;
}
.wa-chat-header .wa-header-text p {
  font-size: 12px;
  opacity: 0.85;
  margin: 3px 0 0;
  color: #fff;
}

/* ── 限额栏 ── */
.wa-limit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 22px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.3s;
  border-bottom: 1px solid #FDE68A;
}
.wa-limit-bar span { display: inline-flex; align-items: center; gap: 4px; }

/* ── 消息区 ── */
.wa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  background: #ECE5DD;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
  max-height: 440px;
}
.wa-messages::-webkit-scrollbar { width: 4px; }
.wa-messages::-webkit-scrollbar-thumb { background: #BDAAA0; border-radius: 2px; }

/* 欢迎页 */
.wa-welcome {
  text-align: center;
  padding: 28px 20px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin: auto;
}
.wa-welcome-icon { font-size: 44px; margin-bottom: 14px; }
.wa-welcome h3 { font-size: 17px; font-weight: 600; color: #1F2937; margin: 0 0 8px; }
.wa-welcome p { font-size: 13px; color: #6B7280; margin: 0 0 16px; line-height: 1.6; }

.wa-lang-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.wa-lang-tags span {
  font-size: 12px;
  padding: 5px 12px;
  background: #F3F4F6;
  border-radius: 14px;
  color: #374151;
  transition: background 0.2s;
}
.wa-lang-tags span:hover { background: #E5E7EB; }

/* ── 消息气泡 ── */
.wa-msg {
  max-width: 82%;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  position: relative;
  word-wrap: break-word;
  animation: waFadeIn 0.25s ease-out;
}
@keyframes waFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.wa-msg.user {
  align-self: flex-end;
  background: #DCF8C6;
  color: #1F2937;
  border-bottom-right-radius: 3px;
}
.wa-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #1F2937;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.wa-msg-time {
  font-size: 10px;
  color: #9CA3AF;
  margin-top: 5px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.wa-msg-tick { color: #4FC3F7; font-size: 10px; }

/* ── 知识来源标记 ── */
.wa-msg .wa-source {
  font-size: 11px;
  color: #6B7280;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── 输入提示 × 输入区 ── */
.wa-input-hint {
  padding: 6px 22px;
  font-size: 11px;
  color: #9CA3AF;
  background: #FAFAFA;
  border-top: 1px solid #F3F4F6;
  text-align: center;
  flex-shrink: 0;
}

.wa-input-area {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  flex-shrink: 0;
}
.wa-input-area input {
  flex: 1;
  border: 1px solid #E5E7EB;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #F9FAFB;
}
.wa-input-area input:focus {
  border-color: #128C7E;
  box-shadow: 0 0 0 3px rgba(18,140,126,0.12);
  background: #fff;
}
.wa-input-area input:disabled {
  background: #F3F4F6;
  color: #9CA3AF;
  cursor: not-allowed;
}

.wa-input-area .wa-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #128C7E;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-input-area .wa-send-btn:hover { background: #075E54; transform: scale(1.05); }
.wa-input-area .wa-send-btn:disabled { background: #D1D5DB; cursor: not-allowed; transform: none; }
.wa-input-area .wa-send-btn svg { width: 20px; height: 20px; fill: #fff; }

/* ── 打字动画 ── */
.wa-typing-el {
  align-self: flex-start;
  background: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.wa-typing-el span {
  font-size: 20px;
  letter-spacing: 3px;
  animation: waTypingPulse 1.2s infinite;
}
@keyframes waTypingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ── 响应式 ── */
@media (max-width: 560px) {
  .wa-chat-section { padding: 40px 12px; }
  .wa-section-title h2 { font-size: 22px; }
  .wa-chat-container { min-height: 480px; border-radius: 14px; }
  .wa-messages { min-height: 260px; max-height: 360px; padding: 14px 16px; }
  .wa-msg { max-width: 90%; font-size: 13px; }
}
