/* ==================== 梦核动态 + 漩涡故障效果 ==================== */

/* ==================== 背景粒子效果 ==================== */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(147, 112, 219, 0.3);
  border-radius: 50%;
  animation: particleFloat 15s infinite ease-in-out;
}

.particle::before {
  content: '✦';
  position: absolute;
  font-size: 12px;
  color: rgba(147, 112, 219, 0.4);
  animation: particleTwinkle 3s infinite;
}

@keyframes particleFloat {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.3;
  }
  25% {
    transform: translate(50px, -100px) rotate(90deg);
    opacity: 0.8;
  }
  50% {
    transform: translate(100px, 50px) rotate(180deg);
    opacity: 0.5;
  }
  75% {
    transform: translate(-50px, 100px) rotate(270deg);
    opacity: 0.7;
  }
}

@keyframes particleTwinkle {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
}

/* ==================== 漩涡加载效果 ==================== */
.vortex-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e6e6fa 0%, #f5f5f5 50%, #d8bfd8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.vortex-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.vortex-ring {
  position: absolute;
  border: 3px solid transparent;
  border-radius: 50%;
  animation: vortexSpin 2s linear infinite;
}

.vortex-ring:nth-child(1) {
  width: 80px;
  height: 80px;
  border-top-color: #9370db;
  animation-duration: 1.5s;
}

.vortex-ring:nth-child(2) {
  width: 120px;
  height: 120px;
  border-right-color: #7b68ee;
  animation-duration: 2s;
  animation-direction: reverse;
}

.vortex-ring:nth-child(3) {
  width: 160px;
  height: 160px;
  border-bottom-color: #ff69b4;
  animation-duration: 2.5s;
}

@keyframes vortexSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  margin-top: 160px;
  font-size: 16px;
  color: #9370db;
  letter-spacing: 3px;
  animation: textPulse 1.5s ease-in-out infinite;
}

@keyframes textPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ==================== 故障文字效果 ==================== */
.glitch-text {
  position: relative;
  animation: glitchText 5s infinite;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.glitch-text::before {
  color: #ff69b4;
  animation: glitchBefore 5s infinite;
}

.glitch-text::after {
  color: #7b68ee;
  animation: glitchAfter 5s infinite;
}

@keyframes glitchText {
  0%,
  92%,
  100% {
    transform: translate(0);
  }
  93% {
    transform: translate(-2px, 1px);
  }
  94% {
    transform: translate(2px, -1px);
  }
  95% {
    transform: translate(-1px, 2px);
  }
}

@keyframes glitchBefore {
  0%,
  92%,
  100% {
    opacity: 0;
    transform: translate(0);
  }
  93% {
    opacity: 0.8;
    transform: translate(-3px, 0);
  }
  94% {
    opacity: 0.5;
    transform: translate(3px, 0);
  }
  95% {
    opacity: 0;
  }
}

@keyframes glitchAfter {
  0%,
  92%,
  100% {
    opacity: 0;
    transform: translate(0);
  }
  93% {
    opacity: 0.5;
    transform: translate(3px, 0);
  }
  94% {
    opacity: 0.8;
    transform: translate(-3px, 0);
  }
  95% {
    opacity: 0;
  }
}

/* ==================== 卡片悬停故障效果 ==================== */
.card {
  position: relative;
}

/* 卡片悬停时的微光效果 - 简化版 */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  pointer-events: none;
  transition: left 0.5s ease;
}

.card:hover::after {
  left: 100%;
}

/* 卡片悬停效果 - 移除会导致冲突的 animation，改用 transition */
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(147, 112, 219, 0.25);
}

/* 卡片封面悬停效果 - 简化版避免图片消失 */
.card:hover .card-cover img {
  transform: scale(1.05);
  filter: brightness(1.05) saturate(1.1);
}

/* ==================== 漩涡过渡效果 ==================== */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 0%, #e6e6fa 100%);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: scale(0);
  transition: all 0.5s ease;
}

.page-transition.active {
  opacity: 1;
  transform: scale(1);
  animation: vortexIn 0.5s ease forwards;
}

@keyframes vortexIn {
  0% {
    clip-path: circle(0% at 50% 50%);
    opacity: 1;
  }
  100% {
    clip-path: circle(150% at 50% 50%);
    opacity: 0;
  }
}

/* ==================== 弹窗漩涡效果 ==================== */
.modal.show .modal-content {
  animation: modalVortex 0.4s ease;
}

