/**
 * 天堂影视 - 自定义样式
 * 基于 TailwindCSS，增强视觉效果和用户体验
 */

/* ===== 基础字体和根样式 ===== */
:root {
  --primary-red: #dc2626;
  --primary-red-hover: #b91c1c;
  --secondary-red: #ef4444;
  --accent-red: #f87171;
  --gray-dark: #111827;
  --gray-medium: #374151;
  --gray-light: #6b7280;
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
}

body { 
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  line-height: 1.6;
  scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-red);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red-hover);
}

/* ===== 导航栏增强 ===== */
.sticky-header {
  backdrop-filter: blur(10px);
  background: rgba(31, 41, 55, 0.95);
  transition: all 0.3s ease;
}

.nav-link {
  position: relative;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-red);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ===== 搜索框增强 ===== */
.search-container {
  position: relative;
}

.search-input:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
  transform: translateY(-1px);
}

.search-button {
  transition: all 0.3s ease;
}

.search-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

/* ===== 卡片容器增强 ===== */
.movie-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.movie-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(220, 38, 38, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.movie-card:hover::before {
  opacity: 1;
}

.movie-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.movie-card .card-content {
  position: relative;
  z-index: 2;
}

/* ===== 渐变背景增强 ===== */
.hero-gradient {
  background: linear-gradient(135deg, 
    rgba(17, 24, 39, 1) 0%, 
    rgba(31, 41, 55, 0.95) 25%,
    rgba(55, 65, 81, 0.9) 50%,
    rgba(31, 41, 55, 0.95) 75%,
    rgba(17, 24, 39, 1) 100%);
  position: relative;
}

.hero-gradient::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><radialGradient id="a" cx="50%" cy="50%"><stop offset="0%" stop-color="%23dc2626" stop-opacity="0.05"/><stop offset="100%" stop-color="transparent"/></radialGradient></defs><circle cx="200" cy="200" r="150" fill="url(%23a)"/><circle cx="800" cy="400" r="100" fill="url(%23a)"/><circle cx="300" cy="700" r="120" fill="url(%23a)"/></svg>');
  opacity: 0.5;
  pointer-events: none;
}

/* ===== 文本渐变效果 ===== */
.gradient-text {
  background: linear-gradient(135deg, var(--secondary-red) 0%, var(--accent-red) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 3s ease-in-out infinite alternate;
}

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

/* ===== 按钮增强效果 ===== */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ===== 统计卡片效果 ===== */
.stats-card {
  position: relative;
  background: rgba(31, 41, 55, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(75, 85, 99, 0.3);
  transition: all 0.3s ease;
}

.stats-card:hover {
  background: rgba(31, 41, 55, 0.9);
  border-color: rgba(220, 38, 38, 0.3);
  transform: translateY(-4px);
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-red), var(--accent-red));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stats-card:hover::before {
  transform: scaleX(1);
}

/* ===== 分类标签效果 ===== */
.category-tag {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.category-tag::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary-red), var(--secondary-red));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-tag:hover::before {
  opacity: 1;
}

.category-tag > * {
  position: relative;
  z-index: 2;
}

/* ===== 内容区域动画 ===== */
.content-section {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-section.fade-in {
  animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 懒加载动画 ===== */
.is-visible {
  animation: slideInUp 0.6s ease-out forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 加载状态 ===== */
.loading {
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-red);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== 悬浮效果增强 ===== */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ===== 响应式媒体查询 ===== */
@media (max-width: 768px) {
  .hero-gradient {
    background-size: cover;
    min-height: 60vh;
  }
  
  .gradient-text {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .stats-card {
    padding: 1rem;
  }
  
  .movie-card:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  .search-input {
    font-size: 16px; /* 防止iOS缩放 */
  }
}

@media (max-width: 640px) {
  .hero-gradient {
    padding: 3rem 0;
  }
  
  .gradient-text {
    font-size: 2rem;
  }
  
  .stats-card {
    padding: 0.75rem;
  }
  
  .movie-card {
    margin-bottom: 1rem;
  }
}

/* ===== 高对比度和可访问性 ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: light) {
  /* 为支持亮色主题预留，当前专注于暗色主题 */
}

/* ===== 焦点样式增强 ===== */
button:focus,
a:focus,
input:focus {
  outline: 2px solid var(--primary-red);
  outline-offset: 2px;
}

/* ===== 自定义TailwindCSS扩展 ===== */
.bg-gray-750 {
  background-color: #334155;
}

.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.backdrop-blur-strong {
  backdrop-filter: blur(20px);
}

/* ===== 性能优化 ===== */
.will-change-transform {
  will-change: transform;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ===== 打印样式 ===== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .bg-gray-900,
  .bg-gray-800 {
    background: white !important;
  }
  
  .text-white {
    color: black !important;
  }
}