/* 自定义样式 - 补充 TailwindCSS */

/* 字体设置 */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

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

/* 选择文本颜色 */
::selection {
  background-color: #3B82F6;
  color: white;
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 代码块样式增强 */
pre {
  position: relative;
  overflow-x: auto;
  background: #1e293b !important;
  border-radius: 8px;
  padding: 1rem;
  margin: 1.5rem 0;
}

pre code {
  background: transparent !important;
  color: #e2e8f0 !important;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* 代码复制按钮 */
pre::before {
  content: 'Copy';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #475569;
  color: #e2e8f0;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

pre:hover::before {
  opacity: 1;
}

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

tr:hover {
  background: #f9fafb;
}

/* 引用块样式 */
blockquote {
  border-left: 4px solid #3B82F6;
  background: #f8fafc;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #475569;
}

blockquote p {
  margin: 0;
}

/* 链接样式 */
a {
  color: #3B82F6;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #1D4ED8;
  text-decoration: underline;
}

/* 图片样式 */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 1.5rem 0;
}

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

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

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 渐变背景 */
.gradient-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 文本渐变 */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 响应式视频 */
.video-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 标签云效果 */
.tag-cloud a {
  display: inline-block;
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  background: #f1f5f9;
  color: #475569;
  border-radius: 9999px;
  font-size: 0.875rem;
  transition: all 0.2s;
  text-decoration: none;
}

.tag-cloud a:hover {
  background: #3B82F6;
  color: white;
  transform: scale(1.05);
}

/* 搜索高亮 */
.search-highlight {
  background: #fef08a;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  pre, blockquote {
    page-break-inside: avoid;
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background-color: #1f2937;
    color: #f9fafb;
  }
  
  .dark-mode-auto .bg-white {
    background-color: #374151;
  }
  
  .dark-mode-auto .text-gray-800 {
    color: #f9fafb;
  }
  
  .dark-mode-auto .text-gray-600 {
    color: #d1d5db;
  }
  
  .dark-mode-auto .border-gray-200 {
    border-color: #4b5563;
  }
}

/* 无障碍支持 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 焦点样式 */
.focus-visible:focus {
  outline: 2px solid #3B82F6;
  outline-offset: 2px;
}

/* 动画类 */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.5s ease-out;
}

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

/* 工具提示 */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: #374151;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}