/* ============================================================
   企管法规部 · 周工作记录反馈系统
   motion.css —— 质感与动效层（在 app.css 之后加载，仅做覆盖与增强）
   风格参考：克制、留白、纸感底色、衬线数字、轻微视差与光标响应
   原则：位移不超过 4px、透明度不低于 .04、时长 300–600ms
   ============================================================ */

/* ---------- 一、色板与字体：暖纸底 + 墨色 ---------- */
:root {
  --bg: #F1F0EB;
  --surface: #FFFFFF;
  --surface-2: #FBFAF6;
  --muted: #EFEDE6;
  --border: #E6E3DA;
  --border-strong: #D2CEC2;

  --text: #17191C;
  --text-2: #55585D;
  --text-3: #8A8E94;

  --primary: #1D4E7A;
  --primary-hover: #173F63;
  --primary-soft: #E9F0F7;

  --r-sm: 5px;
  --r: 9px;
  --r-lg: 13px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.22, .9, .28, 1.06);
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
}

html, body { background: var(--bg); }

/* 纸感底纹：极淡的暖灰噪点，仅在桌面端 */
@media (pointer: fine) {
  body::before {
    content: "";
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    opacity: .5;
    background-image:
      radial-gradient(circle at 18% 12%, rgba(29, 78, 122, .045), transparent 42%),
      radial-gradient(circle at 82% 78%, rgba(200, 16, 46, .028), transparent 46%);
  }
  .shell, .login-wrap { position: relative; z-index: 1; }
}

/* ---------- 二、词条级的入场动画 ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sweep {
  from { transform: translateX(-130%) skewX(-14deg); }
  to   { transform: translateX(230%) skewX(-14deg); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@keyframes driftA {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(46px, -30px, 0) scale(1.14); }
}
@keyframes driftB {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50%      { transform: translate3d(-52px, 34px, 0) scale(.92); }
}
@keyframes barSlide {
  0%   { transform: translateX(-100%) scaleX(.4); }
  55%  { transform: translateX(30%) scaleX(.6); }
  100% { transform: translateX(130%) scaleX(.35); }
}

.rise {
  animation: riseIn .62s var(--ease) both;
  animation-delay: var(--d, 0ms);
}

/* ---------- 三、卡片：微倾斜 + 光标高光 ---------- */
.card, .metric, .login-card, .summary-box, .day-focus {
  transition: box-shadow .34s var(--ease), border-color .34s var(--ease);
}

.card { position: relative; }

/* 极淡的双层阴影：让白卡在暖纸上浮起一点，但不做"堆叠阴影" */
.card {
  box-shadow: 0 1px 2px rgba(23, 25, 28, .028), 0 12px 30px -22px rgba(23, 25, 28, .34);
}
.metric, .weekbar {
  box-shadow: 0 1px 2px rgba(23, 25, 28, .025);
}

.tilt {
  transform:
    perspective(1100px)
    rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
    translateY(var(--ty, 0px));
  transform-style: preserve-3d;
  transition: transform .55s var(--ease), box-shadow .34s var(--ease), border-color .34s var(--ease);
  will-change: transform;
}
.tilt.tilting { transition: transform .1s linear, box-shadow .34s var(--ease); }

.tilt.hovered { box-shadow: 0 2px 3px rgba(23, 25, 28, .04), 0 22px 44px -28px rgba(23, 25, 28, .34); border-color: var(--border-strong); }

/* 光标位置的冷调柔光（在暖白卡上是极淡的蓝色反光，不是白雾） */
@media (pointer: fine) {
  .tilt::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    pointer-events: none; opacity: 0; transition: opacity .34s ease;
    background: radial-gradient(
      260px circle at var(--mx, 50%) var(--my, 50%),
      rgba(29, 78, 122, .062), rgba(29, 78, 122, 0) 64%);
  }
  .tilt.hovered::after { opacity: 1; }
}

/* 指标卡：抬升更明显一点，作为可点击暗示 */
.metric.tilt.hovered { --ty: -3px; }
.metric-value {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.01em;
  font-size: 26px;
}

/* ---------- 四、按钮：扫光 + 按下回弹 ---------- */
.btn { transition: background .18s, border-color .18s, color .18s, opacity .18s, transform .18s var(--ease); }
.btn:active { transform: translateY(.5px) scale(.995); }

.btn-primary, .btn-accent {
  position: relative; overflow: hidden; isolation: isolate;
}
.btn-primary::after, .btn-accent::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 0; width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .34), transparent);
  opacity: 0; pointer-events: none;
}
.btn-primary:hover::after, .btn-accent:hover::after {
  opacity: 1; animation: sweep .78s ease-out;
}

/* 图标按钮：轻微放大 */
.icon-btn { transition: background .15s, color .15s, transform .22s var(--ease); }
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: scale(.94); }

