/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 自然养生主题色 */
  --primary: #2d5a45;
  --primary-light: #4a8c6f;
  --primary-dark: #1e3d2f;
  --accent: #e8b44c;
  --accent-light: #f5d89a;
  
  /* 背景 */
  --bg-main: #f7f5f0;
  --bg-card: #ffffff;
  --bg-chat: #faf9f6;
  
  /* 文字 */
  --text-primary: #2c3e2d;
  --text-secondary: #5a6b5c;
  --text-muted: #8a9a8c;
  
  /* 气泡 */
  --bubble-user: linear-gradient(135deg, #2d5a45 0%, #4a8c6f 100%);
  --bubble-assistant: #ffffff;
  
  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(45, 90, 69, 0.08);
  --shadow-md: 0 4px 20px rgba(45, 90, 69, 0.12);
  --shadow-lg: 0 8px 40px rgba(45, 90, 69, 0.16);
}

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* 应用容器 */
.app-container {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* 背景装饰 */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.circle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
}

.circle-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--primary-light), transparent 70%);
  top: -100px;
  right: -100px;
  animation: float 20s ease-in-out infinite;
}

.circle-2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  bottom: 100px;
  left: -50px;
  animation: float 15s ease-in-out infinite reverse;
}

.circle-3 {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--primary), transparent 70%);
  bottom: -50px;
  right: 50px;
  animation: float 18s ease-in-out infinite;
}

.leaf {
  position: absolute;
  font-size: 2rem;
  opacity: 0.3;
  animation: sway 10s ease-in-out infinite;
}

.leaf-1 { top: 15%; left: 10%; animation-delay: 0s; }
.leaf-2 { top: 40%; right: 5%; animation-delay: 3s; }
.leaf-3 { bottom: 20%; left: 5%; animation-delay: 6s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-5deg) translateX(0); }
  50% { transform: rotate(5deg) translateX(10px); }
}

/* 头部 */
.header {
  text-align: center;
  padding: 24px 20px 16px;
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-icon {
  font-size: 2rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.logo h1 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 2px;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* 聊天容器 */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

/* 消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  scroll-behavior: smooth;
}

/* 消息样式 */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease-out;
}

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

.message.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.message.user .avatar {
  background: var(--accent-light);
}

.content {
  max-width: 75%;
}

.bubble {
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  position: relative;
}

.message.assistant .bubble {
  background: var(--bubble-assistant);
  box-shadow: var(--shadow-md);
  border-bottom-left-radius: 6px;
  color: var(--text-primary);
}

.message.user .bubble {
  background: var(--bubble-user);
  color: white;
  border-bottom-right-radius: 6px;
}

.time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding: 0 4px;
}

.message.user .time {
  text-align: right;
}

/* 加载动画 */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: typing 1.4s ease-in-out infinite;
}

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

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

/* 快捷问题 */
.quick-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  justify-content: center;
}

.quick-btn {
  background: var(--bg-card);
  border: 1px solid rgba(45, 90, 69, 0.15);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.quick-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-btn:active {
  transform: translateY(0);
}

/* 动态选项按钮 - AI 回复后的快捷选择 */
.dynamic-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 8px;
  margin-left: 52px;
}

.dynamic-btn {
  background: linear-gradient(135deg, #f8f9f8 0%, #fff 100%);
  border: 1.5px solid var(--primary-light);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 0.9rem;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  text-align: left;
  position: relative;
  overflow: hidden;
  animation: slideInFromRight 0.4s ease-out both;
  box-shadow: var(--shadow-sm);
}

.dynamic-btn::before {
  content: '→';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
  transition: all 0.3s ease;
}

.dynamic-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateX(8px);
  box-shadow: var(--shadow-md);
  padding-left: 22px;
}

.dynamic-btn:hover::before {
  opacity: 1;
  right: 12px;
}

.dynamic-btn:active {
  transform: translateX(4px) scale(0.98);
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 输入区域 */
.input-container {
  padding: 16px 0 20px;
}

.input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: var(--bg-card);
  border-radius: 28px;
  padding: 8px 8px 8px 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(45, 90, 69, 0.1);
  transition: all 0.3s ease;
}

.input-wrapper:focus-within {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

textarea {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  color: var(--text-primary);
  background: transparent;
  padding: 8px 0;
}

textarea::placeholder {
  color: var(--text-muted);
}

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

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(45, 90, 69, 0.4);
}

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

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

.reset-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 16px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.reset-btn:hover {
  background: rgba(45, 90, 69, 0.1);
  color: var(--primary);
}

/* 底部 */
.footer {
  text-align: center;
  padding: 12px 20px 24px;
  position: relative;
  z-index: 1;
}

.footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* 产品卡片样式 */
.product-card {
  background: linear-gradient(135deg, #f8f6f0 0%, #fff 100%);
  border: 1px solid rgba(232, 180, 76, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 12px;
}

.product-card h4 {
  color: var(--primary);
  font-size: 0.95rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.product-card .buy-btn {
  background: var(--accent);
  color: var(--primary-dark);
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.product-card .buy-btn:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

/* Markdown 样式 */
.md-h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 16px 0 8px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.md-h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin: 12px 0 6px 0;
}

.md-list {
  margin: 8px 0;
  padding-left: 20px;
  list-style: none;
}

.md-list li {
  position: relative;
  margin-bottom: 4px;
  padding-left: 16px;
}

.md-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.md-hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--primary-light), transparent);
  margin: 16px 0;
}

/* 产品名高亮 */
.product-highlight {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  display: inline-block;
  margin: 2px 0;
}

/* 诊断卡片样式 */
.bubble h3.md-h3:first-of-type {
  margin-top: 8px;
}

.bubble strong {
  color: var(--primary);
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(45, 90, 69, 0.2);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 90, 69, 0.3);
}

/* 响应式 */
@media (max-width: 540px) {
  .app-container {
    max-width: 100%;
  }
  
  .content {
    max-width: 80%;
  }
  
  .quick-questions {
    padding: 8px 0;
  }
  
  .quick-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-main: #1a1f1a;
    --bg-card: #252b25;
    --bg-chat: #1e231e;
    --text-primary: #e8efe8;
    --text-secondary: #b0c0b0;
    --text-muted: #708070;
    --bubble-assistant: #2d382d;
  }
  
  .circle-1, .circle-2, .circle-3 {
    opacity: 0.08;
  }
  
  .leaf {
    opacity: 0.15;
  }
}

