/* 使用Tailwind CSS的现代化样式 */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* 自定义样式 */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
}

/* 卡片悬停效果 - 增强版 */
.card-hover {
  @apply transition-all duration-500 ease-out transform;
  position: relative;
}

.card-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
}

.card-hover:hover {
  @apply -translate-y-2 shadow-2xl;
}

.card-hover:hover::before {
  opacity: 1;
}

/* 标签样式 */
.tag {
  @apply inline-block px-3 py-1 text-xs font-semibold rounded-full;
}

/* 最佳回答标记 */
.best-answer {
  @apply border-l-4 border-orange-500 relative;
}

.best-answer::before {
  content: '最佳回答';
  @apply absolute top-0 left-0 -mt-6 px-2 py-1 bg-orange-500 text-white text-xs font-bold rounded;
}

/* 响应式网格 */
.grid-responsive {
  @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6;
}

/* 导航栏样式 - 增强版 */
.navbar-blur {
  @apply backdrop-blur-xl bg-white/95 shadow-lg;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

/* 导航栏项目样式 */
.nav-item {
  @apply px-4 py-2 rounded-lg text-sm font-medium transition-all duration-300 relative;
  overflow: hidden;
}

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

.nav-item:hover::before {
  left: 100%;
}

.nav-item:hover {
  @apply bg-gradient-to-r from-blue-50 to-purple-50 text-blue-600 transform scale-105 shadow-md;
}

.nav-item.active {
  @apply bg-gradient-to-r from-blue-100 to-purple-100 text-blue-700 shadow-md;
}

/* 移动端菜单样式 */
.mobile-menu-item {
  @apply px-4 py-3 rounded-lg text-base font-medium transition-all duration-300;
}

.mobile-menu-item:hover {
  @apply bg-gradient-to-r from-blue-50 to-purple-50 text-blue-600 transform translate-x-2;
}

.mobile-menu-item.active {
  @apply bg-blue-100 text-blue-700;
}

/* 列表样式 */
ul {
  @apply list-none;
  list-style: none !important;
}

ol {
  @apply list-none;
  list-style: none !important;
}

ul li {
  list-style: none !important;
}

ol li {
  list-style: none !important;
}

.nav-menu {
  @apply list-none;
}

.nav-menu li {
  @apply list-none;
  list-style: none !important;
}

/* 面包屑导航列表样式 */
nav ol,
nav ul {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 0 !important;
}

nav ol li,
nav ul li {
  list-style: none !important;
  list-style-type: none !important;
}

nav ol li::before,
nav ul li::before {
  content: none !important;
}

/* 内容溢出处理 */
.article-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.article-content p {
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 1rem;
  line-height: 1.8;
}

.article-title {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* 文章内容区域样式 */
.text-gray-700.leading-relaxed {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.text-gray-700.leading-relaxed p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.text-gray-700.leading-relaxed br {
  display: block;
  content: "";
  margin-top: 0.5rem;
}

/* Prose 样式优化 */
.prose {
  @apply text-gray-800;
}

.prose h2 {
  @apply text-2xl font-bold mt-8 mb-4 text-gray-900;
  border-left: 4px solid #3b82f6;
  padding-left: 1rem;
}

.prose h3 {
  @apply text-xl font-bold mt-6 mb-3 text-gray-900;
}

.prose p {
  @apply mb-4 leading-relaxed;
}

/* Prose 内的列表样式 - 只在文章内容中显示 */
.prose ul {
  @apply mb-4 pl-6;
  list-style: disc !important;
}

.prose ol {
  @apply mb-4 pl-6;
  list-style: decimal !important;
}

.prose ul li {
  @apply mb-2;
  list-style: disc !important;
}

.prose ol li {
  @apply mb-2;
  list-style: decimal !important;
}

.prose a {
  @apply text-blue-600 hover:text-blue-700 underline transition-colors;
}

.prose blockquote {
  @apply border-l-4 border-blue-500 pl-4 italic my-4 text-gray-700 bg-blue-50 py-2 rounded-r;
}

.prose code {
  @apply bg-gray-100 px-2 py-1 rounded text-sm font-mono text-pink-600;
}

.prose pre {
  @apply bg-gray-900 text-gray-100 p-4 rounded-lg overflow-x-auto my-4;
}

/* 导航和面包屑中的列表不显示样式 */
nav .prose ul,
nav .prose ol {
  list-style: none !important;
  padding-left: 0 !important;
}

nav .prose ul li,
nav .prose ol li {
  list-style: none !important;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  @apply bg-gray-100 rounded-full;
}

::-webkit-scrollbar-thumb {
  @apply bg-gradient-to-b from-blue-400 to-purple-500 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
  @apply from-blue-500 to-purple-600;
}

/* 额外美化效果 */
.card {
  @apply bg-white rounded-2xl shadow-lg overflow-hidden;
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.3s ease;
}

.card:hover {
  @apply shadow-2xl;
  transform: translateY(-4px);
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 渐变文字效果 */
.gradient-text {
  @apply bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent;
}

/* 按钮悬停效果 */
.btn-primary {
  @apply transition-all duration-300 shadow-md;
}

.btn-primary:hover {
  @apply transform scale-105 shadow-xl;
}

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

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* 加载动画 */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* 行号限制 */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
