/* ==========================================================================
   Fluent Design 2（Windows 11）基础层
   设计令牌 / 排版 / 通用控件 / 弹出菜单 / 对话框 / 提示条
   ========================================================================== */

:root {
  /* ---------- 表面 ---------- */
  --bg-mica: linear-gradient(160deg, #f6f8fb 0%, #eff2f7 38%, #f4f5f7 72%, #f2f3f5 100%);
  --surface: #ffffff;
  --surface-2: #fbfbfb;
  --surface-3: #f5f5f5;
  --nav-pane: rgba(249, 250, 252, 0.80);
  --acrylic: rgba(255, 255, 255, 0.74);
  --acrylic-strong: rgba(255, 255, 255, 0.90);

  /* ---------- 填充态（Fluent FillColor） ---------- */
  --fill-subtle: rgba(0, 0, 0, 0.0373);
  --fill-subtle-alt: rgba(0, 0, 0, 0.0241);
  --fill-selected: rgba(0, 0, 0, 0.0537);
  --fill-accent-soft: rgba(0, 120, 212, 0.10);
  --fill-accent-softer: rgba(0, 120, 212, 0.06);
  --fill-danger-soft: rgba(196, 43, 28, 0.10);

  /* ---------- 描边（Fluent StrokeColor） ---------- */
  --stroke: rgba(0, 0, 0, 0.0578);
  --stroke-2: rgba(0, 0, 0, 0.0298);
  --stroke-accent: rgba(0, 120, 212, 0.42);
  --stroke-control: rgba(0, 0, 0, 0.1083);

  /* ---------- 文本 ---------- */
  --text: rgba(0, 0, 0, 0.8954);
  --text-2: rgba(0, 0, 0, 0.6063);
  --text-3: rgba(0, 0, 0, 0.4458);
  --text-on-accent: #ffffff;

  /* ---------- 主色 ---------- */
  --accent: #0078d4;
  --accent-hover: #1a86d9;
  --accent-press: #005c99;
  --accent-text: #005a9e;
  --danger: #c42b1c;
  --danger-hover: #d13438;
  --folder-tab: #f7c948;
  --folder-body: #ffb900;

  /* ---------- 圆角 / 阴影 ---------- */
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.05), 0 3px 10px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 4px 12px rgba(0, 0, 0, 0.10), 0 16px 48px rgba(0, 0, 0, 0.16);
  --shadow-win: 0 8px 28px rgba(0, 0, 0, 0.12), 0 32px 64px rgba(0, 0, 0, 0.14);

  /* ---------- 动效 ---------- */
  --ease: cubic-bezier(0.33, 0, 0.67, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --dur-fast: 110ms;
  --dur: 180ms;

  --font: "Segoe UI Variable Text", "Segoe UI Variable Display", "Segoe UI", system-ui,
    -apple-system, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

/* hidden 属性必须始终生效 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: #eef1f5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: rgba(0, 120, 212, 0.22);
}

/* ---------- 滚动条 ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.24) transparent;
}
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.22);
  border: 3px solid transparent;
  border-radius: var(--r-pill);
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.38);
  background-clip: content-box;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.045);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover {
  background: var(--surface-3);
}
.btn:active {
  background: var(--fill-selected);
  transform: scale(0.985);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.btn[disabled] {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}
.btn--accent {
  background: var(--accent);
  border-color: transparent;
  color: var(--text-on-accent);
}
.btn--accent:hover {
  background: var(--accent-hover);
}
.btn--accent:active {
  background: var(--accent-press);
}
.btn--danger {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}
.btn--danger:hover {
  background: var(--danger-hover);
}
.btn--subtle {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn--subtle:hover {
  background: var(--fill-subtle);
}
.btn--icon {
  width: 32px;
  padding: 0;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ---------- 图标按钮 ---------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.icon-btn:hover {
  background: var(--fill-subtle);
  border-color: var(--stroke-2);
}
.icon-btn:active {
  background: var(--fill-selected);
}
.icon-btn[disabled] {
  color: var(--text-3);
  opacity: 0.45;
  pointer-events: none;
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}
.icon-btn--lg svg {
  width: 18px;
  height: 18px;
}

/* ---------- 输入框 ---------- */
.field {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--stroke);
  border-bottom-color: var(--stroke-control);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.field:hover {
  background: var(--surface-2);
}
.field:focus-within {
  background: var(--surface);
  border-color: var(--stroke-control);
  border-bottom-color: var(--accent);
  border-bottom-width: 2px;
}
.field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
}
.field svg {
  width: 15px;
  height: 15px;
  color: var(--text-2);
  flex: none;
}
.field--pill {
  border-radius: var(--r-pill);
  background: var(--fill-subtle);
  border: 1px solid transparent;
}
.field--pill:focus-within {
  background: var(--surface);
  border: 1px solid var(--stroke-control);
  border-bottom-width: 1px;
  box-shadow: 0 0 0 1px var(--accent);
}

.input {
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--stroke);
  border-bottom-color: var(--stroke-control);
  border-radius: var(--r-sm);
  background: var(--surface);
  outline: none;
  width: 100%;
}
.input:focus {
  border-bottom: 2px solid var(--accent);
}

/* ==========================================================================
   弹出菜单（Fluent MenuFlyout）
   ========================================================================== */
.menu {
  position: fixed;
  z-index: 1200;
  min-width: 196px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--acrylic-strong);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: var(--shadow-pop);
  animation: pop-in 130ms var(--ease-out);
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 32px;
  padding: 0 11px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
.menu__item:hover {
  background: var(--fill-subtle);
}
.menu__item:disabled {
  color: var(--text-3);
  pointer-events: none;
}
.menu__item--danger {
  color: var(--danger);
}
.menu__item--danger:hover {
  background: var(--fill-danger-soft);
}
.menu__item svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-2);
}
.menu__item--danger svg {
  color: var(--danger);
}
.menu__check {
  margin-left: auto;
  font-size: 12px;
  color: var(--accent-text);
}
.menu__sep {
  height: 1px;
  margin: 4px 10px;
  background: var(--stroke-2);
}

/* ==========================================================================
   对话框（Fluent ContentDialog）
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.30);
  animation: fade-in 130ms var(--ease-out);
}
.dialog {
  width: min(452px, 100%);
  padding: 24px 24px 20px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: dialog-in 190ms var(--ease-out);
}
.dialog__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.1px;
}
.dialog__desc {
  margin: 0 0 20px;
  color: var(--text-2);
  line-height: 1.55;
  font-size: 13px;
}
.dialog__body {
  margin-bottom: 22px;
}
.dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog--wide {
  width: min(680px, 100%);
}

/* ==========================================================================
   提示条
   ========================================================================== */
.toast-root {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 88vw;
  padding: 11px 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--acrylic-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  animation: slide-up 200ms var(--ease-out);
}
.toast--error {
  border-color: rgba(196, 43, 28, 0.38);
  color: var(--danger);
}
.toast--success svg {
  color: #0e700e;
}

/* ==========================================================================
   动画
   ========================================================================== */
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.975) translateY(10px);
  }
}
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
