/* ============================================================
   交互动效层（2026-11-27）
   独立文件：想恢复原样，删掉 index.html 里对 effects.css / effects.js 的引用即可
   开关：浏览器控制台执行 localStorage.hy_fx='0' 后刷新即关闭
   ============================================================ */

/* ---------- 1. 侧边栏玻璃胶囊（当前菜单项） ---------- */
body.fx-on #menu { position: relative; }

body.fx-on #menu .fx-cap {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 0;
  height: 40px;
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  will-change: transform, opacity;
  background:
    linear-gradient(180deg, rgba(148,163,184,.20), rgba(51,65,85,.26)),
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  border: 1px solid rgba(255,255,255,.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    inset 0 -1px 0 rgba(255,255,255,.08),
    0 10px 22px -8px rgba(0,0,0,.55);
  transition: opacity .22s ease;
}

/* 胶囊顶部那道细高光 */
body.fx-on #menu .fx-cap::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: -1px;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
}

body.fx-on .menu-btn { position: relative; z-index: 1; }
body.fx-on .menu-btn.sel { background: transparent; }
body.fx-on .menu-btn:hover:not(.sel) { background: rgba(255,255,255,.05); }

/* ---------- 2. Border Beam 边缘流光（主操作按钮） ---------- */
@property --fx-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

body.fx-on .btn-beam {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

body.fx-on .btn-beam::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: conic-gradient(from var(--fx-a),
    rgba(255,255,255,0) 0deg,
    rgba(255,255,255,.10) 150deg,
    #7dd3fc 236deg,
    #ffffff 268deg,
    #e9d5ff 292deg,
    rgba(255,255,255,.10) 330deg,
    rgba(255,255,255,0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: fxBeam 2.8s linear infinite;
  pointer-events: none;
}

@keyframes fxBeam { to { --fx-a: 360deg; } }

/* 灵动：呼吸辉光（box-shadow 动画）——与 hover/active 的 transform 互不冲突 */
body.fx-on .btn-beam {
  animation: fxBreath 3.2s ease-in-out infinite;
  transition: transform .18s cubic-bezier(.34,1.4,.64,1);
}

@keyframes fxBreath {
  0%, 100% { box-shadow: 0 0 0 1px rgba(125,211,252,.30), 0 0 14px -3px rgba(125,211,252,.45); }
  50%      { box-shadow: 0 0 0 1px rgba(196,181,253,.55), 0 0 22px 0px rgba(125,211,252,.80); }
}

/* 磁性跟随（老板 11-27：鼠标放哪，按钮跳到哪）——位移由 JS 实时写入 inline transform，
   这里只保留呼吸辉光；按压反馈仍由 ::after 白色闪光提供 */
body.fx-on .btn-beam { will-change: transform; }

/* 白色闪光（点按瞬间） */
body.fx-on .btn-beam::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,.92);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity .14s;
}
body.fx-on .btn-beam:hover::after { opacity: .16; }
body.fx-on .btn-beam:active::after { opacity: .32; }

/* 按钮内视频背景：铺满压暗成半透明蓝底，粒子若隐若现；加载失败自动隐藏退回纯色 */
body.fx-on .btn-beam .fx-btn-video {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 190%;
  height: 190%;
  min-width: 190%;
  min-height: 190%;
  object-fit: cover;
  opacity: .38;
  filter: saturate(1.55) brightness(.7) hue-rotate(6deg);
  z-index: 0;
  pointer-events: none;
}
body.fx-on .btn-beam .fx-btn-video.fail,
body.fx-on .btn-beam .fx-btn-video.still { display: none; }
body.fx-on .btn-beam .fx-btn-label { position: relative; z-index: 1; }

/* 跟随鼠标的亮斑：小光核跟着鼠标走，只照亮鼠标所在那一块（老板 11-27：按钮跟着鼠标走、到哪亮哪） */
body.fx-on .btn-beam .fx-btn-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transform: translate(0, 0);
  transition: opacity .16s ease;
  background: radial-gradient(circle,
    rgba(255,255,255,.95) 0%,
    rgba(199,231,255,.85) 26%,
    rgba(125,211,252,.5) 52%,
    rgba(56,189,248,.16) 72%,
    rgba(56,189,248,0) 86%);
  mix-blend-mode: screen;
}

/* ---------- 3. 磨砂玻璃 KPI 卡片 ---------- */
body.fx-on .cards { perspective: 900px; }

body.fx-on .card.fx-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,255,255,.62));
  backdrop-filter: blur(14px) saturate(165%);
  -webkit-backdrop-filter: blur(14px) saturate(165%);
  border: 1px solid rgba(255,255,255,.85);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 1px 2px rgba(15,23,42,.06),
    0 10px 26px -16px rgba(15,23,42,.30);
  transform-style: preserve-3d;
  transition: transform .22s cubic-bezier(.22,.9,.3,1), box-shadow .24s ease;
  will-change: transform;
}

/* 跟随光标的柔光斑 */
body.fx-on .card.fx-card .fx-glow {
  position: absolute;
  left: 0;
  top: 0;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(96,165,250,.30) 0%,
    rgba(167,139,250,.16) 40%,
    rgba(167,139,250,0) 72%);
  transition: opacity .26s ease;
  z-index: 0;
}

body.fx-on .card.fx-card:hover .fx-glow { opacity: 1; }

/* 边框靠近光标处局部提亮 */
body.fx-on .card.fx-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(120px circle at var(--fx-mx, 50%) var(--fx-my, 50%),
    rgba(59,130,246,.95), rgba(139,92,246,.55) 40%, rgba(59,130,246,0) 68%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .24s ease;
  pointer-events: none;
  z-index: 2;
}

body.fx-on .card.fx-card:hover::after { opacity: 1; }

/* 内容压在光斑之上 */
body.fx-on .card.fx-card .t,
body.fx-on .card.fx-card .v { position: relative; z-index: 1; }

body.fx-on .card.fx-card:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 2px 6px rgba(15,23,42,.07),
    0 18px 40px -20px rgba(30,64,175,.45);
}

/* ---------- 4. 原位放大详情视图（FLIP） ---------- */
.fx-zoom {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15,23,42,.52);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity .22s ease;
}

.fx-zoom.on { opacity: 1; }

.fx-zoom img {
  position: fixed;
  left: 50%;
  top: 50%;
  max-width: none;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 30px 70px -14px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.14);
  will-change: transform;
}

.fx-zoom .fx-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  line-height: 36px;
  text-align: center;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  transition: background .18s, transform .18s;
  user-select: none;
}

.fx-zoom .fx-close:hover { background: rgba(255,255,255,.26); transform: rotate(90deg); }

.fx-zoom .fx-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  text-align: center;
  color: rgba(255,255,255,.62);
  font-size: 12px;
  letter-spacing: .5px;
  pointer-events: none;
}

/* 台账缩略图可点击的提示 */
body.fx-on .cell-img { cursor: zoom-in; }
body.fx-on .cell-img:hover { outline: 2px solid rgba(37,99,235,.55); outline-offset: 1px; }

/* 系统开启"减少动画"时，全部退化为不动的静态效果 */
@media (prefers-reduced-motion: reduce) {
  body.fx-on .btn-beam, body.fx-on .btn-beam::before { animation: none; }
  body.fx-on .card.fx-card { transition: none; }
  .fx-zoom { transition: none; }
}