/* ---------- 五、侧栏：滑动激活指示条 ---------- */
.nav-item { position: relative; overflow: hidden; transition: background .18s, color .18s, padding-left .18s var(--ease); }
.nav-item::before {
  content: ""; position: absolute; left: 3px; top: 50%; width: 2px; height: 16px;
  margin-top: -8px; border-radius: 2px; background: var(--primary);
  transform: scaleY(0); transform-origin: center;
  transition: transform .28s var(--ease);
}
.nav-item.active::before { transform: scaleY(1); }
.nav-item.active { padding-left: 14px; }
.nav-item:hover .nav-ico { opacity: 1; }
.nav-ico { transition: opacity .18s, transform .28s var(--ease); }
.nav-item:hover .nav-ico { transform: translateY(-.5px); }

.nav-badge { animation: pop .3s var(--ease-spring) both; }

/* 顶栏与侧栏：毛玻璃 */
.topbar {
  background: rgba(255, 255, 255, .84);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  transition: box-shadow .3s ease;
}
.topbar.scrolled { box-shadow: 0 8px 24px -18px rgba(23, 25, 28, .5); }
.sidebar { background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); }

/* 顶栏标题：衬线大字重，克制的编辑部气质 */
.topbar-title { font-size: 17px; font-weight: 600; letter-spacing: .01em; }

/* ---------- 六、页面切换转场 ---------- */
.page-enter { animation: fadeIn .26s ease-out both; }

/* ---------- 七、顶部细进度条 ---------- */
#route-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300;
  pointer-events: none; opacity: 0; transition: opacity .25s ease;
}
#route-bar.on { opacity: 1; }
#route-bar i {
  display: block; height: 100%; width: 42%;
  background: linear-gradient(90deg, transparent, var(--primary) 30%, var(--accent) 78%, transparent);
  animation: barSlide 1.15s ease-in-out infinite;
}

/* ---------- 八、表格与列表：行级微反馈 ---------- */
table.tbl tbody tr { transition: background .16s ease, box-shadow .16s ease; }
@media (pointer: fine) {
  table.tbl tbody tr:hover { box-shadow: inset 2px 0 0 var(--primary); }
}
.list-item { transition: background .16s ease; }
.list-item:hover { background: rgba(29, 78, 122, .022); }

/* 日历格：悬停抬升 */
.cal-cell { transition: border-color .18s, background .18s, transform .22s var(--ease), box-shadow .22s; }
.cal-cell:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -12px rgba(23, 25, 28, .5); }

/* 分段按钮与标签页：滑块感 */
.seg button { transition: background .18s, color .18s, transform .18s var(--ease); }
.seg button:active { transform: scale(.97); }
.tab { transition: color .18s, border-color .3s var(--ease); }

/* 开关 */
.switch-track::after { transition: transform .26s var(--ease-spring); }

/* ---------- 九、弹窗与提示：弹性入场 ---------- */
.modal-mask { animation: fade .22s ease-out; backdrop-filter: blur(3px); }
.modal { animation: popIn .34s var(--ease-spring) both; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.975); }
  to   { opacity: 1; transform: none; }
}
.toast { animation: toastIn .32s var(--ease-spring) both; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.notif-panel { animation: popIn .26s var(--ease) both; }

/* ---------- 十、登录页：纸感 + 漂浮光晕 + 窗口视差 ---------- */
.login-wrap {
  position: relative; min-height: 100vh; overflow: hidden;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login-bg i {
  position: absolute; display: block; border-radius: 50%; filter: blur(46px);
  will-change: transform;
}
.login-bg .o1 {
  width: 520px; height: 520px; left: -8%; top: -14%;
  background: radial-gradient(circle, rgba(29, 78, 122, .16), transparent 68%);
  animation: driftA 22s ease-in-out infinite;
}
.login-bg .o2 {
  width: 460px; height: 460px; right: -6%; bottom: -18%;
  background: radial-gradient(circle, rgba(200, 16, 46, .10), transparent 68%);
  animation: driftB 26s ease-in-out infinite;
}
.login-bg .o3 {
  width: 300px; height: 300px; right: 22%; top: 6%;
  background: radial-gradient(circle, rgba(160, 150, 120, .14), transparent 70%);
  animation: driftA 31s ease-in-out infinite reverse;
}
/* 细网格，向下淡出 */
.login-bg .mesh {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(23, 25, 28, .052) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 25, 28, .052) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 82% 66% at 50% 40%, #000 18%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 82% 66% at 50% 40%, #000 18%, transparent 76%);
}

.login-stage {
  position: relative; width: 100%; max-width: 1080px;
  display: flex; align-items: center; justify-content: center; gap: 64px;
}

.login-card {
  width: 100%; max-width: 396px; flex: none;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 34px 32px 26px;
  box-shadow: 0 30px 70px -46px rgba(23, 25, 28, .55);
  animation: riseIn .7s var(--ease) both;
}
.login-brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 17px; font-weight: 600; letter-spacing: .01em;
}
.login-title {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: 28px; line-height: 1.24; font-weight: 700;
  letter-spacing: -.005em; color: var(--text);
}
.login-title em {
  font-style: normal; color: var(--primary);
}
.login-desc {
  margin-top: 8px; font-size: 13px; color: var(--text-3); line-height: 1.65;
}
.login-form { margin-top: 24px; display: flex; flex-direction: column; gap: 13px; }
.login-form .input { transition: border-color .18s, box-shadow .26s var(--ease), background .18s; }
.login-form .btn-lg { margin-top: 6px; }
.login-form .input:focus {
  box-shadow: 0 0 0 4px rgba(29, 78, 122, .10);
  background: #fff;
}
.login-foot { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.6; }

