/* ============================================
   RV There Yet - Custom Styles
   补充Tailwind CSS的自定义样式
   ============================================ */

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

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

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

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

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

/* 深色模式滚动条 */
@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-track {
    background: #1f2937;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #4b5563;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
  }
}

/* 复制按钮动画 */
.copy-button {
  transition: all 0.2s ease;
}

.copy-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.copy-button.copied {
  background-color: #10b981 !important;
}

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

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

/* 图片懒加载淡入效果 */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* YouTube视频响应式容器 */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9比例 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #000;
  border-radius: 8px;
}

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

/* 表格样式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

table th {
  background-color: #f3f4f6;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}

table td {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

table tr:hover {
  background-color: #f9fafb;
}

@media (prefers-color-scheme: dark) {
  table th {
    background-color: #374151;
    border-bottom-color: #4b5563;
  }
  
  table td {
    border-bottom-color: #4b5563;
  }
  
  table tr:hover {
    background-color: #1f2937;
  }
}

/* 代码块样式 */
code {
  background-color: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

pre code {
  display: block;
  padding: 1rem;
  overflow-x: auto;
  border-radius: 8px;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  code {
    background-color: #374151;
    color: #e5e7eb;
  }
}

/* 搜索框样式 */
.search-input {
  transition: all 0.3s ease;
}

.search-input:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* 徽章样式 */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-new {
  background-color: #ef4444;
  color: white;
}

.badge-updated {
  background-color: #f59e0b;
  color: white;
}

.badge-popular {
  background-color: #8b5cf6;
  color: white;
}

/* 提示框样式 */
.tip-box {
  padding: 1rem;
  border-left: 4px solid;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.tip-box.tip-info {
  background-color: #dbeafe;
  border-color: #3b82f6;
}

.tip-box.tip-warning {
  background-color: #fef3c7;
  border-color: #f59e0b;
}

.tip-box.tip-danger {
  background-color: #fee2e2;
  border-color: #ef4444;
}

.tip-box.tip-success {
  background-color: #d1fae5;
  border-color: #10b981;
}

@media (prefers-color-scheme: dark) {
  .tip-box.tip-info {
    background-color: #1e3a8a;
    color: #dbeafe;
  }
  
  .tip-box.tip-warning {
    background-color: #78350f;
    color: #fef3c7;
  }
  
  .tip-box.tip-danger {
    background-color: #7f1d1d;
    color: #fee2e2;
  }
  
  .tip-box.tip-success {
    background-color: #064e3b;
    color: #d1fae5;
  }
}

/* 导航栏固定时的占位 */
.nav-spacer {
  height: 64px;
}

/* 返回顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background-color: #2563eb;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: #1d4ed8;
  transform: translateY(-5px);
}

/* 加载动画 */
.loading-spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #2563eb;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

/* 响应式字体大小 */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
}

/* 打印样式 */
@media print {
  .no-print {
    display: none !important;
  }
  
  nav, footer, .back-to-top {
    display: none !important;
  }
  
  a {
    text-decoration: underline;
  }
}

