/* 全站统一通知：右上角堆叠，自右向左滑入；配色随主题变量切换 */

/* —— 默认 token（无 cyber-theme 时的兜底，亮色简约）—— */
body {
  --xt-notify-bg: #f8fafc;
  --xt-notify-border: rgba(148, 163, 184, 0.32);
  --xt-notify-title: #0f172a;
  --xt-notify-body: #475569;
  --xt-notify-close: #94a3b8;
  --xt-notify-close-hover-bg: rgba(148, 163, 184, 0.12);
  --xt-notify-close-hover: #64748b;
  --xt-notify-shadow: none;
  --xt-notify-shadow-hover: 0 4px 14px rgba(15, 23, 42, 0.08);
  --xt-notify-accent-info: #0ea5e9;
  --xt-notify-accent-success: #14b8a6;
  --xt-notify-accent-error: #ef4444;
  --xt-notify-accent-warning: #f59e0b;
  --xt-notify-link: var(--xt-notify-accent-info);
}

/* —— 星穹（默认 cyber-theme）—— */
body.cyber-theme {
  --xt-notify-bg: rgba(28, 40, 62, 0.96);
  --xt-notify-border: rgba(0, 245, 212, 0.22);
  --xt-notify-title: #e2e8f0;
  --xt-notify-body: rgba(226, 232, 240, 0.82);
  --xt-notify-close: rgba(148, 163, 184, 0.9);
  --xt-notify-close-hover-bg: rgba(0, 245, 212, 0.12);
  --xt-notify-close-hover: #00f5d4;
  --xt-notify-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --xt-notify-shadow-hover: 0 10px 28px rgba(0, 0, 0, 0.34);
  --xt-notify-accent-info: #00f5d4;
  --xt-notify-accent-success: #34d399;
  --xt-notify-accent-error: #f87171;
  --xt-notify-accent-warning: #fbbf24;
  --xt-notify-link: #00f5d4;
}

/* —— 霁光（亮色简约：浅底 + 彩色描边/图标/文字）—— */
html.theme-palette-jiguang body.cyber-theme,
html.theme-palette-jiguang body.auth-standalone-page {
  --xt-notify-bg: #f8fafc;
  --xt-notify-border: rgba(148, 163, 184, 0.28);
  --xt-notify-title: #0f172a;
  --xt-notify-body: #475569;
  --xt-notify-close: #94a3b8;
  --xt-notify-close-hover-bg: rgba(20, 184, 166, 0.1);
  --xt-notify-close-hover: #0d9488;
  --xt-notify-shadow: none;
  --xt-notify-shadow-hover: 0 4px 14px rgba(15, 23, 42, 0.08);
  --xt-notify-accent-info: #0ea5e9;
  --xt-notify-accent-success: #14b8a6;
  --xt-notify-accent-error: #ef4444;
  --xt-notify-accent-warning: #f59e0b;
  --xt-notify-link: #0ea5e9;
}

/* —— 玄墨 —— */
html.theme-palette-xuanmo body.cyber-theme,
html.theme-palette-xuanmo body.auth-standalone-page {
  --xt-notify-bg: rgba(12, 12, 16, 0.96);
  --xt-notify-border: rgba(168, 162, 158, 0.35);
  --xt-notify-title: #fafafa;
  --xt-notify-body: #a1a1aa;
  --xt-notify-close: #71717a;
  --xt-notify-close-hover-bg: rgba(228, 228, 231, 0.1);
  --xt-notify-close-hover: #e4e4e7;
  --xt-notify-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  --xt-notify-shadow-hover: 0 18px 42px rgba(0, 0, 0, 0.62);
  --xt-notify-accent-info: #c4b8a8;
  --xt-notify-accent-success: #86efac;
  --xt-notify-accent-error: #fca5a5;
  --xt-notify-accent-warning: #fcd34d;
  --xt-notify-link: #d6d3d1;
}

