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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* 4K影院 - 移动端优化样式 */

/* 基础重置 */
* {
  box-sizing: border-box;
}

/* 移动端导航优化 */
@media (max-width: 768px) {
  .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* 移动端搜索框优化 */
  .mobile-search {
    width: 100%;
    font-size: 16px; /* 防止iOS缩放 */
  }
  
  /* 移动端卡片优化 */
  .movie-card {
    margin-bottom: 1rem;
  }
  
  /* 移动端文字大小调整 */
  .hero-title {
    font-size: 2.5rem !important;
  }
  
  .hero-subtitle {
    font-size: 1.1rem !important;
  }
  
  /* 移动端按钮优化 */
  .mobile-button {
    min-height: 44px; /* iOS推荐的最小触摸区域 */
    padding: 0.75rem 1.5rem;
  }
  
  /* 移动端排行榜优化 */
  .ranking-item {
    flex-direction: column;
    text-align: center;
  }
  
  .ranking-number {
    margin-bottom: 0.5rem;
  }
  
  /* 移动端网格优化 */
  .grid-mobile-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-mobile-1 {
    grid-template-columns: 1fr;
  }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem !important;
  }
  
  .section-title {
    font-size: 1.5rem !important;
  }
  
  .card-title {
    font-size: 0.9rem !important;
  }
  
  .px-4 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  /* 移动端导航栏高度调整 */
  .mobile-nav-height {
    height: 60px;
  }
  
  /* 移动端主要内容顶部间距 */
  .main-content-mobile {
    padding-top: 60px;
  }
}

/* 触摸设备优化 */
@media (hover: none) {
  .group:hover {
    transform: none !important;
  }
  
  .group:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .hover-effect:hover {
    transform: none !important;
  }
  
  .hover-effect:active {
    opacity: 0.8;
    transition: opacity 0.1s ease;
  }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    min-height: 80vh;
  }
  
  .hero-content {
    padding: 2rem 0;
  }
  
  .hero-title {
    font-size: 2.5rem !important;
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .high-res-border {
    border-width: 0.5px;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-color: #3b82f6;
  }
}

/* 动画性能优化 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 焦点可访问性 */
button:focus,
input:focus,
a:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 移动端滚动优化 */
.mobile-scroll {
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

/* 移动端字体大小防止缩放 */
input[type="text"],
input[type="search"],
textarea {
  font-size: 16px;
}

/* 移动端卡片间距优化 */
@media (max-width: 640px) {
  .gap-6 {
    gap: 1rem;
  }
  
  .gap-8 {
    gap: 1.5rem;
  }
  
  .space-y-4 > * + * {
    margin-top: 1rem;
  }
  
  .space-y-8 > * + * {
    margin-top: 1.5rem;
  }
}

/* 移动端内边距优化 */
@media (max-width: 640px) {
  .py-16 {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  
  .py-12 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .px-8 {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* 移动端导航菜单动画 */
.mobile-menu-enter {
  transform: translateY(-10px);
  opacity: 0;
}

.mobile-menu-enter-active {
  transform: translateY(0);
  opacity: 1;
  transition: all 0.3s ease;
}

.mobile-menu-exit {
  transform: translateY(0);
  opacity: 1;
}

.mobile-menu-exit-active {
  transform: translateY(-10px);
  opacity: 0;
  transition: all 0.3s ease;
}

/* 移动端加载动画 */
.loading-skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 移动端弹性布局优化 */
.flex-mobile-col {
  flex-direction: column;
}

.flex-mobile-row {
  flex-direction: row;
}

@media (max-width: 640px) {
  .flex-mobile-col {
    flex-direction: column;
  }
  
  .flex-mobile-row {
    flex-direction: column;
  }
}

/* 移动端视频播放器优化 */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 移动端表单优化 */
@media (max-width: 640px) {
  .form-input {
    font-size: 16px;
    padding: 0.75rem;
    border-radius: 0.5rem;
  }
  
  .form-button {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
  }
}

/* 移动端卡片阴影优化 */
.card-shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@media (max-width: 640px) {
  .card-shadow {
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  }
}

/* 移动端性能优化 */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* 移动端防止选择文本 */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 移动端安全区域适配 */
@supports (padding: max(0px)) {
  .safe-area-inset {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .safe-area-top {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .safe-area-bottom {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* 移动端滚动条优化 */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: #374151;
}

::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 移动端图片懒加载 */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image.loaded {
  opacity: 1;
}

/* 移动端错误处理 */
.error-message {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* 移动端网络状态提示 */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #ef4444;
  color: white;
  text-align: center;
  padding: 0.5rem;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-indicator.show {
  transform: translateY(0);
}