/* 现代化博客样式优化 */

/* 全局变量 - Dark Theme (默认) */
:root,
[data-theme="dark"] {
  --primary-color: #3b82f6;
  --secondary-color: #94a3b8;
  --accent-color: #f59e0b;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --bg-primary: #1e293b;
  --bg-secondary: #0f172a;
  --bg-accent: #334155;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

/* 全局变量 - Light Theme */
[data-theme="light"] {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --accent-color: #d97706;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-accent: #f1f5f9;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

/* 基础样式重置 */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary) !important;
  background: var(--bg-secondary) !important;
  transition: all 0.3s ease;
}

/* 确保HTML元素也使用正确的背景色 */
html {
  background: var(--bg-secondary) !important;
}

/* 简洁现代导航栏 */
.clean-navbar {
  background: var(--bg-primary) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color) !important;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

.clean-navbar .navbar-brand {
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--text-primary) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.clean-navbar .navbar-brand:hover {
  color: var(--primary-color) !important;
}

.clean-navbar .nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin: 0 0.2rem;
}

.clean-navbar .nav-link:hover {
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.1);
}

.clean-navbar .dropdown-menu {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
  margin-top: 0.5rem !important;
}

.clean-navbar .dropdown-item {
  color: var(--text-primary) !important;
  padding: 0.6rem 1rem !important;
  transition: all 0.2s ease !important;
}

.clean-navbar .dropdown-item:hover {
  background: var(--bg-accent) !important;
  color: var(--primary-color) !important;
}

.clean-navbar .navbar-toggler {
  border: none !important;
  padding: 0.25rem 0.5rem !important;
}

.clean-navbar .navbar-toggler:focus {
  box-shadow: none !important;
}


/* 主容器现代化 */
.container {
  max-width: 1200px;
  margin-top: 2rem;
}

/* 文章列表现代化 */
.list-item {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.list-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.list-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.list-item:hover::before {
  opacity: 1;
}

.list-item h4 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.list-item h4 a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.list-item h4 a:hover {
  color: var(--primary-color);
}

.post-summary {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 标签和元信息现代化 */
.list-item small {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.list-item small span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.list-item small i {
  font-size: 0.875rem;
  color: var(--primary-color);
}

.list-item small a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.list-item small a:hover {
  color: var(--primary-color);
}

/* 侧边栏现代化 */
#right .card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.3s ease;
}

#right .card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: var(--bg-accent) !important;
  color: var(--text-primary) !important;
  font-weight: 600;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color) !important;
  font-size: 1rem;
}

.card-body {
  padding: 1.5rem;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.card-body * {
  color: var(--text-primary) !important;
}

/* 确保所有卡片都使用主题变量 */
.card {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
}

.card .card-header {
  background: var(--bg-accent) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.card .card-body {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

/* 确保所有文本元素都有正确的颜色 */
.text-muted {
  color: var(--text-secondary) !important;
}

/* 修复下拉菜单样式 */
.dropdown-menu {
  background-color: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.dropdown-item {
  color: var(--text-primary) !important;
}

.dropdown-item:hover {
  background-color: var(--bg-accent) !important;
  color: var(--text-primary) !important;
}

/* 确保容器背景透明 */
.container {
  background: transparent !important;
}

/* 修复可能的白色背景问题 */
.bg-white {
  background-color: transparent !important;
}

/* 个人资料卡片 */
#profile .card-body {
  text-align: center;
}

#profile img {
  width: 80px !important;
  height: 80px !important;
  border-radius: 50%;
  border: 3px solid var(--primary-color);
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

#profile img:hover {
  transform: scale(1.05);
}

#profile .h4 {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

/* 分页器现代化 */
.pagination {
  justify-content: center;
  margin-top: 3rem;
}

.page-link {
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  margin: 0 0.25rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  text-decoration: none;
}

.page-link:hover {
  color: white;
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.page-item.active .page-link {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 文章页面现代化 */
#article {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: 3rem !important;
  margin-bottom: 2rem;
}

#contentTitle {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Markdown 内容样式 */
.markdown-body {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.markdown-body h2 {
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.markdown-body p {
  margin-bottom: 1.5rem;
}

.markdown-body a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.markdown-body a:hover {
  border-bottom-color: var(--primary-color);
}

.markdown-body blockquote {
  background: var(--bg-accent);
  border-left: 4px solid var(--primary-color);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.markdown-body code {
  background: var(--bg-accent);
  color: var(--primary-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

.markdown-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.markdown-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* 目录现代化 */
#toc-container {
  position: sticky;
  top: 2rem;
}

#toc {
  list-style: none;
  padding: 0;
  margin: 0;
}

#toc li {
  margin-bottom: 0.5rem;
}

#toc a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: block;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

#toc a:hover {
  color: var(--primary-color);
  background: var(--bg-accent);
  border-left-color: var(--primary-color);
}

/* 返回顶部按钮现代化 */
.back-top {
  background: var(--primary-color) !important;
  border-radius: 50% !important;
  width: 3rem !important;
  height: 3rem !important;
  line-height: 3rem !important;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.back-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* 简洁页脚 */
.clean-footer {
  background: var(--bg-primary) !important;
  border-top: 1px solid var(--border-color) !important;
  margin-top: 2rem;
  padding: 1.5rem 0 !important;
}

.clean-footer .text-muted {
  color: var(--text-secondary) !important;
}

/* 返回顶部按钮优化 */
.back-top {
  background: var(--primary-color) !important;
  border-radius: 50% !important;
  width: 3rem !important;
  height: 3rem !important;
  line-height: 3rem !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: fixed !important;
  bottom: 2rem !important;
  right: 2rem !important;
  z-index: 999 !important;
}

.back-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  background: var(--accent-color) !important;
}

.back-top span {
  color: white !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .list-item {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .list-item h4 {
    font-size: 1.25rem;
  }
  
  #article {
    padding: 2rem !important;
  }
  
  #contentTitle {
    font-size: 2rem;
  }
  
  .list-item small {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.list-item {
  animation: fadeInUp 0.6s ease forwards;
}

.list-item:nth-child(2) { animation-delay: 0.1s; }
.list-item:nth-child(3) { animation-delay: 0.2s; }
.list-item:nth-child(4) { animation-delay: 0.3s; }
.list-item:nth-child(5) { animation-delay: 0.4s; }

/* 加载状态 */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* 选择文本样式 */
::selection {
  background: var(--primary-color);
  color: white;
}

/* 焦点样式 */
:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 打印样式 */
@media print {
  .back-top,
  #navBar,
  footer {
    display: none !important;
  }
  
  .list-item,
  #article {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}