/**
 * 客服聊天组件样式文件
 * 包含基础样式和微信风格样式定制
 */

/* 基础页面样式 */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-image: url('1.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  height: 100vh;
}

/* 移动端背景图片优化 */
@media (max-width: 768px) {
  body {
    background-image: url('2.jpg');
    background-size: cover;
    background-position: center top;
    background-attachment: scroll;
    height: 100vh;
    overflow: hidden;
  }
}

/* 演示控制按钮 */
.demo-controls {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10001;
  display: flex;
  gap: 10px;
}

.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 微信风格聊天窗口样式 */
#customer-chat-widget .chat-header {
  background: #07C160 !important;
  padding: 8px 12px !important;
  border-radius: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
  min-height: 32px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
}

#customer-chat-widget .chat-title {
  font-size: 15px !important;
  font-weight: 500 !important;
  color: white !important;
  line-height: 1.2 !important;
}

#customer-chat-widget .chat-messages {
  padding: 10px 12px !important;
  background: #EDEDED !important;
}

#customer-chat-widget .message {
  margin: 8px 0 !important;
  gap: 10px !important;
  align-items: flex-start !important;
}

#customer-chat-widget .message.user {
  flex-direction: row-reverse !important;
}

#customer-chat-widget .message-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background-image: url('3.png') !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  flex-shrink: 0 !important;
  background-color: transparent !important;
  color: transparent !important;
  font-size: 0 !important;
}

#customer-chat-widget .message.user .message-avatar {
  background-image: url('4.png') !important;
  background-color: transparent !important;
}

#customer-chat-widget .message.service .message-avatar {
  background-image: url('3.png') !important;
  background-color: transparent !important;
}

#customer-chat-widget .message-content {
  max-width: 70% !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  word-break: break-word !important;
  position: relative !important;
}

#customer-chat-widget .message.user .message-content {
  background: #95EC69 !important;
  color: #000 !important;
  border-radius: 8px 0 8px 8px !important;
}

#customer-chat-widget .message.service .message-content {
  background: white !important;
  color: #000 !important;
  border-radius: 0 8px 8px 8px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

#customer-chat-widget .welcome-message {
  margin: 10px 0 !important;
}

#customer-chat-widget .welcome-avatar {
  width: 40px !important;
  height: 40px !important;
  background-image: url('3.png') !important;
  background-size: cover !important;
  background-position: center !important;
  border-radius: 50% !important;
  flex-shrink: 0 !important;
  background-repeat: no-repeat !important;
  background-color: transparent !important;
  color: transparent !important;
  font-size: 0 !important;
}

#customer-chat-widget .welcome-text {
  background: white !important;
  color: #000 !important;
  padding: 10px 12px !important;
  font-size: 14px !important;
  border-radius: 0 8px 8px 8px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* 微信风格聊天按钮 */
#customer-chat-widget .chat-toggle {
  background: #07C160 !important;
  padding: 12px 16px !important;
  border-radius: 50% !important;
  box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3) !important;
}

#customer-chat-widget .chat-toggle:hover {
  background: #06A855 !important;
  transform: translateY(-1px) !important;
}

#customer-chat-widget .chat-toggle .chat-icon {
  font-size: 20px !important;
}

#customer-chat-widget .chat-toggle .chat-text {
  display: none !important;
}

/* 输入区域微信风格 */
#customer-chat-widget .chat-input-area {
  background: #F7F7F7 !important;
  border-top: 1px solid #E5E5E5 !important;
  padding: 8px 12px !important;
}

#customer-chat-widget #chat-input {
  background: white !important;
  border: 1px solid #E5E5E5 !important;
  border-radius: 20px !important;
  font-size: 14px !important;
  padding: 8px 12px !important;
}

#customer-chat-widget #chat-send {
  background: #07C160 !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  padding: 8px 16px !important;
}

/* 移动端微信风格优化 */
@media (max-width: 768px) {
  #customer-chat-widget {
    bottom: 15px !important;
    right: 15px !important;
  }
  
  /* 移动端隐藏所有可能的关闭按钮 
  #customer-chat-widget .chat-header button,
  #customer-chat-widget .chat-header .close-btn,
  #customer-chat-widget .chat-header .chat-close,
  #customer-chat-widget .chat-header .custom-close-btn,
  #customer-chat-widget .chat-close-btn {
    display: none !important;
  }*/
  
  /* 确保聊天头部在移动端没有右侧padding为关闭按钮预留空间 */
  #customer-chat-widget .chat-header {
    padding-right: 12px !important;
  }
  
  #customer-chat-widget .chat-window {
    width: calc(100vw - 30px) !important;
    height: 480px !important;
    bottom: 70px !important;
    right: 15px !important;
    left: 15px !important;
    position: fixed !important;
    max-height: 480px !important;
  }
  
  #customer-chat-widget .chat-header {
    background: #07C160 !important;
    padding: 8px 12px !important;
    height: 38px !important;
  }
  
  #customer-chat-widget .chat-title {
    font-size: 15px !important;
  }
  
  #customer-chat-widget .chat-messages {
    padding: 8px 10px !important;
    background: #EDEDED !important;
  }
  
  #customer-chat-widget .message {
    margin: 6px 0 !important;
    gap: 8px !important;
  }
  
  #customer-chat-widget .message-avatar {
    width: 36px !important;
    height: 36px !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
  }

  #customer-chat-widget .message.user .message-avatar {
    background-image: url('4.png') !important;
  }

  #customer-chat-widget .message.service .message-avatar {
    background-image: url('3.png') !important;
  }
  
  #customer-chat-widget .message-content {
    font-size: 13px !important;
    padding: 8px 10px !important;
  }
  
  #customer-chat-widget .message.user .message-content {
    background: #95EC69 !important;
    border-radius: 8px 0 8px 8px !important;
  }
  
  #customer-chat-widget .message.service .message-content {
    background: white !important;
    border-radius: 0 8px 8px 8px !important;
  }
  
  #customer-chat-widget .welcome-avatar {
    width: 36px !important;
    height: 36px !important;
    background-image: url('3.png') !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }
  
  #customer-chat-widget .welcome-text {
    background: white !important;
    font-size: 13px !important;
    padding: 8px 10px !important;
  }
  
  #customer-chat-widget .chat-toggle {
    padding: 10px !important;
    background: #07C160 !important;
  }
  
  /* 优化移动端toggle按钮的触摸体验 */
  #customer-chat-widget .chat-toggle-btn {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #07C160 !important;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  
  #customer-chat-widget .chat-toggle-btn svg {
    width: 28px !important;
    height: 28px !important;
    color: white !important;
  }
  
  #customer-chat-widget .chat-input-area {
    background: #F7F7F7 !important;
    border-top: 1px solid #E5E5E5 !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
  }
  
  /* 确保消息区域为输入区域留出空间 */
  #customer-chat-widget .chat-messages {
    padding-bottom: 60px !important;
  }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
  #customer-chat-widget .chat-window {
    width: calc(100vw - 20px) !important;
    height: 420px !important;
    bottom: 60px !important;
    right: 10px !important;
    left: 10px !important;
    max-height: 420px !important;
  }
  
  #customer-chat-widget .message-avatar {
    width: 32px !important;
    height: 32px !important;
  }
  
  #customer-chat-widget .message-content {
    font-size: 12px !important;
    padding: 6px 8px !important;
  }
}