/* 全局样式 */
:root {
  --primary: #165dff;
}

body {
  font-family: "Inter", sans-serif;
}

a {
  text-decoration: none;
}

/* 导航栏滚动效果 */
#navbar.scroll {
  background-color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* 轮播图 */
.carousel-item.active {
  opacity: 1;
  z-index: 1;
}

/* 移动端菜单 */
#mobileMenu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* 漫画卡片悬停效果 */
.comic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* 分类卡片悬停效果 */
.category-card:hover .category-image {
  transform: scale(1.05);
}

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

/* 自定义滚动条 */
::-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;
}

/* Line clamp 样式 */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

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

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

/* 自定义动画 */
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-shimmer {
  animation: shimmer 2s linear infinite;
}

/* 响应式阴影 */
.shadow-3xl {
  box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.25);
}

/* 自定义圆角 */
.rounded-4xl {
  border-radius: 2rem;
}

.rounded-5xl {
  border-radius: 2.5rem;
}

/* 自定义边框 */
.border-3 {
  border-width: 3px;
}

/* 移动端兼容性优化 */
@media (max-width: 768px) {
  /* 容器内边距 */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* 字体大小调整 */
  .text-4xl {
    font-size: 2rem;
    line-height: 2.5rem;
  }
  
  .text-6xl {
    font-size: 3rem;
    line-height: 3.5rem;
  }
  
  .text-3xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .text-2xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  
  /* 导航栏移动端优化 */
  nav {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* 轮播图高度调整 */
  .h-96 {
    height: 20rem;
  }
  
  /* 网格布局优化 */
  .grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  
  /* 间距调整 */
  .py-12 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .py-8 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
  
  .mb-8 {
    margin-bottom: 1.5rem;
  }
  
  .mb-6 {
    margin-bottom: 1rem;
  }
  
  /* 按钮大小调整 */
  .px-6 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .py-3 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  /* 卡片间距 */
  .gap-6 {
    gap: 1rem;
  }
  
  .gap-4 {
    gap: 0.75rem;
  }
  
  /* 搜索框优化 */
  input[type="text"] {
    font-size: 16px; /* 防止iOS缩放 */
    -webkit-appearance: none;
    appearance: none;
  }
  
  /* 触摸优化 */
  .cursor-pointer {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  /* 滚动优化 */
  body {
    -webkit-overflow-scrolling: touch;
  }
  
  /* 分类图标调整 */
  .text-2xl {
    font-size: 1.5rem;
  }
  
  /* 底部信息间距 */
  footer .grid-cols-1 {
    gap: 1.5rem;
  }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
  /* 极小屏幕字体调整 */
  .text-4xl {
    font-size: 1.75rem;
    line-height: 2.25rem;
  }
  
  .text-6xl {
    font-size: 2.5rem;
    line-height: 3rem;
  }
  
  .text-xl {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  
  .text-lg {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
  
  /* 间距进一步缩小 */
  .py-12 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
  
  .px-4 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .mb-8 {
    margin-bottom: 1rem;
  }
  
  .mb-4 {
    margin-bottom: 0.75rem;
  }
  
  /* 按钮调整 */
  .px-6 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .py-3 {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }
  
  /* 网格调整 */
  .grid-cols-2 {
    gap: 0.5rem;
  }
  
  .gap-4 {
    gap: 0.5rem;
  }
  
  /* 轮播图高度进一步调整 */
  .h-96 {
    height: 16rem;
  }
  
  /* 搜索框调整 */
  .pr-12 {
    padding-right: 2.5rem;
  }
  
  /* 移动端菜单优化 */
  #mobile-menu {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  
  /* 卡片标题调整 */
  .font-semibold {
    font-size: 0.875rem;
  }
  
  /* 描述文字调整 */
  .text-gray-400 {
    font-size: 0.75rem;
  }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
  /* 轮播图高度调整 */
  .h-96 {
    height: 60vh;
  }
  
  /* 内容区域调整 */
  .py-12 {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  
  /* 导航栏高度调整 */
  nav {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  .pt-16 {
    padding-top: 3rem;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 确保在高DPI屏幕上的清晰度 */
  .bg-gradient-to-br,
  .bg-gradient-to-r {
    background-size: 200% 200%;
  }
  
  /* 边框优化 */
  .border {
    border-width: 0.5px;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  /* 如果需要支持系统暗色模式 */
  :root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
  }
}

/* 减少动画和过渡效果（用户偏好） */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-fade-in {
    animation: none;
  }
}

/* 打印样式 */
@media print {
  /* 隐藏导航和交互元素 */
  nav,
  button,
  #mobile-menu {
    display: none !important;
  }
  
  /* 调整背景色 */
  body {
    background: white !important;
    color: black !important;
  }
  
  /* 调整字体 */
  * {
    font-size: 12pt !important;
    line-height: 1.4 !important;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 移除悬停效果 */
  .hover\:scale-105:hover {
    transform: none;
  }
  
  .hover\:bg-red-700:hover {
    background-color: inherit;
  }
  
  .hover\:text-red-500:hover {
    color: inherit;
  }
  
  /* 增加触摸目标大小 */
  .cursor-pointer {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 按钮触摸优化 */
  button {
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  /* 链接触摸优化 */
  a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
}