/* 中医AI聊天界面样式 */

/* 基础样式 - 与v0.8保持一致 */
:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --secondary: #d6ad60;
  --secondary-light: #f0c877;
  --dark: #001219;
  --light: #f8f9fa;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 导入字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f8f9fa;
  color: var(--dark);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Serif SC', serif;
  font-weight: 600;
  line-height: 1.3;
}

/* 导航栏样式 */
.navbar {
  background-color: var(--primary);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.navbar-brand:hover {
  color: var(--secondary-light);
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: white;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--secondary);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* 聊天容器样式 */
.chat-container {
  max-width: 1000px;
  height: calc(100vh - 200px);
  background-color: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 聊天内容区域 */
.chat-messages {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* 消息气泡样式 */
.chat-bubble-user {
  border-bottom-right-radius: 4px !important;
}

.chat-bubble-ai {
  border-bottom-left-radius: 4px !important;
}

/* 正在输入动画 */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 输入区域样式 */
.input-area {
  padding: 1.5rem 2rem;
  border-top: 1px solid #e9ecef;
  background-color: #fafafa;
}

.message-input-container {
  position: relative;
}

#messageInput {
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  padding: 0.75rem 1rem;
  padding-right: 4rem;
  border: 1px solid #ced4da;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#messageInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

#messageInput::placeholder {
  color: var(--gray);
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background-color: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  color: white;
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: white;
}

#sendBtn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--primary);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

#sendBtn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-50%) scale(1.05);
}

#sendBtn:active {
  transform: translateY(-50%) scale(0.95);
}

/* 示例问题按钮 */
.example-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.example-question {
  background-color: #f0f4f8;
  color: var(--primary);
  border: 1px solid #d1e0e0;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.example-question:hover {
  background-color: var(--primary-light);
  color: white;
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* 功能介绍区域 */
.features-section {
  background-color: #f5f5f5;
  padding: 3rem 0;
}

.feature-card {
  background-color: white;
  border-radius: 12px;
  padding: 2rem;
  height: 100%;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.feature-icon {
  width: 60px;
  height: 60px;
  background-color: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: white;
  font-size: 1.5rem;
}

/* 页脚样式 */
.footer {
  background-color: var(--primary-dark);
  color: white;
  padding: 2rem 0;
}

.footer-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--secondary-light);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 150px);
    margin: 1rem;
  }
  
  .chat-messages {
    padding: 1rem;
  }
  
  .input-area {
    padding: 1rem;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .features-section {
    padding: 2rem 0;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .chat-container {
    height: calc(100vh - 120px);
  }
  
  .chat-messages {
    padding: 0.75rem;
    gap: 1rem;
  }
  
  .message-input-container {
    margin-bottom: 0.75rem;
  }
  
  .example-questions {
    gap: 0.5rem;
  }
  
  .example-question {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* 欢迎消息样式 */
.welcome-message {
  background-color: rgba(45, 106, 79, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  border-left: 4px solid var(--primary);
}

.welcome-message h3 {
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.welcome-message p {
  color: var(--dark);
  font-size: 0.95rem;
}

/* 工具提示样式 */
.tooltip {
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--dark);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 0.5rem;
}

.tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--dark);
  z-index: 1000;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #e0e0e0;
  }
  
  .chat-container {
    background-color: #1e1e1e;
  }
  
  .input-area {
    background-color: #252525;
    border-top-color: #333;
  }
  
  #messageInput {
    background-color: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
  }
  
  #messageInput::placeholder {
    color: #888;
  }
  
  .welcome-message {
    background-color: rgba(45, 106, 79, 0.15);
  }
  
  .welcome-message h3 {
    color: #40916c;
  }
  
  .welcome-message p {
    color: #d0d0d0;
  }
  
  .example-question {
    background-color: #2d2d2d;
    color: #40916c;
    border-color: #444;
  }
  
  .features-section {
    background-color: #1a1a1a;
  }
  
  .feature-card {
    background-color: #1e1e1e;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }
  
  .feature-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  }
}