/* SGA速艺客服系统 - 聊天样式 */

/* 聊天容器 */
.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 聊天窗口 */
.chat-window {
  display: none;
  flex-direction: column;
  width: 320px;
  height: 450px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  margin-bottom: 15px;
  border: 1px solid #e0e0e0;
}

/* 聊天头部 */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background-color: #e95f3c;
  color: white;
}

.chat-title {
  display: flex;
  align-items: center;
}

.chat-logo {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border-radius: 50%;
  background-color: white;
  padding: 2px;
}

.chat-actions {
  display: flex;
}

.chat-action-btn {
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-action-btn:hover {
  opacity: 1;
}

/* 聊天主体 */
.chat-body {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background-color: #f5f5f5;
}

.chat-welcome {
  text-align: center;
  padding: 10px;
  margin-bottom: 15px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  font-size: 14px;
  color: #666;
}

/* 聊天消息 */
.chat-message {
  margin-bottom: 15px;
  display: flex;
  clear: both;
}

.chat-message.sent {
  justify-content: flex-end;
}

.chat-message.received {
  justify-content: flex-start;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  position: relative;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.4;
}

.chat-message.sent .message-bubble {
  background-color: #e95f3c;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received .message-bubble {
  background-color: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-time {
  font-size: 11px;
  margin-top: 5px;
  opacity: 0.7;
  text-align: right;
}

.chat-message.sent .message-time {
  color: rgba(255, 255, 255, 0.8);
}

.chat-message.received .message-time {
  color: #999;
}

/* 消息状态 */
.message-bubble.sending {
  opacity: 0.8;
}

.message-bubble.failed {
  background-color: #ffebee;
  color: #d32f2f;
  border: 1px solid #ffcdd2;
}

.chat-message.sent .message-bubble.failed {
  background-color: #ffebee;
  color: #d32f2f;
}

/* 聊天底部 */
.chat-footer {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: white;
  border-top: 1px solid #e0e0e0;
}

.chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 15px;
  resize: none;
  height: 40px;
  max-height: 120px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #e95f3c;
}

.chat-send-btn {
  background-color: #e95f3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  margin-left: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.chat-send-btn:hover {
  background-color: #d04c2f;
}

.chat-send-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* 聊天切换按钮 */
.chat-toggle {
  background-color: #e95f3c;
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s, background-color 0.2s;
  position: relative;
}

.chat-toggle:hover {
  background-color: #d04c2f;
  transform: scale(1.05);
}

.chat-toggle i {
  font-size: 24px;
  margin-bottom: 2px;
}

.chat-toggle-text {
  font-size: 10px;
  display: none;
}

/* 未读消息标记 */
.chat-toggle.has-unread::after {
  content: attr(data-count);
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #ff4136;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
}

/* 加载指示器 */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #999;
  font-size: 14px;
}

.loading-indicator i {
  font-size: 24px;
  margin-bottom: 10px;
  color: #e95f3c;
}

/* 空状态 */
.cs-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 14px;
  text-align: center;
}

.cs-empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  color: #ddd;
}

/* 错误状态 */
.cs-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #d32f2f;
  font-size: 14px;
  text-align: center;
}

.cs-error-state i {
  font-size: 24px;
  margin-bottom: 10px;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin-bottom: 0;
  }
  
  .chat-toggle {
    width: 50px;
    height: 50px;
  }
  
  .chat-toggle i {
    font-size: 20px;
  }
  
  .chat-container {
    bottom: 10px;
    right: 10px;
  }
}
