@charset "UTF-8";

/* 动画效果 */
@keyframes floatButton {
   0% { transform: translateX(0); }
   50% { transform: translateX(-500px); }
   100% { transform: translateX(-50); }
}

/* 主容器 */
div.main {
   position: relative;
   overflow: hidden;
}

/* 聊天按钮 */
.chat-button {
  position: absolute;
  top: 20px;
  right: 50px;
  width: 55px; 
  height: 55px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1000;
  animation: floatButton 16s ease-in-out infinite;
  overflow: hidden; /* 确保图片不超出按钮边界 */
  padding: 0;
}

.chat-button:hover {
   background-position: 0 0;
   animation-play-state: paused;
}

/* 聊天窗口容器 */
.chat-container {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   width: 600px;
   max-width: 90%;
   height: 500px;
   background-color: #FFFFFF;
   border: 1px solid #666666;
   border-radius: 8px;
   box-shadow: 0 4px 12px rgba(0,0,0,0.15);
   z-index: 1001;
   display: flex;
   flex-direction: column;
   margin: auto;
   display: none;
}

.chat-container.maximized {
   width: 800px;
   height: 80vh;
}

/* 聊天头部 */
.chat-header {
   padding: 12px 16px;
   background-color: #f1f1f1;
   border-radius: 8px 8px 0 0;
   border-bottom: 1px solid #ddd;
   display: flex;
   justify-content: space-between;
   align-items: center;
   user-select: none;
}

.chat-header h4 {
   margin: 0;
   color: #333;
   font-size: 16px;
}

.chat-header-title {
   display: flex;
   align-items: center;
   gap: 10px;
}

.chat-header-controls {
   display: flex;
   gap: 12px;
}

/* 控制按钮 */
.control-button, .close-button {
   background: none;
   border: none;
   cursor: pointer;
   padding: 4px 8px;
   color: #666;
   font-size: 16px;
}

.control-button:hover, .close-button:hover {
   color: #333;
   background-color: #e0e0e0;
   border-radius: 4px;
}

/* 消息区域 */
.chat-messages {
   flex: 1;
   overflow-y: auto;
   padding: 16px;
   background-color: #ffffff;
}

/* 消息样式 */
.message {
   margin-bottom: 12px;
   padding: 8px 12px;
   border-radius: 4px;
   max-width: 85%;
   word-wrap: break-word;
   line-height: 1.4;
}

.message.user {
   background-color: #007BFF;
   color: white;
   margin-left: auto;
   text-align: right;
}

.message.system {
   background-color: #f8f9fa;
   color: #666;
   text-align: center;
   font-style: italic;
   max-width: 100%;
   margin: 8px auto;
}

.message.consultant {
   background-color: #e9ecef;
   color: #212529;
   margin-right: auto;
}

/* 输入区域 */
.chat-input {
   padding: 12px 16px;
   border-top: 1px solid #ddd;
   display: flex;
   gap: 8px;
   background-color: #f8f9fa;
   border-radius: 0 0 8px 8px;
}

.chat-input input {
   flex: 1;
   padding: 8px 12px;
   border: 1px solid #ddd;
   border-radius: 4px;
   outline: none;
   font-size: 14px;
   transition: border-color 0.2s;
}

.chat-input input:focus {
   border-color: #007BFF;
   box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.chat-input button {
   padding: 8px 16px;
   background-color: #007BFF;
   color: white;
   border: none;
   border-radius: 4px;
   cursor: pointer;
   font-size: 14px;
   transition: background-color 0.2s;
}

.chat-input button:hover {
   background-color: #0056b3;
}

.chat-input button:active {
   background-color: #004085;
}

/* 遮罩层 */
.overlay {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(0, 0, 0, 0.5);
   z-index: 999;
   display: none;
}

@media (max-width: 768px) {
   .chat-container {
       width: 90%;
       height: 80vh;
   }
   
   .chat-button {
       width: 150px;
       font-size: 1em;
   }
   
   .message {
       max-width: 90%;
   }
}