* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #f0f2f5;
  --bot-bg: #fff;
  --user-bg: #1a73e8;
  --text: #1a1a1a;
  --text-light: #666;
  --border: #e0e0e0;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.chat-container {
  width: 100%;
  max-width: 480px;
  height: 95vh;
  max-height: 800px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, #1a73e8, #4285f4);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.bot-avatar {
  width: 46px;
  height: 46px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.header-info { flex: 1; }
.header-info h1 { font-size: 1.15rem; font-weight: 700; }
.header-info p { font-size: 0.78rem; opacity: 0.9; }

.status-dot {
  width: 10px;
  height: 10px;
  background: #4caf50;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.message {
  max-width: 80%;
  display: flex;
  flex-direction: column;
}

.message.bot-message {
  align-self: flex-start;
}

.message.user-message {
  align-self: flex-end;
  align-items: flex-end;
}

.message-content {
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

.bot-message .message-content {
  background: var(--bot-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-message .message-content {
  background: var(--user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-tag {
  font-size: 0.68rem;
  color: var(--text-light);
  margin-top: 3px;
  padding: 0 6px;
}

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  background: #fff;
  padding: 12px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Quick replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
  margin-top: 4px;
}

.quick-btn {
  padding: 7px 16px;
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.quick-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

#messageInput {
  flex: 1;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

#messageInput:focus {
  border-color: var(--primary);
}

.send-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Message animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message {
  animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 520px) {
  .chat-container {
    border-radius: 0;
    height: 100vh;
  }
}