/* —— 独立登录页（默认星穹蓝灰，霁光/玄墨由上方 palette 覆盖）—— */
body.auth-standalone-page {
  --xt-notify-bg: #ffffff;
  --xt-notify-border: rgba(30, 41, 59, 0.12);
  --xt-notify-title: #0f172a;
  --xt-notify-body: #64748b;
  --xt-notify-close: #94a3b8;
  --xt-notify-close-hover-bg: rgba(59, 130, 246, 0.1);
  --xt-notify-close-hover: #3b82f6;
  --xt-notify-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  --xt-notify-shadow-hover: 0 16px 36px rgba(15, 23, 42, 0.18);
  --xt-notify-accent-info: #3b82f6;
  --xt-notify-accent-success: #16a34a;
  --xt-notify-accent-error: #dc2626;
  --xt-notify-accent-warning: #d97706;
  --xt-notify-link: #2563eb;
}

.xt-notify-stack {
  position: fixed;
  top: calc(var(--xt-navbar-min-height, 3.25rem) + 0.85rem);
  right: 1rem;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: none;
  max-width: min(400px, calc(100vw - 2rem));
}

.xt-notify {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: min(380px, calc(100vw - 2rem));
  padding: 0.72rem 0.65rem 0.72rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--xt-notify-border);
  background: var(--xt-notify-bg);
  backdrop-filter: blur(8px);
  color: var(--xt-notify-body);
  box-shadow: var(--xt-notify-shadow);
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.xt-notify.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.xt-notify.is-clickable {
  cursor: pointer;
}

.xt-notify.is-clickable:hover {
  border-color: color-mix(in srgb, var(--xt-notify-border) 45%, var(--xt-notify-accent, var(--xt-notify-accent-info)));
  box-shadow: var(--xt-notify-shadow-hover);
}

.xt-notify--success {
  --xt-notify-accent: var(--xt-notify-accent-success);
  border-color: color-mix(in srgb, var(--xt-notify-accent-success) 42%, var(--xt-notify-border));
}

.xt-notify--error {
  --xt-notify-accent: var(--xt-notify-accent-error);
  border-color: color-mix(in srgb, var(--xt-notify-accent-error) 42%, var(--xt-notify-border));
}

.xt-notify--warning {
  --xt-notify-accent: var(--xt-notify-accent-warning);
  border-color: color-mix(in srgb, var(--xt-notify-accent-warning) 42%, var(--xt-notify-border));
}

.xt-notify--info {
  --xt-notify-accent: var(--xt-notify-accent-info);
  border-color: color-mix(in srgb, var(--xt-notify-accent-info) 42%, var(--xt-notify-border));
}

/* 单行短提示：文字与图标同色，关闭按钮居中对齐 */
.xt-notify--compact .xt-notify__body {
  color: var(--xt-notify-accent, var(--xt-notify-accent-info));
  font-weight: 500;
  font-size: 0.875rem;
}

.xt-notify__icon {
  flex: 0 0 auto;
  font-size: 0.95rem;
  color: var(--xt-notify-accent, var(--xt-notify-accent-info));
}

.xt-notify__content {
  flex: 1 1 auto;
  min-width: 0;
}

.xt-notify__title {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--xt-notify-title);
  line-height: 1.35;
}

.xt-notify__body {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--xt-notify-body);
  word-break: break-word;
}

.xt-notify__body .toast-link {
  color: var(--xt-notify-link);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.xt-notify__body .toast-link:hover {
  opacity: 0.85;
}

.xt-notify__close {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  margin-left: 0.1rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--xt-notify-close);
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.xt-notify:not(.xt-notify--compact) .xt-notify__close {
  align-self: flex-start;
  margin-top: 0.05rem;
}

.xt-notify__close:hover {
  opacity: 1;
  background: var(--xt-notify-close-hover-bg);
  color: var(--xt-notify-close-hover);
  transform: scale(1.06);
}

.xt-notify__close:active {
  transform: scale(0.94);
}

.xt-notify__close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--xt-notify-accent, var(--xt-notify-accent-info)) 55%, transparent);
  outline-offset: 1px;
  opacity: 1;
}

/* 独立登录页：无顶栏 */
body.auth-standalone-page .xt-notify-stack {
  top: 1rem;
}

/* 旧 toast 容器保留占位但不再展示 */
#toast.toast.hidden {
  display: none !important;
}
