/* ============================================================
   站点横幅 & 通知弹窗系统（notify）
   - 全部色值走全局 CSS 变量（由 /css/data/theme-default.json 注入），无硬编码色值
   - 动画仅使用 transform / opacity（合成层），入场自右下角向左滑入
   - 缓动曲线 cubic-bezier(0.25, 1.1, 0.5, 1)，时长 0.45s
   ============================================================ */

/* 本模块专用动画令牌：在 .notify-stack 作用域内局部声明，
   与全局 --ease-spring（汉堡图标用的 1.15 曲线）隔离，确保通知严格走 1.1 规格。 */
.notify-stack,
.notify-banner {
  --ease-spring: cubic-bezier(0.25, 1.1, 0.5, 1);
  --dur-spring: 0.45s;
}

/* ===== 5 套预设主题色：全部由全局主题变量派生 ===== */
.notify-theme-red {
  --notify-accent: var(--orange);
  --notify-accent-soft: var(--orange-glow);
  --notify-accent-text: var(--btn-text);
}
.notify-theme-green {
  --notify-accent: var(--blue-light);
  --notify-accent-soft: var(--accent-glow);
  --notify-accent-text: var(--btn-text);
}
.notify-theme-blue {
  --notify-accent: var(--blue);
  --notify-accent-soft: var(--accent-glow);
  --notify-accent-text: var(--btn-text);
}
.notify-theme-yellow {
  --notify-accent: var(--gold);
  --notify-accent-soft: var(--orange-glow);
  --notify-accent-text: var(--bg);
}
.notify-theme-purple {
  --notify-accent: var(--blue-light);
  --notify-accent-soft: var(--accent-glow-strong);
  --notify-accent-text: var(--btn-text);
}

/* ===== 顶部横幅 ===== */
.notify-banner {
  position: relative;
  z-index: 40;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 44px 10px 16px;
  background: var(--menu-bg);
  border-bottom: 1px solid var(--notify-accent, var(--blue));
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translate3d(0, -8px, 0);
  opacity: 0;
  transition:
    transform var(--dur-spring) cubic-bezier(0.25, 1.1, 0.5, 1),
    opacity   var(--dur-spring) cubic-bezier(0.25, 1.1, 0.5, 1);
}
.notify-banner.is-in {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}
.notify-banner-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--notify-accent, var(--blue));
  box-shadow: 0 0 0 4px var(--notify-accent-soft, var(--accent-glow));
}
.notify-banner-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.notify-banner-text strong { color: var(--text); font-weight: 600; }
.notify-banner-text a { color: var(--notify-accent, var(--blue)); text-decoration: underline; }
.notify-banner-title {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--notify-accent, var(--blue));
}
.notify-banner-close {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--toggle-border);
  border-radius: var(--radius-md);
  background: var(--toggle-bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--dur-hover) var(--smooth), color var(--dur-hover) var(--smooth);
}
.notify-banner-close:hover { background: var(--toggle-bg-hover); color: var(--text); }

/* ===== 右下角通知弹窗容器：自右下角向左滑入 ===== */
.notify-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.notify-popup {
  pointer-events: auto;
  box-sizing: border-box;
  width: 100%;
  padding: 14px 14px 12px;
  background: var(--menu-bg);
  border: 1px solid var(--menu-border);
  border-left: 3px solid var(--notify-accent, var(--blue));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  /* 初始态：位于右侧屏幕外，向左滑入 */
  transform: translate3d(calc(100% + 24px), 0, 0);
  opacity: 0;
  transition:
    transform var(--dur-spring) var(--ease-spring),
    opacity   var(--dur-spring) var(--ease-spring);
}
.notify-popup.is-in {
  transform: translate3d(0, 0, 0);
  opacity: 1;
}
.notify-popup.is-out {
  transform: translate3d(calc(100% + 24px), 0, 0);
  opacity: 0;
}

.notify-popup-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.notify-popup-badge {
  flex: 0 0 auto;
  margin-top: 1px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--notify-accent-text, var(--btn-text));
  background: var(--notify-accent, var(--blue));
  border-radius: var(--radius-md);
}
.notify-popup-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.notify-popup-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--toggle-border);
  border-radius: var(--radius-md);
  background: var(--toggle-bg);
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--dur-hover) var(--smooth), color var(--dur-hover) var(--smooth);
}
.notify-popup-close:hover { background: var(--toggle-bg-hover); color: var(--text); }

