@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  /* 主色调 - 更柔和的艺术风格 */
  --primary-color: #6a5acd;
  --primary-light: #8a7dda;
  --primary-dark: #4b3dad;
  --secondary-color: #ff6b6b;
  --accent-color: #4ecdc4;
  --background: #f8f9fa;
  --surface: #ffffff;
  --surface-variant: #f0f2f5;
  --text-primary: #212121;
  --text-secondary: #757575;
  --divider: #e0e0e0;
  --success: #4caf50;
  --warning: #ff9800;
  --error: #f44336;
  
  /* 阴影 */
  --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
  --shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
  
  /* 圆角 */
  --radius-small: 4px;
  --radius-medium: 8px;
  --radius-large: 16px;
}

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

body {
  font-family: 'Montserrat', 'Noto Sans SC', sans-serif;
  background: linear-gradient(135deg, #e0c3fc, #8ec5fc, #e0c3fc);
  color: var(--text-primary);
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-attachment: fixed;
}

.container {
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-3);
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

h1 {
  font-family: 'Montserrat', sans-serif;
  text-align: center;
  color: var(--primary-dark);
  font-size: 2.2rem;
  margin-top: 0;
  margin-bottom: 25px;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: relative;
}

h1::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: var(--primary-color);
  margin: 10px auto;
  border-radius: 3px;
}

/* AI助手介绍区域 */
.assistant-intro {
  background: var(--surface-variant);
  border-radius: var(--radius-medium);
  padding: 20px;
  margin-bottom: 25px;
  position: relative;
  box-shadow: var(--shadow-1);
  border-left: 4px solid var(--primary-color);
}

.assistant-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.assistant-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: white;
  font-weight: bold;
}

.assistant-title {
  font-weight: 600;
  color: var(--primary-dark);
  font-size: 1.1rem;
}

.assistant-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.copy-button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-1);
}

.copy-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.copy-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}

.copy-button.copied {
  background: var(--success);
}

.copy-button.copied::after {
  content: "✓ 已复制";
  margin-left: 5px;
}

/* 聊天历史区域 */
#chat-history {
  height: 450px;
  overflow-y: auto;
  padding: 20px;
  margin-bottom: 25px;
  border-radius: var(--radius-medium);
  background: var(--surface-variant);
  box-shadow: var(--shadow-1);
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) var(--surface-variant);
}

#chat-history::-webkit-scrollbar {
  width: 6px;
}

#chat-history::-webkit-scrollbar-track {
  background: var(--surface-variant);
  border-radius: 3px;
}

#chat-history::-webkit-scrollbar-thumb {
  background: var(--primary-light);
  border-radius: 3px;
}

#chat-history::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* 消息气泡 */
.message {
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease-out;
  position: relative;
  max-width: 85%;
}

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

/* 用户消息 */
.user-message {
  margin-left: auto;
  background: var(--primary-color);
  color: white;
  border-bottom-right-radius: var(--radius-medium);
}

.user-message .message-content {
  border-radius: var(--radius-medium);
}

.user-message .message-content strong {
  color: white;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.user-message .message-copy-btn {
  right: 15px;
  top: 15px;
}

/* AI助手消息 */
.ai-message {
  background: var(--surface);
  border: 1px solid var(--divider);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-medium);
}

.ai-message .message-content {
  border-radius: var(--radius-medium);
}

.ai-message .message-content strong {
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.ai-message .message-copy-btn {
  right: 15px;
  top: 15px;
}

/* 系统消息 */
.system-message {
  background: #fff8e1;
  border: 1px solid #ffecb3;
  color: #5d4037;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.system-message .message-content {
  border-radius: var(--radius-medium);
}

.system-message .message-content strong {
  color: #ff8f00;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.system-message .message-copy-btn {
  right: 15px;
  top: 15px;
}

.message-content {
  padding: 15px;
  border-radius: var(--radius-medium);
  position: relative;
  line-height: 1.5;
}

.message-content p {
  margin: 0 0 10px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* 复制按钮在消息中 */
.message-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  color: var(--text-primary);
  backdrop-filter: blur(5px);
  z-index: 1;
}

.message:hover .message-copy-btn {
  opacity: 1;
}

.message-copy-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.message-copy-btn.copied {
  background: var(--success);
  color: white;
  opacity: 1;
  transform: translateY(-1px);
}

.message-copy-btn.copied::after {
  content: "✓";
  margin-left: 5px;
  font-size: 0.8em;
}

/* 输入区域 */
#input-area {
  display: flex;
  gap: 12px;
  position: relative;
}

#user-input {
  flex-grow: 1;
  padding: 15px 20px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-medium);
  font-family: 'Montserrat', 'Noto Sans SC', sans-serif;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
  transition: all 0.3s ease;
}

#user-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(106, 90, 205, 0.2);
}

#user-input::placeholder {
  color: var(--text-secondary);
}

#send-button {
  padding: 15px 25px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-medium);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: var(--shadow-1);
  transition: all 0.3s ease;
  min-width: 90px;
}

#send-button:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

#send-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}

#send-button:disabled {
  background: var(--text-secondary);
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-1);
}

/* 加载动画 */
.loading {
  display: inline-block;
  position: relative;
  width: 60px;
  height: 15px;
}

.loading div {
  position: absolute;
  top: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary-color);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading div:nth-child(1) {
  left: 4px;
  animation: loading1 0.6s infinite;
}

.loading div:nth-child(2) {
  left: 4px;
  animation: loading2 0.6s infinite;
}

.loading div:nth-child(3) {
  left: 24px;
  animation: loading2 0.6s infinite;
}

.loading div:nth-child(4) {
  left: 44px;
  animation: loading3 0.6s infinite;
}

@keyframes loading1 {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

@keyframes loading2 {
  0% { transform: translate(0, 0); }
  100% { transform: translate(20px, 0); }
}

@keyframes loading3 {
  0% { transform: scale(1); }
  100% { transform: scale(0); }
}

/* 响应式设计 */
@media (max-width: 768px) {
  body {
    padding: 10px;
    padding-top: 20px;
  }
  
  .container {
    padding: 20px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  #chat-history {
    height: 350px;
    padding: 15px;
  }
  
  .message {
    max-width: 90%;
    margin-bottom: 18px;
  }
  
  .user-message {
    margin-left: 10%;
  }
  
  .ai-message {
    margin-right: 10%;
  }
  
  #input-area {
    flex-direction: column;
  }
  
  #send-button {
    padding: 12px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  #chat-history {
    height: 300px;
    padding: 10px;
  }
  
  .message-content {
    padding: 12px;
  }
  
  #user-input {
    padding: 12px 15px;
    font-size: 0.95rem;
  }
  
  .assistant-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .assistant-icon {
    margin-right: 0;
    margin-bottom: 8px;
  }
}