/* ==========================================================================
   live.css — 全站微交互层（纯增强，不改风格）
   目标：让页面有「活人感」——按钮有按压反馈、卡片有悬浮弹性、
   数字会跳动、弹窗会弹入、加载过程有 AI 感知。
   本文件必须最后加载；所有规则均为增强，不改变布局/配色。
   ========================================================================== */

/* ---------- 1. 无障碍：用户系统关闭动效时，全部静音 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 2. 全局按钮按压反馈（按住缩小，松开弹回） ---------- */
button:not(:disabled):active,
.btn:not(:disabled):active,
.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active,
.btn-add:not(:disabled):active,
.btn-ghost:not(:disabled):active,
.mk-tier-btn:not(:disabled):active,
.mk-hero-cta:not(:disabled):active,
.tier-btn:not(:disabled):active,
.cycle-btn:not(:disabled):active,
.method-opt:not(:disabled):active,
.sb-arrow:not(:disabled):active,
.nav-hamburger:active,
.hamburger:active {
  animation: live-press .18s cubic-bezier(.34, 1.56, .64, 1) forwards;
  will-change: transform;
}
@keyframes live-press {
  0%   { transform: scale(1); }
  45%  { transform: scale(.94); }
  100% { transform: scale(.94); }
}

/* 悬停微升（仅主操作按钮，避免全站乱飞） */
.btn-primary:not(:disabled):hover,
.mk-tier-btn.paid:not(:disabled):hover,
.mk-hero-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s ease, opacity .15s ease, background-color .15s ease;
}

/* ---------- 3. 卡片悬浮弹性上浮 ---------- */
.stat-card,
.mk-tier,
.mk-drop-item,
.mk-drop-tier,
.mk-mock,
.plan-card,
.tier-card,
.pay-order-card,
.pay-method-option,
.result-card {
  transition:
    transform .24s cubic-bezier(.34, 1.56, .64, 1),
    box-shadow .24s ease,
    border-color .24s ease;
}
.stat-card:hover,
.mk-drop-item:hover,
.mk-drop-tier:hover,
.mk-mock:hover,
.plan-card:hover,
.tier-card:hover,
.pay-order-card:hover,
.pay-method-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .10);
}

/* 看板指标卡悬浮时数字轻微放大，强化「活数据」感 */
.stat-card:hover .stat-value { transform: scale(1.04); }
.stat-value { display: inline-block; transition: transform .24s cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- 4. 表格行悬浮高亮（工具页结果区） ---------- */
.tbl-wrap table tbody tr,
.table-wrap table tbody tr,
.table-scroll table tbody tr,
.grid-table tbody tr {
  transition: background-color .15s ease, transform .15s ease;
}
.tbl-wrap table tbody tr:hover,
.table-wrap table tbody tr:hover,
.table-scroll table tbody tr:hover,
.grid-table tbody tr:hover {
  background-color: var(--blue-bg, #E6F2F5) !important;
}
.tbl-wrap table tbody tr:hover td:first-child,
.table-wrap table tbody tr:hover td:first-child,
.table-scroll table tbody tr:hover td:first-child,
.grid-table tbody tr:hover td:first-child {
  padding-left: 14px;
  transition: padding-left .18s ease;
}

/* ---------- 5. 弹窗弹入 + 毛玻璃 ---------- */
.modal-overlay {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-overlay .modal {
  transform: scale(.92) translateY(16px);
  transition: transform .26s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ---------- 6. Toast 弹出弹性（工具页各自实现类名统一增强） ---------- */
.toast.on,
.toast.show,
.live-toast {
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .25s ease !important;
  transform-origin: bottom center;
}

/* portal.js 的 toast 走 class 方案 */
.live-toast {
  position: fixed; left: 50%; bottom: 34px;
  transform: translateX(-50%) translateY(14px);
  background: #1F2B3A; color: #fff; font-size: 12.5px;
  padding: 9px 17px; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(31, 43, 58, .14);
  opacity: 0; pointer-events: none; z-index: 999;
  max-width: 86vw; line-height: 1.5;
}
.live-toast.in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.live-toast .live-toast-ico { margin-right: 6px; }

/* ---------- 7. AI 徽章呼吸灯（Beta / AI 驱动） ---------- */
.pill.beta,
.ai-badge,
.hero-badge {
  animation: live-breathe 2.6s ease-in-out infinite;
}
@keyframes live-breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 153, 0, .0); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 153, 0, .18); }
}

/* ---------- 8. 数字滚动（JS 驱动） ---------- */
.num-roll {
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

/* ---------- 9. 计算中 busy 态：光扫 + 文案脉冲 ---------- */
.is-calculating {
  position: relative;
  overflow: hidden;
  pointer-events: none;
  opacity: .96;
}
.is-calculating .live-dots {
  display: inline-block;
  width: 1em;
  text-align: left;
  overflow: hidden;
  vertical-align: bottom;
  animation: live-dots 1.2s steps(4, end) infinite;
}
@keyframes live-dots {
  0%   { width: 0; }
  100% { width: 1em; }
}
.is-calculating::after {
  content: '';
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38), transparent);
  animation: live-shine 1.15s ease-in-out infinite;
}
@keyframes live-shine {
  0%   { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

/* ---------- 10. 入场浮现（JS 加 .in；JS 未加载时自动可见） ---------- */
.js-ready .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
.js-ready .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- 11. 首页 Hero 智能看板：整卡浮现 + 数据行呼吸 ---------- */
.mk-mock-row {
  transition: background-color .2s ease;
}
.mk-mock-row:hover { background-color: rgba(138, 100, 32, .07); }

/* mock 看板整体浮现（配合下方数据行呼吸，营造「实时在看板」感） */
.mk-mock .mk-mock-bar {
  animation: live-rise .8s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes live-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* mock 行尾部的圆点像「活数据」一样呼吸 */
.mk-mock-dots i {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 4px;
  animation: live-dot 2.2s ease-in-out infinite;
}
.mk-mock-dots i:nth-child(2) { animation-delay: .25s; }
.mk-mock-dots i:nth-child(3) { animation-delay: .5s; }
@keyframes live-dot {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* ---------- 12. 趋势指示器（涨跌/估算）进入弹跳 ---------- */
.stat-trend {
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.stat-trend:hover { transform: scale(1.08); }

/* ---------- 13. 进度条过渡增强 ---------- */
.progress-bar > div,
[class*="progress"] > div {
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- 14. 关闭按钮 hover 旋转 ---------- */
.modal-close:hover {
  transform: rotate(90deg);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