/* 右侧窗口预览：真实 UI 骨架 + 鼠标视差 */
.login-preview {
  flex: 1; min-width: 0; max-width: 520px;
  animation: riseIn .85s .12s var(--ease) both;
}
.win {
  position: relative; border-radius: 13px; overflow: hidden;
  background: #fff; border: 1px solid rgba(23, 25, 28, .10);
  box-shadow:
    0 2px 4px rgba(23, 25, 28, .05),
    0 34px 80px -40px rgba(23, 25, 28, .45);
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px));
  transition: transform .6s var(--ease), box-shadow .6s var(--ease);
  will-change: transform;
}
.win.tilting { transition: transform .12s linear, box-shadow .6s var(--ease); }
.win-bar {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  background: #F3F2ED; border-bottom: 1px solid rgba(23, 25, 28, .07);
}
.win-bar i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.win-bar i:nth-child(1) { background: #E8675A; }
.win-bar i:nth-child(2) { background: #E7B44A; }
.win-bar i:nth-child(3) { background: #57B96B; }
.win-bar span { margin-left: 8px; font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.win-body { display: flex; min-height: 318px; }
.win-side {
  width: 96px; flex: none; background: #FCFBF8;
  border-right: 1px solid rgba(23, 25, 28, .06); padding: 12px 9px;
  display: flex; flex-direction: column; gap: 9px;
}
.win-side b { display: block; height: 7px; border-radius: 3px; background: rgba(23, 25, 28, .09); }
.win-side b:first-child { width: 62%; background: var(--primary); opacity: .55; margin-bottom: 4px; }
.win-side b.on { background: rgba(29, 78, 122, .28); }
.win-side b:nth-child(3) { width: 82%; }
.win-side b:nth-child(4) { width: 70%; }
.win-side b:nth-child(5) { width: 88%; }
.win-main { flex: 1; min-width: 0; padding: 16px 16px 18px; background: #fff; }
.win-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.win-h b { height: 9px; width: 68px; border-radius: 4px; background: rgba(23, 25, 28, .16); }
.win-h i {
  height: 9px; width: 42px; border-radius: 4px; background: rgba(23, 25, 28, .07);
}
.win-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.win-metrics div {
  border: 1px solid rgba(23, 25, 28, .07); border-radius: 8px; padding: 9px 10px 10px;
  background: #FCFBF8;
}
.win-metrics em {
  display: block; font-style: normal; font-family: var(--serif);
  font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.1;
}
.win-metrics span { display: block; margin-top: 5px; height: 5px; width: 62%; border-radius: 3px; background: rgba(23, 25, 28, .09); }
.win-rows { display: flex; flex-direction: column; }
.win-rows div {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0; border-bottom: 1px solid rgba(23, 25, 28, .055);
}
.win-rows div:last-child { border-bottom: none; }
.win-rows s {
  width: 13px; height: 13px; border-radius: 4px; flex: none; text-decoration: none;
  border: 1px solid rgba(23, 25, 28, .16); background: #fff;
}
.win-rows s.done { background: rgba(27, 138, 90, .18); border-color: rgba(27, 138, 90, .38); }
.win-rows u {
  flex: 1; height: 6px; border-radius: 3px; text-decoration: none;
  background: rgba(23, 25, 28, .10);
}
.win-rows u.short { flex: 0 0 46px; background: rgba(23, 25, 28, .06); }
.win-rows div.acc u:first-of-type { background: rgba(200, 16, 46, .22); }

/* 窗口下方的一行说明 */
.login-tip {
  margin-top: 16px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-3);
}
.login-tip::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex: none;
}

/* ---------- 十一、骨架屏与空状态 ---------- */
.skeleton { animation: shimmer 1.5s ease-in-out infinite; }
.empty { transition: border-color .3s, background .3s; }
.empty:hover { border-color: var(--border-strong); }

/* ---------- 十二、响应式：窄屏收敛动效 ---------- */
@media (max-width: 1080px) {
  .login-preview { display: none; }
  .login-stage { max-width: 420px; gap: 0; }
}
@media (max-width: 820px) {
  .login-wrap { padding: 20px 18px; }
  .login-card { padding: 28px 22px 22px; border-radius: 16px; }
  .login-title { font-size: 25px; }
  .login-bg .mesh { display: none; }

  /* 手机端取消倾斜与光晕，改用轻量按压反馈 */
  .tilt { transform: none !important; }
  .card.hovered { box-shadow: none; }
  .nav-item.active { padding-left: 10px; }
  .page-enter { animation: fadeIn .22s ease-out both; }
  .metric-value { font-size: 23px; }
}

/* ---------- 十三、无障碍：尊重减弱动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  #route-bar { display: none !important; }
  .login-bg i { animation: none !important; }
}

/* ---------- 十四、打印 ---------- */
@media print {
  body::before, #route-bar, .login-bg { display: none !important; }
  .tilt { transform: none !important; }
}
