/* ===================== 全局样式 ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #ededed;
  height: 100vh; overflow: hidden;
}

/* ===================== 容器 ===================== */
.container {
  display: flex; flex-direction: column;
  height: 100vh; max-width: 480px; margin: 0 auto;
  background: #f7f7f7; position: relative;
}

/* ===================== 顶部栏（微信风格绿色） ===================== */
.header {
  display: flex; align-items: center;
  background: #07c160; color: #fff;
  padding: 13px 15px; flex-shrink: 0; z-index: 10;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.header-left, .header-right { width: 50px; flex-shrink: 0; }
.back-btn { font-size: 20px; cursor: pointer; opacity: 0.9; }
.header-title { flex: 1; text-align: center; font-size: 17px; font-weight: 500; letter-spacing: 0.5px; }

/* ===================== 热线 ===================== */
.hotline {
  background: #fff;
  color: #888787;
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
  font-weight: bold;
  border-bottom: 1px solid #e6e6e6;
}

/* ===================== 聊天区域 ===================== */
.chat-area {
  flex: 1; overflow-y: auto;
  padding: 15px 15px 10px;
  background: #ededed;
  -webkit-overflow-scrolling: touch;
}

/* 消息容器 */
.message { display: flex; margin-bottom: 18px; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== 客服消息（左侧） ===================== */
.message.cs { justify-content: flex-start; }
.message.cs .avatar {
  width: 38px; height: 38px; border-radius: 6px;
  background: #07c160; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; margin-right: 10px;
}
.message.cs .bubble {
  background: #fff; color: #333;
  padding: 12px 14px; border-radius: 8px; border-top-left-radius: 2px;
  max-width: 80%; line-height: 1.7; font-size: 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  white-space: pre-wrap; word-break: break-word;
}
.message.cs .time {
  font-size: 11px; color: #b0b0b0; margin-top: 4px;
}

/* ===================== 用户消息（右侧） ===================== */
.message.user { justify-content: flex-end; }
.message.user .bubble {
  background: #95ec69; color: #333;
  padding: 12px 14px; border-radius: 8px; border-top-right-radius: 2px;
  max-width: 80%; line-height: 1.7; font-size: 15px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  word-break: break-word; text-align: left;
}
.message.user .time {
  font-size: 11px; color: #b0b0b0; margin-top: 4px;
}

/* ===================== "正在输入..." 动画 ===================== */
.typing-indicator .bubble.typing-dots {
  padding: 14px 18px; display: flex; align-items: center; gap: 5px;
}
.typing-indicator .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #bbb;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

/* ===================== 加载提示 ===================== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 30px 0; color: #999; font-size: 14px;
}
.loading-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #bbb;
  margin: 0 3px; animation: dotPulse 1.4s infinite ease-in-out;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ===================== 输入区域 ===================== */
.input-area {
  display: flex; align-items: center;
  padding: 8px 12px; background: #f7f7f7;
  border-top: 1px solid #d9d9d9; flex-shrink: 0;
}
.input-wrapper {
  flex: 1; background: #fff; border-radius: 4px;
  border: 1px solid #d9d9d9; padding: 0 12px; margin-right: 8px;
}
.input-wrapper input {
  width: 100%; border: none; outline: none;
  height: 38px; font-size: 15px; color: #333; background: transparent;
}
.input-wrapper input::placeholder { color: #b0b0b0; }
.send-btn {
  width: 58px; height: 38px;
  background: #07c160; color: #fff;
  border: none; border-radius: 4px; font-size: 15px;
  cursor: pointer; transition: opacity 0.2s; flex-shrink: 0;
}
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn:active:not(:disabled) { opacity: 0.8; }

/* ===================== 滚动条 ===================== */
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
