/**
 * Premium SEO Template - Animations
 * 流畅的动画和过渡效果
 */

/* ========== 关键帧动画 ========== */

/* 淡入动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* 向上滑入 */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 向下滑入 */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 向左滑入 */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 向右滑入 */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 缩放进入 */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* 旋转进入 */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: rotate(0);
  }
}

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

/* 闪烁效果 */
@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

/* 加载动画 */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

/* 闪耀效果 */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* 抖动效果 */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* 彩虹渐变 */
@keyframes rainbow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ========== 元素动画应用 ========== */

/* 页面加载动画 */
body {
  animation: fadeIn 0.6s ease-out;
}

/* 导航栏动画 */
.site-header {
  animation: slideInDown 0.5s ease-out;
}

/* 视频项动画 */
.video-item {
  animation: slideInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.video-item:nth-child(1) { animation-delay: 0.05s; }
.video-item:nth-child(2) { animation-delay: 0.1s; }
.video-item:nth-child(3) { animation-delay: 0.15s; }
.video-item:nth-child(4) { animation-delay: 0.2s; }
.video-item:nth-child(5) { animation-delay: 0.25s; }
.video-item:nth-child(6) { animation-delay: 0.3s; }
.video-item:nth-child(7) { animation-delay: 0.35s; }
.video-item:nth-child(8) { animation-delay: 0.4s; }
.video-item:nth-child(n+9) { animation-delay: 0.45s; }

/* 分区标题动画 */
.section-header {
  animation: slideInLeft 0.5s ease-out;
}

/* 详情页动画 */
.detail-info-section {
  animation: scaleIn 0.5s ease-out;
}

.detail-poster {
  animation: slideInLeft 0.6s ease-out;
}

.detail-meta {
  animation: slideInRight 0.6s ease-out;
}

/* 页脚动画 */
.site-footer {
  animation: slideInUp 0.6s ease-out;
}

/* ========== 交互动画 ========== */

/* 链接悬停效果 */
a {
  transition: color 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
}

a:hover {
  transform: translateY(-2px);
}

/* 按钮悬停效果 */
button {
  transition: all 0.3s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:active {
  transform: translateY(0);
}

/* 表单输入焦点效果 */
input:focus,
textarea:focus,
select:focus {
  animation: pulse 0.5s ease-out;
}

/* ========== 加载状态动画 ========== */

/* 骨架屏加载动画 */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* 加载中圆形动画 */
.loading-spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 4px solid #0066cc;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

/* ========== 滚动动画 ========== */

/* 滚动显示动画 */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 返回顶部按钮动画 ========== */

.back-to-top {
  transition: all 0.3s ease;
}

.back-to-top:hover {
  animation: float 2s ease-in-out infinite;
}

/* ========== 页面过渡动画 ========== */

/* 页面进入 */
.page-enter {
  animation: fadeIn 0.3s ease-out;
}

/* 页面离开 */
.page-leave {
  animation: fadeIn 0.3s ease-out reverse;
}

/* ========== 搜索框动画 ========== */

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

.search-input-wrapper:focus-within {
  animation: pulse 0.5s ease-out;
}

/* ========== 下拉菜单动画 ========== */

.dropdown-menu {
  animation: slideInDown 0.3s ease-out;
  animation-fill-mode: both;
}

.nav-item:hover .dropdown-menu {
  animation-play-state: running;
}

/* ========== 模态框动画 ========== */

.modal-enter {
  animation: scaleIn 0.3s ease-out;
}

.modal-leave {
  animation: scaleIn 0.3s ease-out reverse;
}

/* ========== 通知动画 ========== */

.notification {
  animation: slideInRight 0.3s ease-out;
}

.notification.closing {
  animation: slideInRight 0.3s ease-out reverse;
}

/* ========== 图片加载动画 ========== */

img {
  transition: opacity 0.3s ease;
}

img.loading {
  opacity: 0.5;
  animation: pulse 1.5s ease-in-out infinite;
}

img.loaded {
  opacity: 1;
  animation: fadeIn 0.3s ease-out;
}

/* ========== 视频播放器动画 ========== */

.player-container {
  animation: scaleIn 0.5s ease-out;
}

.play-icon {
  transition: all 0.3s ease;
}

.video-item:hover .play-icon {
  animation: pulse 0.6s ease-out;
}

/* ========== 分页动画 ========== */

.pagination-link {
  transition: all 0.2s ease;
}

.pagination-link:hover {
  animation: pulse 0.4s ease-out;
}

/* ========== 徽章动画 ========== */

.badge {
  animation: slideInRight 0.4s ease-out;
}

.badge-hits {
  animation-delay: 0.1s;
}

.badge-date {
  animation-delay: 0.2s;
}

/* ========== 文本动画 ========== */

/* 逐字出现 */
.text-reveal {
  animation: slideInUp 0.6s ease-out;
}

/* 文本闪烁 */
.text-blink {
  animation: blink 1s ease-in-out infinite;
}

/* ========== 卡片动画 ========== */

.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* ========== 列表项动画 ========== */

.list-item {
  transition: all 0.3s ease;
}

.list-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
  padding-left: 10px;
}

/* ========== 响应式动画调整 ========== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 移动设备上的动画优化 */
@media (max-width: 768px) {
  .video-item {
    animation-delay: 0s !important;
  }

  .video-item:nth-child(n+2) {
    animation-delay: 0s !important;
  }

  button:hover {
    transform: translateY(0);
  }

  a:hover {
    transform: translateY(0);
  }
}

/* ========== 性能优化 ========== */

/* 使用 GPU 加速 */
.video-item,
.card,
.button,
.nav-link {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* 禁用不必要的动画 */
@media (max-width: 480px) {
  .float {
    animation: none;
  }

  .shimmer {
    animation: none;
  }
}
