/* Modern Design System 2024 */
:root {
  /* Primary Colors */
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --accent-pink: #ec4899;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-rose: #e11d48;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-green: #22c55e;
  --gray-50: #fafaf9;
  --gray-100: #f5f5f4;
  --gray-200: #e7e5e4;
  --gray-800: #292524;
  --gray-900: #1c1917;
  --bg-primary: #fafaf9;
  --bg-secondary: #f5f5f4;
  --bg-tertiary: #ffffff;
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --border-color: rgba(231, 229, 228, 0.6);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.06);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.5);
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.dark {
  --bg-primary: #0c0a09;
  --bg-secondary: #1c1917;
  --bg-tertiary: #292524;
  --text-primary: #fafaf9;
  --text-secondary: #a8a29e;
  --border-color: rgba(68, 64, 60, 0.4);
  --glass-bg: rgba(28, 25, 23, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* Modern Card */
.modern-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.modern-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  border-radius: var(--radius-xl);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 2px;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* Glass Effect */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
}

/* Gradient Button */
.btn-gradient {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
  color: white;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all var(--transition-base);
  box-shadow: 0 4px 15px -3px rgba(99, 102, 241, 0.4);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -5px rgba(99, 102, 241, 0.5);
}

/* Text Gradient */
.text-gradient {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.shimmer {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* Float Animation */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Glow Effect */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px -5px var(--primary-500); }
  50% { box-shadow: 0 0 40px -5px var(--primary-500); }
}

.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* Modern Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-300);
}

.dark ::-webkit-scrollbar-thumb {
  background: var(--gray-700);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: var(--gray-600);
}

/* Aurora Background Effect */
.aurora-bg {
  position: relative;
  overflow: hidden;
}

.aurora-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 70%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
  animation: aurora 15s ease-in-out infinite;
  pointer-events: none;
}

@keyframes aurora {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
}

/* Spotlight Effect */
.spotlight {
  position: relative;
}

.spotlight::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(99, 102, 241, 0.1) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.spotlight:hover::before {
  opacity: 1;
}

/* Mesh Gradient */
.mesh-gradient {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 50%, rgba(59, 130, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 80% 50%, rgba(139, 92, 246, 0.1) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
}

/* ============================================
   UI Enhancement 2024 - 舒适性、优雅性优化
   ============================================ */

/* 玻璃拟态增强 */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.02),
    0 2px 4px -2px rgba(0, 0, 0, 0.02),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

.dark .glass {
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

/* 更优雅的卡片悬停效果 */
.modern-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: 
    0 1px 3px 0 rgba(0, 0, 0, 0.02),
    0 1px 2px -1px rgba(0, 0, 0, 0.02);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.modern-card:hover {
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.05),
    0 4px 6px -4px rgba(0, 0, 0, 0.03);
  transform: translateY(-2px);
}

/* 渐变按钮增强 */
.btn-gradient {
  background: linear-gradient(135deg, var(--primary-500), var(--accent-purple));
  color: white;
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 15px -3px rgba(99, 102, 241, 0.4),
    0 0 0 1px rgba(99, 102, 241, 0.1) inset;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.btn-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn-gradient:hover {
  box-shadow: 
    0 8px 25px -5px rgba(99, 102, 241, 0.5),
    0 0 0 1px rgba(99, 102, 241, 0.2) inset;
  transform: translateY(-1px);
}

.btn-gradient:hover::before {
  left: 100%;
}

.btn-gradient:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 10px -3px rgba(99, 102, 241, 0.4),
    0 0 0 1px rgba(99, 102, 241, 0.1) inset;
}

/* 用户卡片特殊样式 */
.user-card-entrance {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 统计数字动画 */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-number {
  animation: countUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* 导航按钮微交互 */
.category-btn {
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--primary-500), var(--accent-purple));
  border-radius: 0 2px 2px 0;
  transition: height 0.2s ease;
}

.category-btn:hover::before,
.category-btn.active::before {
  height: 60%;
}

.category-btn:hover {
  transform: translateX(4px);
}

/* AI工坊卡片特殊效果 */
.ai-workshop-card {
  position: relative;
  overflow: hidden;
}

.ai-workshop-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 60%
  );
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(180deg);
  }
}

/* 响应式优化 */
@media (max-width: 1024px) {
  .modern-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  .btn-gradient:hover {
    transform: none;
  }
}

/* 深色模式优化 */
@media (prefers-color-scheme: dark) {
  .glass {
    --glass-bg: rgba(28, 25, 23, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
  }
}

/* 焦点状态优化 - 无障碍访问 */
.btn-gradient:focus-visible,
.modern-card:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .user-card-entrance,
  .stat-number,
  .modern-card,
  .btn-gradient,
  .category-btn {
    animation: none;
    transition: none;
  }
  
  .ai-workshop-card::before {
    animation: none;
  }
}

/* ============================================
   帖子详情页样式 - Topic Detail Page
   ============================================ */

/* 帖子头部样式 */
.topic-header {
  background: linear-gradient(to right, rgba(248, 250, 252, 0.8), rgba(241, 245, 249, 0.5));
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.dark .topic-header {
  background: linear-gradient(to right, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.3));
  border-bottom-color: rgba(51, 65, 85, 0.4);
}

/* 帖子底部操作栏 */
.topic-footer {
  background: rgba(248, 250, 252, 0.5);
  border-top: 1px solid rgba(226, 232, 240, 0.6);
}

.dark .topic-footer {
  background: rgba(30, 41, 59, 0.3);
  border-top-color: rgba(51, 65, 85, 0.4);
}

/* 回复卡片特殊样式 */
.reply-card {
  transition: all 0.2s ease;
}

.reply-card:hover {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

/* 最佳答案高亮 */
.reply-card.solution {
  background: linear-gradient(to right, rgba(236, 253, 245, 0.5), transparent);
}

.dark .reply-card.solution {
  background: linear-gradient(to right, rgba(6, 78, 59, 0.2), transparent);
}

/* 代码块包装器 */
.code-block-wrapper {
  position: relative;
  margin: 1rem 0;
}

.code-block-wrapper pre {
  margin: 0;
  border-radius: 0.75rem;
  background: #1e293b;
  color: #e2e8f0;
  overflow-x: auto;
}

.code-block-wrapper .copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

.code-block-wrapper:hover .copy-code-btn {
  opacity: 1;
}

.code-block-wrapper .copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
}

.code-block-wrapper .copy-code-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

/* 下拉菜单 */
.dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 50;
}

.dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dark .dropdown {
  background: #1e293b;
  border-color: #334155;
}

/* 标签样式 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.tag:hover {
  background: #e2e8f0;
}

.dark .tag {
  background: #334155;
  color: #cbd5e1;
}

.dark .tag:hover {
  background: #475569;
}
