/* 全局样式 */
:root {
  --primary: #165dff;
  --gradient-primary: linear-gradient(135deg, #ec4899, #8b5cf6);
  --gradient-secondary: linear-gradient(135deg, #06b6d4, #3b82f6);
  --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
}

/* 导航栏样式增强 */
#navbar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#navbar.scroll {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-medium);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  transform: translateY(0);
}

/* 移动端菜单动画 */
#mobile-menu {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-menu.active {
  opacity: 1;
  pointer-events: auto;
}

#mobile-menu.active > div {
  transform: translateX(0);
}

/* 轮播图动画 */
.carousel-item {
  opacity: 0;
  transform: scale(1.05);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-item.active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

.carousel-indicator {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-indicator.active {
  background-color: white;
  transform: scale(1.2);
}

/* 漫画卡片增强动画 */
.comic-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
}

.comic-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-large);
}

.comic-card:hover .comic-image {
  transform: scale(1.05);
}

/* 分类卡片动画 */
.category-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover {
  transform: translateY(-4px);
}

.category-card:hover .category-image {
  transform: scale(1.1) rotate(5deg);
}

/* 滚动动画 */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* 回到顶部按钮 */
#back-to-top {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* 搜索框动画 */
#search-input:focus {
  width: 20rem;
  background-color: white;
  box-shadow: var(--shadow-medium);
}

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

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

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #db2777, #7c3aed);
}

/* 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;
}

/* 渐变文字动画 */
@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

/* 浮动动画 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* 脉动动画 */
@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.animate-pulse-soft {
  animation: pulse-soft 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 收藏按钮动画 */
.favorited {
  transform: scale(1.1);
  color: #ef4444 !important;
}

/* 响应式增强 */
@media (max-width: 640px) {
  #search-input:focus {
    width: 16rem;
  }
  
  .carousel-item h2 {
    font-size: 1.875rem;
  }
  
  .carousel-item p {
    font-size: 1rem;
  }
}

/* 自定义工具类 */
.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;
}

/* 玻璃拟态效果 */
.glass {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  .dark body {
    background-color: #0f172a;
    color: #f8fafc;
  }
  
  .dark #navbar {
    background-color: rgba(15, 23, 42, 0.95);
  }
  
  .dark .bg-white {
    background-color: #1e293b;
  }
  
  .dark .text-gray-900 {
    color: #f8fafc;
  }
  
  .dark .text-gray-600 {
    color: #94a3b8;
  }
  
  .dark .text-gray-500 {
    color: #64748b;
  }
}

/* 性能优化 */
.comic-card,
.category-card,
.carousel-item {
  will-change: transform;
}

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

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .text-gray-500 {
    color: #374151;
  }
  
  .text-gray-600 {
    color: #1f2937;
  }
}