/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f5f7fa;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

/* 聊天应用容器 */
.chat-app {
  width: 100%;
  max-width: 800px;
  height: 80vh;
  max-height: 600px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 头部 */
.app-header {
  padding: 16px 20px;
  background-color: #2c3e50;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo i {
  font-size: 22px;
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #ddd;
}

.online-dot {
  width: 8px;
  height: 8px;
  background-color: #2ecc71;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 聊天消息区域 */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #f9f9f9;
  background-image: 
    linear-gradient(rgba(240, 240, 240, 0.8) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 240, 240, 0.8) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 系统消息 */
.system-message {
  text-align: center;
  color: #7f8c8d;
  font-size: 0.85rem;
  margin: 10px 0;
  padding: 4px 12px;
  background-color: rgba(240, 240, 240, 0.7);
  border-radius: 12px;
  display: inline-block;
  align-self: center;
}

/* 聊天消息 */
.message {
  margin: 12px 0;
  max-width: 70%;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: #2c3e50;
}

.message-content {
  padding: 10px 14px;
  border-radius: 18px;
  line-height: 1.4;
}

/* 输入区域 */
.input-area {
  display: flex;
  padding: 12px 20px;
  background-color: white;
  border-top: 1px solid #eee;
  gap: 10px;
}

.user-info {
  width: 25%;
}

.message-input {
  width: 75%;
  display: flex;
  gap: 10px;
}

input {
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: #3498db;
}

#username {
  width: 100%;
  background-color: #f9f9f9;
}

#message {
  flex: 1;
}

.send-btn {
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.send-btn:hover {
  background-color: #2980b9;
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn i {
  font-size: 18px;
}

/* 响应式设计 */
@media (max-width: 600px) {
  .chat-app {
    height: 90vh;
  }

  .input-area {
    flex-direction: column;
  }

  .user-info, .message-input {
    width: 100%;
  }

  .message {
    max-width: 85%;
  }
}
