/**
 * DiDi Taxi NL - 聊天按钮样式
 * 悬浮聊天按钮和聊天窗口样式
 */

/* 聊天容器 */
#chatContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* 聊天图标 */
#chatIcon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

#chatIcon:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.5);
}

#chatIcon:active {
  transform: scale(1.05);
}

/* 聊天标签 */
#chatLabel {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
  60% {
    transform: translateY(-2px);
  }
}

/* 聊天窗口 */
#chatBox {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 360px;
  max-height: 500px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

#chatBox.open {
  display: flex;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 聊天头部 */
#chatHeader {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 20px 20px 0 0;
}

/* 聊天内容区 */
#chatContent {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  min-height: 200px;
  max-height: 300px;
}

/* 聊天消息样式 */
.chat-message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  max-width: 80%;
}

.chat-message.bot {
  background: white;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border-bottom-right-radius: 4px;
  margin-left: auto;
  box-shadow: 0 1px 2px rgba(37, 211, 102, 0.2);
}

/* 聊天输入区 */
#chatInput {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

#chatInput textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  resize: none;
  height: 44px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

#chatInput textarea:focus {
  outline: none;
  border-color: #25D366;
}

#chatInput button {
  padding: 10px 20px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

#chatInput button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* 关闭按钮 */
#chatClose {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.2s ease;
}

#chatClose:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 移动端优化 */
@media (max-width: 768px) {
  #chatContainer {
    bottom: 16px;
    right: 16px;
  }

  #chatIcon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  #chatBox {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
  }

  #chatHeader {
    border-radius: 20px 20px 0 0;
  }

  #chatContent {
    max-height: calc(80vh - 120px);
  }
}

/* 打字动画 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}