/* ===== 正文：超长文本自动横向滚动 ===== */
.notify-popup-body {
  position: relative;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}
.notify-popup-body a { color: var(--notify-accent, var(--blue)); text-decoration: underline; }
.notify-popup-body code {
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 4px;
}
.notify-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.notify-scroll::-webkit-scrollbar { height: 4px; }
.notify-scroll::-webkit-scrollbar-thumb {
  background: var(--toggle-border);
  border-radius: 4px;
}
/* 自动滚动模式：由 JS 设置动画时长与位移量 */
.notify-scroll.is-autoscroll > .notify-scroll-inner {
  display: inline-block;
  animation-name: notify-marquee;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes notify-marquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(var(--marquee-shift, -100%), 0, 0); }
}

/* ===== 展开 / 收起 ===== */
.notify-expand-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition:
    grid-template-rows 0.45s cubic-bezier(0.25, 1.1, 0.5, 1),
    opacity            0.45s cubic-bezier(0.25, 1.1, 0.5, 1);
}
.notify-popup.is-expanded .notify-expand-panel {
  grid-template-rows: 1fr;
  opacity: 1;
}
.notify-expand-panel > div {
  min-height: 0;
  overflow: hidden;
}

/* ===== 调试信息面板 ===== */
.notify-debug {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
}
.notify-debug-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  line-height: 1.6;
  border-bottom: 1px dashed var(--bg-card-border);
}
.notify-debug-row:last-of-type { border-bottom: none; }
.notify-debug-key {
  flex: 0 0 76px;
  color: var(--text-faint);
}
.notify-debug-val {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-dim);
  word-break: break-all;
}
.notify-debug-val.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.notify-ip-mask {
  letter-spacing: 2px;
  cursor: pointer;
  user-select: none;
}
.notify-ip-eye {
  flex: 0 0 auto;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 1.8;
  color: var(--text-dim);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--dur-hover) var(--smooth), color var(--dur-hover) var(--smooth);
}
.notify-ip-eye:hover { background: var(--toggle-bg-hover); color: var(--text); }
.notify-log {
  margin: 6px 0 0;
  max-height: 96px;
  overflow: auto;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-faint);
  background: var(--bg-soft);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== 操作按钮组 ===== */
.notify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.notify-btn {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--dur-hover) var(--smooth),
    color      var(--dur-hover) var(--smooth),
    border-color var(--dur-hover) var(--smooth);
}
.notify-btn:hover {
  color: var(--text);
  background: var(--toggle-bg-hover);
  border-color: var(--btn-border-hover);
}
.notify-btn.is-primary {
  color: var(--notify-accent-text, var(--btn-text));
  background: var(--notify-accent, var(--blue));
  border-color: var(--notify-accent, var(--blue));
}
.notify-btn.is-primary:hover { filter: brightness(1.08); }
.notify-btn.is-ok {
  color: var(--blue-light);
  border-color: var(--blue-light);
}
.notify-toggle-btn { margin-top: 10px; }

/* ===== 侧边 HUD 内的设置项（复用站点 .menu-row / .switch 结构） ===== */
.notify-menu-select {
  max-width: 132px;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--dur-hover) var(--smooth), color var(--dur-hover) var(--smooth);
}
.notify-menu-select:hover { border-color: var(--btn-border-hover); color: var(--text); }
.notify-menu-select option { color: var(--text); background: var(--bg); }

/* ===== 无障碍：尊重系统「减弱动态效果」偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  .notify-banner,
  .notify-popup,
  .notify-expand-panel {
    transition-duration: 0.01ms;
  }
  .notify-scroll.is-autoscroll > .notify-scroll-inner { animation: none; }
}

/* ===== 窄屏适配 ===== */
@media (max-width: 480px) {
  .notify-stack {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
  .notify-banner { padding: 10px 40px 10px 12px; }
  .notify-banner-text, .notify-popup-title { font-size: 12px; }
}
