/* 东北石油大学迎新问答助手 - 前端样式 v2 */
:root {
  --primary: #1a5276;
  --primary-light: #2980b9;
  --primary-dark: #0e2f44;
  --accent: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --text-lighter: #bdc3c7;
  --border: #e8ecf1;
  --user-bubble: linear-gradient(135deg, #1a5276 0%, #2980b9 100%);
  --bot-bubble: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* ===== 头部 ===== */
.header {
  background: linear-gradient(135deg, #1a5276 0%, #2980b9 50%, #3498db 100%);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(26,82,118,0.3);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
  padding: 0 24px;
  max-width: 900px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
}

.header-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.header-text p {
  font-size: 12px;
  opacity: 0.9;
  font-weight: 300;
}

.admin-link {
  color: white;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 16px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  transition: all 0.3s ease;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
}

.admin-link:hover {
  background: rgba(255,255,255,0.25);
  border-color: white;
  transform: translateY(-1px);
}

/* ===== 欢迎区域 ===== */
.welcome-section {
  background: linear-gradient(135deg, #1a5276 0%, #2980b9 100%);
  color: white;
  padding: 40px 24px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.welcome-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: rotate 20s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.welcome-content {
  max-width: 650px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
  animation: fade-in-down 0.6s ease;
}

@keyframes fade-in-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-section h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: fade-in-down 0.6s ease 0.1s both;
}

.welcome-section p {
  font-size: 15px;
  opacity: 0.95;
  margin-bottom: 28px;
  line-height: 1.7;
  animation: fade-in-down 0.6s ease 0.2s both;
}

/* 快捷标签 */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  animation: fade-in-up 0.6s ease 0.3s both;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tag {
  background: rgba(255,255,255,0.18);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.35);
  padding: 10px 20px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

.tag:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  border-color: rgba(255,255,255,0.6);
}

.tag:active {
  transform: translateY(-1px);
}

/* ===== 聊天区域 ===== */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: linear-gradient(to bottom, var(--bg) 0%, #eef2f7 100%);
}

/* 消息样式 */
.message {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  animation: message-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message {
  justify-content: flex-end;
}

.bot-message {
  justify-content: flex-start;
}

.message-avatar {
  flex-shrink: 0;
}

.avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 22px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.bot-message .avatar-icon {
  background: linear-gradient(135deg, #1a5276 0%, #2980b9 100%);
}

.user-message .avatar-icon {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-content {
  max-width: 75%;
  min-width: 60px;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.7;
  word-break: break-word;
  position: relative;
}

.user-bubble {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 15px rgba(26,82,118,0.25);
}

.bot-bubble {
  background: var(--bot-bubble);
  color: var(--text);
  box-shadow: var(--shadow-md);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--border);
}

.bot-bubble ul, .bot-bubble ol {
  padding-left: 22px;
  margin: 10px 0;
}

.bot-bubble li {
  margin: 5px 0;
}

.bot-bubble strong {
  color: var(--primary);
  font-weight: 600;
}

.message-time {
  font-size: 11px;
  color: var(--text-lighter);
  margin-top: 6px;
  padding: 0 6px;
}

.answer-category {
  display: inline-block;
  background: linear-gradient(135deg, rgba(26,82,118,0.1) 0%, rgba(41,128,185,0.1) 100%);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  margin-left: 5px;
  border: 1px solid rgba(26,82,118,0.15);
}

.answer-ai {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  margin-left: 5px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(102,126,234,0.3); }
  50% { box-shadow: 0 0 15px rgba(102,126,234,0.6); }
}

/* 反馈区域 */
.feedback-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  margin-left: 5px;
  font-size: 12px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius-sm);
}

.feedback-label { color: var(--text-lighter); }

.feedback-btn {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.feedback-btn:hover:not(:disabled) {
  background: var(--bg);
  transform: scale(1.15);
  border-color: var(--primary-light);
}

.feedback-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.feedback-thanks {
  color: var(--success);
  font-size: 12px;
  font-weight: 500;
}

/* 打字动画 */
.typing-indicator {
  padding: 0 24px 24px;
}

.typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 16px 20px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  width: fit-content;
}

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

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

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

/* ===== 输入区域 ===== */
.chat-input-area {
  background: white;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--bg);
  border-radius: 28px;
  padding: 6px 6px 6px 20px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.input-wrapper:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(41,128,185,0.1), inset 0 1px 2px rgba(0,0,0,0.02);
  background: white;
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  font-family: inherit;
  color: var(--text);
  padding: 10px 0;
}

.chat-input::placeholder {
  color: var(--text-lighter);
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1a5276 0%, #2980b9 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(26,82,118,0.3);
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 5px 15px rgba(26,82,118,0.4);
}

.send-btn:disabled {
  background: var(--text-lighter);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.send-icon {
  font-size: 20px;
  line-height: 1;
}

.input-hints {
  display: flex;
  justify-content: space-between;
  padding: 8px 8px 0;
  font-size: 12px;
  color: var(--text-lighter);
}

/* ===== 底部 ===== */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-lighter);
  font-size: 13px;
  background: white;
  border-top: 1px solid var(--border);
}

.footer-sub {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  .header-content { height: 60px; padding: 0 16px; }
  .logo { width: 40px; height: 40px; }
  .header-text h1 { font-size: 16px; }
  .header-text p { font-size: 11px; }
  .admin-link { padding: 6px 12px; font-size: 12px; }
  
  .welcome-section { padding: 30px 16px 40px; }
  .welcome-section h2 { font-size: 24px; }
  .welcome-section p { font-size: 14px; }
  
  .quick-tags { gap: 8px; }
  .tag { padding: 8px 14px; font-size: 13px; }
  
  .chat-messages { padding: 16px; }
  .message-content { max-width: 85%; }
  .message-bubble { padding: 12px 14px; font-size: 14px; }
  
  .chat-input-area { padding: 12px 16px; }
  .input-wrapper { padding: 4px 4px 4px 14px; }
  .chat-input { font-size: 14px; }
  .send-btn { width: 40px; height: 40px; }
  
  .feedback-area { margin-left: 0; }
  .answer-category { margin-left: 0; }
  .answer-ai { margin-left: 0; }
}

@media (max-width: 480px) {
  .welcome-section h2 { font-size: 22px; }
  .tag { font-size: 12px; padding: 6px 12px; }
  .header-text h1 { font-size: 15px; }
}

/* ===== 深色模式支持 ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --card-bg: #1a2332;
    --text: #e4e6eb;
    --text-light: #b0b3b8;
    --text-lighter: #6b7280;
    --border: #2d3748;
    --bot-bubble: #1a2332;
    --user-bubble: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  }
  
  .header, .chat-input-area, .footer {
    background: #1a2332;
  }
  
  .admin-link {
    border-color: rgba(255,255,255,0.2);
  }
  
  .user-message .avatar-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  }
  
  .input-wrapper {
    background: #0f1419;
  }
  
  .input-wrapper:focus-within {
    border-color: #3498db;
    background: #1a2332;
  }
  
  .send-btn:disabled {
    background: #2d3748;
  }
  
  .tag {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
  }
  
  .typing {
    background: #1a2332;
    border-color: #2d3748;
  }
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.2);
}

@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
  }
}
