/* ============================================
   Animations v5 — 6prompt.com 统一动效系统
   沉稳 × 科技感 × 学术权威 × 现代时尚
   克制不张扬，细节处见品质
   ============================================ */

/* ============================================
   入场动画 — Entrance Animations
   ============================================ */

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scale-in-up {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 工具类 */
.animate-fade-in {
  animation: fade-in var(--duration-entrance) var(--ease-out) both;
}

.animate-fade-out {
  animation: fade-out var(--duration-exit) var(--ease-in-out) both;
}

.animate-fade-in-up {
  animation: fade-in-up var(--duration-entrance) var(--ease-out) both;
}

.animate-fade-in-down {
  animation: fade-in-down var(--duration-entrance) var(--ease-out) both;
}

.animate-fade-in-left {
  animation: fade-in-left var(--duration-entrance) var(--ease-out) both;
}

.animate-fade-in-right {
  animation: fade-in-right var(--duration-entrance) var(--ease-out) both;
}

.animate-scale-in {
  animation: scale-in var(--duration-entrance) var(--ease-out) both;
}

.animate-scale-in-up {
  animation: scale-in-up var(--duration-entrance) var(--ease-spring) both;
}

/* 延迟工具类 */
.animate-delay-1 { animation-delay: 60ms; }
.animate-delay-2 { animation-delay: 120ms; }
.animate-delay-3 { animation-delay: 180ms; }
.animate-delay-4 { animation-delay: 240ms; }
.animate-delay-5 { animation-delay: 300ms; }
.animate-delay-6 { animation-delay: 360ms; }

/* ============================================
   骨架屏闪光 — Skeleton Shimmer
   ============================================ */

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

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 0%,
    var(--bg-surface) 50%,
    var(--bg-subtle) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-gold {
  background: linear-gradient(
    90deg,
    var(--gold-whisper) 0%,
    var(--gold-pale) 50%,
    var(--gold-whisper) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ============================================
   呼吸动效 — Pulse
   ============================================ */

@keyframes pulse-gold {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--gold-glow);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
    opacity: 0.9;
  }
}

@keyframes pulse-soft {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

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

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

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

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

/* ============================================
   旋转动效 — Spin
   ============================================ */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-reverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes spin-hex {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 0.6s linear infinite;
}

.animate-spin-reverse {
  animation: spin-reverse 0.6s linear infinite;
}

.animate-spin-hex {
  animation: spin-hex 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.animate-spin-slow {
  animation: spin-slow 8s linear infinite;
}

/* 六边形 loading 容器 */
.hex-loader {
  position: relative;
  width: 48px;
  height: 48px;
}

.hex-loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: spin-hex 2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.hex-loader::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--bg-elevated);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: spin-hex 2s cubic-bezier(0.45, 0, 0.55, 1) infinite reverse;
}

.hex-loader-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse-gold 2s ease-in-out infinite;
}

/* ============================================
   抽屉动画 — Slide
   ============================================ */

@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slide-left {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-right {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-up-exit {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes slide-down-exit {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

.animate-slide-up {
  animation: slide-up var(--duration-entrance) var(--ease-out) both;
}

.animate-slide-down {
  animation: slide-down var(--duration-entrance) var(--ease-out) both;
}

.animate-slide-left {
  animation: slide-left var(--duration-entrance) var(--ease-out) both;
}

.animate-slide-right {
  animation: slide-right var(--duration-entrance) var(--ease-out) both;
}

.animate-slide-up-exit {
  animation: slide-up-exit var(--duration-exit) var(--ease-in-out) both;
}

.animate-slide-down-exit {
  animation: slide-down-exit var(--duration-exit) var(--ease-in-out) both;
}

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

@keyframes toast-enter {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-exit {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

/* ============================================
   微交互 — Micro Interactions
   ============================================ */

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes float-slow {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(2deg);
  }
}

@keyframes wiggle {
  0%, 100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

@keyframes shimmer-text {
  0% {
    background-position: -100% center;
  }
  100% {
    background-position: 200% center;
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-float-slow {
  animation: float-slow 5s ease-in-out infinite;
}

.animate-wiggle {
  animation: wiggle 0.5s ease-in-out;
}

/* 金色文字闪光效果 */
.text-shimmer {
  background: linear-gradient(
    90deg,
    var(--gold) 0%,
    var(--gold-bright) 50%,
    var(--gold) 100%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer-text 3s linear infinite;
}

/* ============================================
   进度条动画 — Progress
   ============================================ */

@keyframes progress-stripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

.progress-animated {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.15) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0.15) 75%,
    transparent 75%,
    transparent
  );
  background-size: 40px 40px;
  animation: progress-stripes 1s linear infinite;
}

/* ============================================
   无障碍支持 — 减少动效
   ============================================ */

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

  .skeleton,
  .skeleton-gold {
    animation: none;
    background: var(--bg-subtle);
  }

  .text-shimmer {
    animation: none;
    background: var(--gold);
    -webkit-text-fill-color: var(--gold);
  }

  .progress-animated {
    animation: none;
  }
}
