/**
 * Decap CMS 后台：贴近主站（马伯远的 AI 效率实验室）的浅色、圆角与主色，
 * 并修正下拉与顶栏重复问题相关的布局。
 */

/* ---- 页面包层：与 LabBackdrop 类似的柔光 + 细网格 ---- */
html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family:
    "Noto Sans SC",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: #0f172a;
  background: #fff;
}

.admin-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: #fff;
  background-image:
    linear-gradient(
      to bottom,
      rgba(240, 249, 255, 0.92) 0%,
      #fff 45%,
      rgba(239, 246, 255, 0.55) 100%
    ),
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, 0.04) 1px, transparent 1px);
  background-size:
    auto,
    56px 56px,
    56px 56px;
  background-position: 0 0, 0 0, 0 0;
  mask-image: radial-gradient(
    ellipse 85% 65% at 50% -5%,
    black 25%,
    transparent 70%
  );
}

.admin-backdrop::before {
  content: "";
  position: absolute;
  left: -25%;
  top: -8rem;
  width: min(90vw, 720px);
  height: min(70vh, 520px);
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.22);
  filter: blur(100px);
}

.admin-backdrop::after {
  content: "";
  position: absolute;
  right: -22%;
  top: 10%;
  width: min(80vw, 520px);
  height: min(60vh, 440px);
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.18);
  filter: blur(110px);
}

.nc-root {
  font-family: inherit;
  color: #0f172a;
  --lab-blue: #2563eb;
  --lab-sky: #0ea5e9;
  --lab-border: rgba(226, 232, 240, 0.95);
  --lab-muted: #64748b;
}

/* 顶栏：磨砂白 + 细边框（Decap 使用 <header>） */
.nc-root header {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid var(--lab-border) !important;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

/* 顶栏链接与次要文字 */
.nc-root header a,
.nc-root a[href^="http"] {
  color: var(--lab-muted) !important;
  transition: color 0.15s ease;
}

.nc-root header a:hover,
.nc-root header a:focus-visible {
  color: var(--lab-blue) !important;
}

/* 主导航激活态 */
.nc-root .header-link-active,
.nc-root a.header-link-active {
  color: var(--lab-blue) !important;
}

/* 按钮圆角、主按钮倾向蓝（覆盖常见灰按钮中的主操作） */
.nc-root button {
  border-radius: 10px;
  font-family: inherit;
}

.nc-root button[class*="Primary"],
.nc-root [class*="SplitButton"] button:first-of-type {
  border-radius: 10px;
}

/* 表单控件 */
.nc-root input[type="text"],
.nc-root input[type="search"],
.nc-root input[type="date"],
.nc-root input[type="datetime-local"],
.nc-root textarea {
  border-radius: 10px !important;
  border-color: #e2e8f0 !important;
  font-family: inherit;
}

.nc-root input:focus,
.nc-root textarea:focus {
  outline: none !important;
  border-color: var(--lab-blue) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18) !important;
}

/* 集合卡片区域略微圆角 */
.nc-root [class*="Card"] {
  border-radius: 12px !important;
}

/* 等宽小标签（日期等）可选用 JetBrains */
.nc-root [class*="font-mono"],
.nc-root .font-mono {
  font-family:
    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* 下拉：加宽 + 换行 */
.nc-root [role="listbox"],
.nc-root [role="menu"],
.nc-root [class*="Dropdown"] > ul,
.nc-root header ~ div ul[class] {
  min-width: min(22rem, 92vw) !important;
  max-width: min(28rem, 96vw) !important;
  box-sizing: border-box;
  border-radius: 12px !important;
  border: 1px solid var(--lab-border) !important;
  box-shadow:
    0 10px 40px -12px rgba(15, 23, 42, 0.15),
    0 0 0 1px rgba(15, 23, 42, 0.03) !important;
}

.nc-root [role="option"],
.nc-root [role="menuitem"],
.nc-root [role="listbox"] li span,
.nc-root [class*="Dropdown"] li {
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.4;
  padding-block: 0.35rem;
}

/* 我们脚本隐藏重复 chrome 时占位缝隙收紧 */
.nc-root [data-admin-dedupe] {
  display: none !important;
}
