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

/* 樱花动漫2025移动端优化样式 */

/* 移动端触摸优化 */
@media (max-width: 768px) {
  /* 增大触摸目标 */
  .mobile-menu-btn,
  .hero-prev,
  .hero-next,
  .hero-dot {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 优化文本大小 */
  .hero-slide h2 {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  
  /* 移动端间距优化 */
  .hero-slide {
    padding: 1.5rem !important;
  }
  
  /* 分类卡片移动端优化 */
  .category-card {
    min-height: 120px;
  }
  
  /* 动漫卡片移动端优化 */
  .anime-card {
    margin-bottom: 1rem;
  }
  
  /* 搜索框移动端样式 */
  .mobile-menu input[type="text"] {
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  /* 更新项移动端布局 */
  .update-item {
    padding: 1rem !important;
  }
  
  .update-item .flex {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .update-item .flex > div:first-child {
    margin-bottom: 1rem;
    margin-right: 0 !important;
  }
}

/* 横屏移动设备优化 */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-slide {
    flex-direction: row !important;
  }
  
  .hero-slide h2 {
    font-size: 1.5rem;
  }
  
  .hero-section {
    margin-bottom: 2rem;
  }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
  .hero-slide h2 {
    font-size: 1.5rem;
  }
  
  .category-card > div {
    padding: 1rem !important;
  }
  
  .grid.grid-cols-2 {
    gap: 0.75rem;
  }
}

/* 触摸设备优化 */
@media (pointer: coarse) {
  /* 为触摸设备增大点击区域 */
  .category-card,
  .anime-card,
  .update-item {
    transform: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
  }
  
  .category-card:hover,
  .anime-card:hover,
  .update-item:hover {
    transform: none;
  }
  
  /* 移除hover效果，使用active状态 */
  .category-card:active,
  .anime-card:active,
  .update-item:active {
    opacity: 0.8;
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* 针对Retina屏幕的优化 */
  .hero-slide .bg-gradient-to-br {
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 深色模式优化（系统偏好） */
@media (prefers-color-scheme: dark) {
  /* 确保在深色模式下的可读性 */
  body {
    color-scheme: dark;
  }
}

/* 减少动画偏好的用户 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .hero-slider {
    animation: none;
  }
}

/* 自定义轮播指示器 */
.hero-dot.active {
  background-color: rgba(255, 255, 255, 0.9) !important;
  transform: scale(1.2);
}

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

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* 搜索建议样式增强 */
.search-suggestions {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search-suggestions div:last-child {
  border-bottom: none;
}

/* 性能优化 */
.hero-section,
.categories-section,
.new-season,
.latest-updates,
.ranking {
  will-change: transform;
  transform: translateZ(0);
}

/* iOS安全区域适配 */
@supports (padding-top: env(safe-area-inset-top)) {
  .ios-safe-top {
    padding-top: calc(1rem + env(safe-area-inset-top));
  }
  
  .ios-safe-bottom {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

/* 滑动手势视觉反馈 */
.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease;
  pointer-events: none;
  z-index: 1;
}

.hero-section.swiping::before {
  left: 100%;
}

/* 打字机效果 */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid #ec4899;
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: #ec4899; }
}