/* 动效层：页面切换、列表进场、卡片浮起、按钮按压
   全部基于 transform / opacity，不触发布局；统一尊重 prefers-reduced-motion。 */

:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --dur-fast: .14s;
  --dur: .22s;
  --dur-slow: .38s;
}

/* ---------------------------- 路由切换 ---------------------------- */
.page-enter-active { animation: page-in var(--dur) var(--ease-out) both; }
.page-leave-active { animation: page-out var(--dur-fast) ease both; }
.page-enter-active > * { animation: page-in var(--dur) var(--ease-out) both; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes page-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-4px); }
}

/* 淡入（弹层、遮罩） */
.fade-enter-active { animation: fade-in var(--dur) var(--ease-out) both; }
.fade-leave-active { animation: fade-out var(--dur-fast) ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* 从下方滑入（抽屉、面板） */
.slide-up-enter-active { animation: slide-up var(--dur) var(--ease-out) both; }
.slide-up-leave-active { animation: slide-up-out var(--dur-fast) ease both; }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide-up-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(10px); }
}

/* ---------------------------- 列表交错进场 ---------------------------- */
/* 用法：<div class="stagger"><div class="stagger-item" :style="{ '--i': i }">…</div></div> */
.stagger-item {
  animation: item-in var(--dur-slow) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 38ms);
}
@keyframes item-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------- 通用微交互 ---------------------------- */
/* 卡片：悬停轻微上浮 */
.lift { transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) ease; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* 统计数字：进场时轻微放大 */
.num-pop { animation: num-pop var(--dur-slow) var(--ease-out) both; }
@keyframes num-pop {
  from { opacity: 0; transform: translateY(4px) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* 进度条：宽度变化平滑过渡 */
.progress > i, .quota-bar i, .mini-bar i { transition: width .5s var(--ease-out); }

/* 按钮：按下回弹 */
.btn:active:not(:disabled), .icon-btn:active:not(:disabled), .sb-item:active { transform: scale(.98); }
.btn, .icon-btn, .sb-item { transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out); }

/* 侧边栏导航：激活指示条滑入 */
.sb-item { position: relative; }
.sb-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: var(--primary);
  transform: translateY(-50%);
  transition: height var(--dur) var(--ease-out);
}
.sb-item.active::before { height: 16px; }

/* 列表行：悬停时左侧轻微内缩反馈 */
.file-row, .home-row, .conv-item { transition: background var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out); }

/* 骨架屏呼吸 */
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.breathe { animation: breathe 1.8s ease-in-out infinite; }

/* 加载指示：三点 */
.dots span {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-bounce 1.1s var(--ease-in-out) infinite;
}
.dots span:nth-child(2) { animation-delay: .16s; }
.dots span:nth-child(3) { animation-delay: .32s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .45; }
  40% { transform: translateY(-3px); opacity: 1; }
}

/* ---------------------------- 主题切换过渡 ---------------------------- */
html.theme-anim, html.theme-anim * {
  transition: background-color .28s ease, border-color .28s ease, color .18s ease !important;
}

/* ---------------------------- 无障碍 ---------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------- 图标容器 ---------------------------- */
/* icon() 输出的是 <svg class="icon">，这里只负责把它居中放进 flex 布局 */
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico > svg { display: block; }
.legacy-host { display: contents; }

/* ---------------------------- 通知抽屉 ---------------------------- */
.notice-root { position: fixed; inset: 0; z-index: 950; display: flex; justify-content: flex-end; }
.notice-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 10, 15, .38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .notice-backdrop { background: rgba(0, 0, 0, .58); }
.notice-drawer {
  position: relative;
  width: 420px;
  max-width: 92vw;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.notice-head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 16px 12px; border-bottom: 1px solid var(--border); }
.notice-head > div { flex: 1; min-width: 0; }
.notice-head h3 { font-size: 15px; font-weight: 600; }
.notice-head p { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.notice-drawer .notice-tabs { padding: 12px 16px 0; margin-bottom: 10px; }
.notice-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 12px; }
.notice-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.drawer-enter-active, .drawer-leave-active { transition: opacity .2s ease; }
.drawer-enter-from, .drawer-leave-to { opacity: 0; }
.drawer-enter-active .notice-drawer { animation: drawer-in .3s cubic-bezier(.16, 1, .3, 1) both; }
.drawer-leave-active .notice-drawer { animation: drawer-out .18s ease both; }
@keyframes drawer-in { from { transform: translateX(26px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drawer-out { from { transform: none; opacity: 1; } to { transform: translateX(18px); opacity: 0; } }

.notice-tab span {
  display: inline-block;
  min-width: 16px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--panel-3, var(--panel-2));
  color: var(--text-3);
  font-size: 10.5px;
  line-height: 16px;
  text-align: center;
}
.notice-tab.active span { background: var(--primary); color: #fff; }
