/* 蘑菇影视网站自定义样式 */
:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --secondary: #764ba2;
  --accent: #f093fb;
  --success: #48bb78;
  --warning: #ed8936;
  --error: #f56565;
  --text-primary: #1a202c;
  --text-secondary: #718096;
  --background: #f7fafc;
  --card-background: #ffffff;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* 全局样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background);
  font-size: 16px;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

/* 链接样式 */
a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

a:hover {
  color: var(--primary);
}

/* 按钮样式 */
button {
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 输入框样式 */
input[type="text"],
input[type="search"],
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
  background-color: var(--card-background);
}

input[type="text"]:focus,
input[type="search"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

::-webkit-scrollbar-track {
  background: var(--background);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* 渐变背景 */
.bg-gradient-primary {
  background: var(--gradient-primary);
}

.bg-gradient-secondary {
  background: var(--gradient-secondary);
}

.bg-gradient-accent {
  background: var(--gradient-accent);
}

/* 卡片样式 */
.card {
  background: var(--card-background);
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px var(--shadow);
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px var(--shadow-hover);
}

/* 影片卡片特殊样式 */
.film-card {
  position: relative;
  background: var(--card-background);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.film-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  z-index: 1;
}

.film-card:hover::before {
  transform: translateX(100%);
}

.film-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 响应式图片 */
.responsive-image {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -30px, 0);
  }
  70% {
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.6s ease forwards;
}

.animate-slideIn {
  animation: slideIn 0.5s ease forwards;
}

.animate-bounce {
  animation: bounce 1s ease;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-shimmer {
  animation: shimmer 2s linear infinite;
}

/* 加载动画 */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}

/* 移动端菜单 */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--card-background);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active .mobile-menu-content {
  transform: translateX(0);
}

/* 排行榜样式 */
.ranking-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card-background);
  transition: all 0.3s ease;
}

.ranking-item:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 25px -5px var(--shadow-hover);
}

.ranking-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.ranking-item:hover::before {
  transform: scaleY(1);
}

/* 搜索框样式 */
.search-container {
  position: relative;
}

.search-container input {
  padding-right: 40px;
}

.search-container button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.search-container button:hover {
  color: var(--primary);
  background: rgba(102, 126, 234, 0.1);
}

/* 标签样式 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(102, 126, 234, 0.1);
  color: var(--primary);
  transition: all 0.3s ease;
}

.tag:hover {
  background: rgba(102, 126, 234, 0.2);
}

/* 评分样式 */
.rating {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #f59e0b;
  font-weight: 600;
}

/* 文本省略 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.text-ellipsis-3 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

/* 玻璃效果 */
.glass-effect {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  .film-card:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  .mobile-menu-content {
    width: 100%;
    max-width: 320px;
  }
  
  .search-container input {
    font-size: 16px; /* 防止iOS放大 */
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 2rem !important;
  }
  
  .hero-subtitle {
    font-size: 1rem !important;
  }
  
  .section-title {
    font-size: 1.5rem !important;
  }
  
  .card-title {
    font-size: 0.9rem !important;
  }
  
  .card-desc {
    font-size: 0.8rem !important;
  }
  
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .grid-responsive-single {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem !important;
  }
  
  .hero-subtitle {
    font-size: 0.9rem !important;
  }
  
  .section-title {
    font-size: 1.25rem !important;
  }
  
  .grid-responsive {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  
  .px-mobile {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  
  .py-mobile {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .film-card {
    transform: translateZ(0);
  }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --background: #1a202c;
    --card-background: #2d3748;
    --border: #4a5568;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
  }
  
  .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

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

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

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

/* 可访问性 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 打印样式 */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  .no-print {
    display: none !important;
  }
}