/* 全局样式 */
: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;
}

/* 移动端菜单 */
.mobile-menu-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
}

.mobile-menu-active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  max-height: 400px;
}

#mobileMenu.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  max-height: 400px;
}

/* 漫画卡片悬停效果 */
.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) {
  /* 导航栏移动端优化 */
  #navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* 移动端菜单优化 */
  #mobileMenu {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  /* 移动端菜单项优化 */
  #mobileMenu a {
    font-size: 16px;
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
  }
  
  #mobileMenu a:active {
    background-color: #3b82f6;
    color: white;
    transform: scale(0.98);
  }
  
  /* 移动端搜索框优化 */
  #mobileMenu input {
    font-size: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
  }
  
  #mobileMenu input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }
  
  /* 移动端菜单按钮优化 */
  #mobileMenuBtn {
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
  }
  
  #mobileMenuBtn:active {
    background-color: #f3f4f6;
    transform: scale(0.95);
  }
  
  /* 移动端卡片间距优化 */
  .grid {
    gap: 1rem;
  }
  
  /* 移动端文字大小优化 */
  .text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  
  .text-5xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
  
  /* 移动端按钮优化 */
  button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 移动端输入框优化 */
  input {
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  /* 移动端轮播图高度优化 */
  .h-96 {
    height: 16rem;
  }
  
  /* 移动端排行榜优化 */
  #ranking .grid-cols-1 {
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  /* 超小屏幕优化 */
  .px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .py-12 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  /* 移动端卡片标题优化 */
  .comic-card h3 {
    font-size: 0.875rem;
  }
  
  .comic-card p {
    font-size: 0.75rem;
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .hover\:shadow-lg:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
  
  .hover\:scale-110:hover {
    transform: scale(1.05);
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
  #navbar {
    height: 3rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
  
  main {
    padding-top: 3rem;
  }
  
  .h-96 {
    height: 12rem;
  }
}

/* 无障碍优化 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode 支持 */
@media (prefers-color-scheme: dark) {
  .bg-gray-50 {
    background-color: #1f2937;
    color: #f9fafb;
  }
  
  .bg-white {
    background-color: #374151;
    color: #f9fafb;
  }
  
  .text-gray-900 {
    color: #f9fafb;
  }
  
  .text-gray-700 {
    color: #d1d5db;
  }
  
  .text-gray-600 {
    color: #9ca3af;
  }
  
  .border-gray-200 {
    border-color: #4b5563;
  }
  
  .shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  }
}

/* iOS Safari 特殊优化 */
@supports (-webkit-touch-callout: none) {
  input {
    transform: translateZ(0);
  }
  
  .fixed {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* 打印样式 */
@media print {
  .fixed,
  #navbar,
  footer,
  button {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .bg-gradient-to-br {
    background: #f3f4f6 !important;
  }
}