/* 全局样式 */
:root {
  --primary: #ea580c;
  --primary-hover: #dc2626;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* 移动端响应式优化 */
@media (max-width: 768px) {
  .text-6xl {
    font-size: 2.5rem !important;
  }
  
  .text-4xl {
    font-size: 2rem !important;
  }
  
  .text-3xl {
    font-size: 1.75rem !important;
  }
  
  .text-2xl {
    font-size: 1.5rem !important;
  }
  
  .py-16 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }
  
  .py-20 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }
  
  .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .gap-6 {
    gap: 1rem !important;
  }
  
  .gap-8 {
    gap: 1.5rem !important;
  }
  
  .grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  }
}

/* 小说卡片样式 */
.novel-card {
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 0.5rem;
  overflow: hidden;
  background: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

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

/* 分类标签样式 */
.category-tab {
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.category-tab:hover {
  transform: translateY(-2px);
}

.category-tab.active {
  background-color: var(--primary) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

/* 文本截断样式 */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 搜索框样式 */
.search-input {
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.search-btn {
  border-radius: 9999px;
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.search-btn:hover {
  background-color: var(--primary-hover);
}

/* 导航栏样式 */
.sticky {
  position: -webkit-sticky;
  position: sticky;
}

header {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 移动端菜单动画 */
.mobile-menu {
  transition: all 0.3s ease;
}

.mobile-menu.hidden {
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
}

/* 按钮和链接悬停效果 */
.transition-colors {
  transition: color 0.3s ease, background-color 0.3s ease;
}

.transition-shadow {
  transition: box-shadow 0.3s ease;
}

.transition-all {
  transition: all 0.3s ease;
}

/* 渐变背景 */
.bg-gradient-to-r {
  background: linear-gradient(to right, var(--tw-gradient-stops));
}

.bg-gradient-to-br {
  background: linear-gradient(to bottom right, var(--tw-gradient-stops));
}

/* 阴影效果 */
.shadow-sm {
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 回到顶部按钮 */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  z-index: 50;
}

.back-to-top:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* 分割线样式 */
.divide-y > :not(:first-child) {
  border-top: 1px solid #e5e7eb;
}

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

/* 响应式网格 */
@media (max-width: 640px) {
  .grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1025px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 导航栏滚动效果 */
#navbar.scroll {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 触摸优化 */
@media (max-width: 768px) {
  .novel-card,
  .category-tab,
  button,
  a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease-out;
}

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

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

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

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

/* 字体优化 */
.font-bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

/* 确保内容不被遮挡 */
main {
  min-height: 60vh;
}

/* 链接样式 */
a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  color: var(--primary);
}

/* 按钮基础样式 */
button {
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

/* 特殊样式 */
.menu-toggle span {
  transition: transform 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
  }
  
  body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
  }
}

/* 额外的响应式样式 */
@media (max-width: 480px) {
  .text-4xl {
    font-size: 1.875rem !important;
  }
  
  .text-3xl {
    font-size: 1.5rem !important;
  }
  
  .px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  .py-12 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
}