/* ============================================
   云卡栈 - 高级感UI系统 v5.0
   新增20项深度优化（第41-60项）
   ============================================ */

/* ========== 41. 动态渐变背景 ========== */
.animated-gradient-bg {
  background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #4facfe);
  background-size: 400% 400%;
  animation: gradientFlow 15s ease infinite;
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ========== 42. 极光效果背景 ========== */
.aurora-bg {
  position: relative;
  overflow: hidden;
  background: #0f0c29;
}

.aurora-bg::before,
.aurora-bg::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: auroraMove 20s ease-in-out infinite;
}

.aurora-bg::before {
  background: radial-gradient(circle, #667eea, transparent);
  top: -200px;
  left: -100px;
}

.aurora-bg::after {
  background: radial-gradient(circle, #f093fb, transparent);
  bottom: -200px;
  right: -100px;
  animation-delay: -10s;
}

@keyframes auroraMove {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(100px, -50px) scale(1.2); }
  66% { transform: translate(-50px, 100px) scale(0.8); }
}

/* ========== 43. 粒子汇聚logo ========== */
.particle-logo {
  position: relative;
  width: 120px;
  height: 120px;
}

.particle-logo canvas {
  position: absolute;
  inset: 0;
}

/* ========== 44. 3D卡片翻转 ========== */
.flip-card {
  perspective: 1000px;
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* ========== 45. 光影追踪阴影 ========== */
.light-shadow-card {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  will-change: transform;
}

/* ========== 46. 列表交错入场 ========== */
.stagger-list > * {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerIn 0.5s ease forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-list > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-list > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-list > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-list > *:nth-child(10) { animation-delay: 0.5s; }

@keyframes staggerIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 47. 进度条流光 ========== */
.progress-shimmer {
  position: relative;
  overflow: hidden;
}

.progress-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  100% { left: 100%; }
}

/* ========== 48. Tab弹性切换 ========== */
.tab-container {
  position: relative;
  display: flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  padding: 4px;
}

.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-primary);
}

.tab-item {
  flex: 1;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
}

.tab-item.active {
  color: white;
  font-weight: 600;
}

/* ========== 49. 数字千分位 ========== */
.number-format {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ========== 50. 高级Toast通知 ========== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.toast {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xl);
  animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 280px;
}

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100px); }
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: rgba(34, 197, 94, 0.15); }
.toast.error .toast-icon { background: rgba(239, 68, 68, 0.15); }
.toast.warning .toast-icon { background: rgba(245, 158, 11, 0.15); }
.toast.info .toast-icon { background: rgba(59, 130, 246, 0.15); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========== 51. 品牌Loading ========== */
.brand-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px;
}

.brand-loading-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: brandPulse 1.5s ease-in-out infinite;
}

@keyframes brandPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(102, 126, 234, 0); }
}

.brand-loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  animation: loadingText 1.5s ease-in-out infinite;
}

@keyframes loadingText {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ========== 52. 高级开关组件 ========== */
.premium-switch {
  position: relative;
  width: 52px;
  height: 30px;
  background: var(--bg-tertiary);
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.premium-switch.active {
  background: var(--gradient-primary);
}

.premium-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.premium-switch.active .premium-switch-knob {
  left: 25px;
  transform: scale(0.9);
}

.premium-switch:active .premium-switch-knob {
  transform: scale(0.85);
}

/* ========== 53. 图片渐进加载 ========== */
.progressive-image {
  position: relative;
  overflow: hidden;
  background: var(--skeleton-bg);
}

.progressive-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px);
  transition: filter 0.6s ease, opacity 0.6s ease;
  opacity: 0.8;
}

.progressive-image.loaded img {
  filter: blur(0);
  opacity: 1;
}

/* ========== 54. 滚动进度指示器 ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-primary);
  z-index: 9999;
  transition: width 0.1s ease;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* ========== 55. 返回顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-primary-lg);
  opacity: 0;
  transform: translateY(20px) scale(0.8);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.back-to-top:active {
  transform: scale(0.9);
}

/* ========== 56. 深色模式自动切换 ========== */
.auto-dark {
  transition: background 0.5s ease, color 0.5s ease;
}

/* ========== 57. 高级弹窗 ========== */
.premium-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.premium-modal {
  background: var(--bg-card);
  border-radius: 24px;
  width: 100%;
  max-width: 400px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border-light);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.premium-modal-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.premium-modal-title {
  font-size: 18px;
  font-weight: 700;
}

.premium-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-modal-close:hover {
  background: var(--bg-tertiary);
  transform: rotate(90deg);
}

.premium-modal-body {
  padding: 20px 24px;
}

.premium-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
}

/* ========== 58. 空状态微动效 ========== */
.empty-state-animated .empty-state-icon {
  animation: emptyBreathe 3s ease-in-out infinite;
}

@keyframes emptyBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

/* ========== 59. 光晕呼吸按钮 ========== */
.glow-btn {
  position: relative;
  overflow: visible;
}

.glow-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: var(--gradient-primary);
  filter: blur(12px);
  opacity: 0.6;
  z-index: -1;
  animation: glowBreathe 2s ease-in-out infinite;
}

@keyframes glowBreathe {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

/* ========== 60. 离线状态提示 ========== */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
}

.offline-banner.show {
  transform: translateY(0);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .toast-container {
    left: 16px;
    right: 16px;
    max-width: none;
  }
  
  .back-to-top {
    bottom: 70px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}
