/* 韩剧大全 - 现代化样式表 */

/* CSS变量定义 */
:root {
  --primary-purple: #a855f7;
  --primary-pink: #ec4899;
  --dark-bg: #0f172a;
  --darker-bg: #020617;
  --glass-bg: rgba(0, 0, 0, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --gradient-primary: linear-gradient(135deg, #a855f7, #ec4899);
  --gradient-hero: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --vh: 1vh;
}

/* 重置和基础样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--dark-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 链接样式 */
a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

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

/* 按钮样式 */
button {
  border: none;
  background: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

button:focus {
  outline: 2px solid var(--primary-purple);
  outline-offset: 2px;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
  opacity: 1;
}

/* 导航栏样式增强 */
nav {
  transition: var(--transition);
  will-change: background-color, backdrop-filter;
}

.nav-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 轮播图样式 */
.carousel-slide {
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.carousel-dot {
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.carousel-dot:hover {
  border-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

/* 卡片悬停效果 */
.card-hover {
  transition: var(--transition);
  will-change: transform, box-shadow;
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-elevated);
}

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

.animated-gradient {
  background: linear-gradient(-45deg, #6366f1, #8b5cf6, #a855f7, #ec4899);
  background-size: 400% 400%;
  animation: gradient-shift 8s ease infinite;
}

/* 文字截断 */
.line-clamp-1 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

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

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

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

/* 发光效果 */
.glow-effect {
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.glow-effect:hover {
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.5);
}

/* 加载动画 */
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 2s infinite;
}

/* 脉冲动画 */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

/* 弹跳动画 */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.bounce-hover:hover {
  animation: bounce 0.6s ease-in-out;
}

/* 旋转效果 */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}

/* 淡入动画 */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* 缩放动画 */
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.scale-in {
  animation: scale-in 0.3s ease-out;
}

/* 移动端优化 */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }
  
  /* 触摸优化 */
  button, a, [role="button"] {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }
  
  /* 移动端卡片间距调整 */
  .mobile-spacing {
    padding: 0.75rem;
    margin: 0.5rem 0;
  }
  
  /* 移动端字体调整 */
  .mobile-text-lg {
    font-size: 1.25rem;
    line-height: 1.75rem;
  }
  
  .mobile-text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
}

/* 平板端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
  .tablet-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
  .desktop-hover:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-elevated);
  }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .high-dpi {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* 暗色主题适配 */
@media (prefers-color-scheme: dark) {
  :root {
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  }
}

/* 减少动画偏好适配 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 打印样式 */
@media print {
  body {
    background: white;
    color: black;
  }
  
  nav, .carousel-dot, button {
    display: none;
  }
}

/* 可访问性增强 */
.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;
}

/* 焦点样式 */
.focus-visible:focus {
  outline: 2px solid var(--primary-purple);
  outline-offset: 2px;
}

/* 选择文本样式 */
::selection {
  background-color: var(--primary-purple);
  color: white;
}

::-moz-selection {
  background-color: var(--primary-purple);
  color: white;
}

/* 工具提示样式 */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 1000;
}

.tooltip:hover::after {
  opacity: 1;
}

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

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

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

/* 容器查询支持（未来特性） */
@supports (container-type: inline-size) {
  .container {
    container-type: inline-size;
  }
}

/* 新的CSS特性支持检测 */
@supports (backdrop-filter: blur(10px)) {
  .backdrop-blur {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

@supports (display: grid) {
  .grid-fallback {
    display: grid;
  }
}

/* 自定义属性动画 */
@property --gradient-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.animated-border {
  --gradient-angle: 0deg;
  border: 2px solid;
  border-image: conic-gradient(from var(--gradient-angle), var(--primary-purple), var(--primary-pink), var(--primary-purple)) 1;
  animation: rotate-gradient 3s linear infinite;
}

@keyframes rotate-gradient {
  to {
    --gradient-angle: 360deg;
  }
}