@keyframes modalVortex {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-180deg);
  }
  50% {
    transform: scale(1.1) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ==================== 闪烁效果 ==================== */
.flicker {
  animation: flicker 4s infinite;
}

@keyframes flicker {
  0%,
  100% {
    opacity: 1;
  }
  41% {
    opacity: 1;
  }
  42% {
    opacity: 0.8;
  }
  43% {
    opacity: 1;
  }
  44% {
    opacity: 0.5;
  }
  45% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  91% {
    opacity: 0.6;
  }
  92% {
    opacity: 1;
  }
}

/* ==================== 标签悬停效果 ==================== */
.card-tag:hover,
.filter-tag:hover {
  animation: tagPulse 0.5s;
}

@keyframes tagPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ==================== 按钮涟漪效果 ==================== */
.btn-primary,
.btn-fetch {
  position: relative;
  overflow: hidden;
}

.btn-primary::after,
.btn-fetch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after,
.btn-fetch:active::after {
  width: 300px;
  height: 300px;
}

/* ==================== 管理员面板滑入效果 ==================== */
.admin-panel.show {
  animation: panelSlide 0.3s ease;
}

@keyframes panelSlide {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ==================== Toast 弹出效果 ==================== */
.toast.show {
  animation: toastBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes toastBounce {
  0% {
    transform: translateX(-50%) translateY(100px) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: translateX(-50%) translateY(-10px) scale(1.05);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

/* ==================== 无权限卡片晃动效果 ==================== */
.card.no-permission:hover {
  animation: shake 0.5s;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ==================== 星星装饰 ==================== */
.star-decoration {
  position: fixed;
  font-size: 20px;
  color: rgba(147, 112, 219, 0.3);
  pointer-events: none;
  animation: starFloat 10s infinite ease-in-out;
}

@keyframes starFloat {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0.3;
  }
  50% {
    transform: translate(20px, -30px) rotate(180deg);
    opacity: 0.8;
  }
}

/* ==================== 搜索框聚焦效果 ==================== */
.nav-search:focus-within {
  animation: searchGlow 2s infinite;
}

@keyframes searchGlow {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(147, 112, 219, 0.1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(147, 112, 219, 0.2);
  }
}

/* ==================== 渐入动画 ==================== */
.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

.fade-in-delay-1 {
  animation-delay: 0.1s;
}
.fade-in-delay-2 {
  animation-delay: 0.2s;
}
.fade-in-delay-3 {
  animation-delay: 0.3s;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== 卡片出现动画 ==================== */
.card {
  animation: cardAppear 0.5s ease forwards;
}

@keyframes cardAppear {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card:nth-child(1) {
  animation-delay: 0.05s;
}
.card:nth-child(2) {
  animation-delay: 0.1s;
}
.card:nth-child(3) {
  animation-delay: 0.15s;
}
.card:nth-child(4) {
  animation-delay: 0.2s;
}
.card:nth-child(5) {
  animation-delay: 0.25s;
}
.card:nth-child(6) {
  animation-delay: 0.3s;
}
.card:nth-child(7) {
  animation-delay: 0.35s;
}
.card:nth-child(8) {
  animation-delay: 0.4s;
}
.card:nth-child(9) {
  animation-delay: 0.45s;
}
.card:nth-child(10) {
  animation-delay: 0.5s;
}

/* ==================== 云朵飘动背景 ==================== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  background: radial-gradient(ellipse at 20% 30%, rgba(230, 230, 250, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(216, 191, 216, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 182, 193, 0.2) 0%, transparent 60%);
  animation: cloudDrift 30s linear infinite;
  pointer-events: none;
  z-index: -2;
}

@keyframes cloudDrift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ==================== 边框发光效果 ==================== */
.glow-border {
  position: relative;
}

.glow-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #9370db, #ff69b4, #7b68ee, #ffb6c1);
  border-radius: inherit;
  z-index: -1;
  animation: glowRotate 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
}

.glow-border:hover::before {
  opacity: 1;
}

@keyframes glowRotate {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* ==================== 打字机效果 ==================== */
.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--lavender-dark);
  animation: typing 3s steps(20) 1s forwards, blink 0.7s step-end infinite;
}

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* ==================== 水波纹效果 ==================== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(147, 112, 219, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.ripple:active::after {
  animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 200%;
    height: 200%;
    opacity: 0;
  }
}
