/* ============================================
   云卡栈 - 高级感UI系统 v7.0
   最终20项深度优化（第81-100项）
   ============================================ */

/* ========== 81. 3D翻转卡片 ========== */
.rotate-card {
  perspective: 1000px;
  cursor: pointer;
}

.rotate-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.rotate-card:hover .rotate-card-inner,
.rotate-card.flipped .rotate-card-inner {
  transform: rotateY(180deg);
}

.rotate-card-front,
.rotate-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rotate-card-back {
  transform: rotateY(180deg);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ========== 82. 鼠标轨迹粒子 ========== */
.trail-particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-400);
  pointer-events: none;
  z-index: 9999;
  animation: trailFade 0.8s ease-out forwards;
}

@keyframes trailFade {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* ========== 83. 卡片悬浮发光 ========== */
.glow-card {
  transition: all 0.4s ease;
  position: relative;
}

.glow-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
}

.glow-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  filter: blur(8px);
}

.glow-card:hover::before {
  opacity: 0.5;
}

/* ========== 84. 输入框标签浮动 ========== */
.floating-input {
  position: relative;
  margin-bottom: 20px;
}

.floating-input input,
.floating-input textarea {
  width: 100%;
  padding: 16px 16px 8px;
  font-size: 16px;
  border: 1.5px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s ease;
}

.floating-input label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: all 0.3s ease;
  background: transparent;
  padding: 0 4px;
}

.floating-input input:focus,
.floating-input input:not(:placeholder-shown),
.floating-input textarea:focus,
.floating-input textarea:not(:placeholder-shown) {
  border-color: var(--primary-400);
  padding-top: 20px;
}

.floating-input input:focus + label,
.floating-input input:not(:placeholder-shown) + label,
.floating-input textarea:focus + label,
.floating-input textarea:not(:placeholder-shown) + label {
  top: 8px;
  transform: translateY(0);
  font-size: 12px;
  color: var(--primary-500);
  font-weight: 500;
}

/* ========== 85. 下拉菜单弹性 ========== */
.elastic-dropdown {
  position: relative;
}

.elastic-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transform-origin: top center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}

.elastic-dropdown.open .elastic-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.elastic-dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 14px;
  color: var(--text-primary);
}

.elastic-dropdown-item:hover {
  background: var(--bg-secondary);
}

/* ========== 86. 列表项右滑操作 ========== */
.swipe-right-card {
  position: relative;
  overflow: hidden;
  touch-action: pan-y;
}

.swipe-right-card-content {
  position: relative;
  background: var(--bg-card);
  z-index: 1;
  transition: transform 0.3s ease;
  padding: 16px;
}

.swipe-right-card-actions {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  transform: translateX(-100%);
}

.swipe-right-card-action {
  width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.swipe-right-card-action.pin { background: var(--primary-500); }
.swipe-right-card-action.share { background: var(--success); }

.swipe-right-card.swiped .swipe-right-card-content {
  transform: translateX(140px);
}

/* ========== 87. 长按预览卡片 ========== */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.preview-overlay.show {
  opacity: 1;
  visibility: visible;
}

.preview-card {
  background: var(--bg-card);
  border-radius: 20px;
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-2xl);
}

.preview-overlay.show .preview-card {
  transform: scale(1);
}

/* ========== 88. 图片主色占位 ========== */
.dominant-color-placeholder {
  background: var(--skeleton-bg);
  position: relative;
  overflow: hidden;
}

.dominant-color-placeholder.loaded {
  background: var(--dominant-color, var(--skeleton-bg));
}

.dominant-color-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.dominant-color-placeholder.loaded img {
  opacity: 1;
}

/* ========== 89. 滚动渐隐效果 ========== */
.scroll-fade {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 90. 固定头部渐变 ========== */
.gradient-header-scroll {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 20px;
  background: transparent;
  transition: all 0.3s ease;
}

.gradient-header-scroll.scrolled {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm);
}

/* ========== 91. 高级步骤条 ========== */
.premium-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}

.premium-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--bg-tertiary);
  z-index: 0;
}

.premium-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.premium-step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-tertiary);
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.premium-step.active .premium-step-circle {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-primary);
  transform: scale(1.1);
}

.premium-step.completed .premium-step-circle {
  background: var(--success);
  border-color: transparent;
  color: white;
}

.premium-step-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

.premium-step.active .premium-step-label {
  color: var(--primary-600);
  font-weight: 600;
}

/* ========== 92. 高级图表动画 ========== */
.chart-animate {
  animation: chartGrow 1s ease-out forwards;
  transform-origin: bottom;
}

@keyframes chartGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.chart-bar {
  transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-line-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: lineDraw 2s ease forwards;
}

@keyframes lineDraw {
  to { stroke-dashoffset: 0; }
}

/* ========== 93. 高级仪表盘 ========== */
.premium-gauge {
  position: relative;
  width: 160px;
  height: 80px;
  overflow: hidden;
}

.premium-gauge-bg {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--bg-tertiary) 0deg 180deg, transparent 180deg 360deg);
}

.premium-gauge-fill {
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(var(--gradient-primary) 0deg, var(--bg-tertiary) 0deg);
  transition: background 1s ease;
}

.premium-gauge-center {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
}

.premium-gauge-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.premium-gauge-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========== 94. 高级进度环 ========== */
.multi-ring-progress {
  position: relative;
  width: 120px;
  height: 120px;
}

.multi-ring-progress svg {
  transform: rotate(-90deg);
}

.multi-ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.multi-ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1s ease;
}

.multi-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ========== 95. 高级搜索框 ========== */
.premium-search {
  position: relative;
}

.premium-search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font-size: 15px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s ease;
}

.premium-search-input:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.premium-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.premium-search-history {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  border-top: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.premium-search-history.show {
  display: block;
  animation: slideDown 0.2s ease;
}

.premium-search-history-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s ease;
}

.premium-search-history-item:hover {
  background: var(--bg-secondary);
}

/* ========== 96. 高级筛选器 ========== */
.filter-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-option {
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.filter-option:hover {
  background: var(--bg-tertiary);
}

.filter-option.active {
  background: var(--primary-50);
  color: var(--primary-600);
  border-color: var(--primary-300);
  font-weight: 500;
}

/* ========== 97. 数字翻牌动画 ========== */
.flip-number {
  display: inline-flex;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.flip-number-digit {
  position: relative;
  width: 28px;
  height: 40px;
  background: var(--gray-900);
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.flip-number-digit::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0,0,0,0.3);
}

.flip-number-digit.changing {
  animation: digitFlip 0.5s ease;
}

@keyframes digitFlip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

/* ========== 98. 渐变边框流动 ========== */
.flowing-border {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  z-index: 0;
}

.flowing-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-400), var(--primary-600), #f093fb, var(--primary-400));
  background-size: 300% 100%;
  animation: borderFlow 3s linear infinite;
  z-index: -1;
}

@keyframes borderFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ========== 99. 按钮按下凹陷 ========== */
.pressed-btn {
  transition: all 0.1s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pressed-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* ========== 100. 页面预加载 ========== */
.prefetch-link {
  position: relative;
}

/* 响应式 */
@media (max-width: 768px) {
  .premium-gauge {
    width: 120px;
    height: 60px;
  }
  
  .premium-gauge-bg,
  .premium-gauge-fill {
    width: 120px;
    height: 120px;
  }
  
  .premium-gauge-center {
    top: 15px;
    left: 15px;
    width: 90px;
    height: 90px;
  }
  
  .flip-number-digit {
    width: 22px;
    height: 32px;
    font-size: 16px;
  }
}
