/* ============================================================
   newapi 双轨皮肤覆盖
   ──────────────────────────────────────────────────────────
   生效原则：通过覆盖 Semi UI 的 CSS 自定义变量 (--semi-color-*)
            实现整站换肤，不动 Semi UI 自身的样式表

   Light 模式（默认）：
     —— 深科技蓝 (#1d4ed8) + 灰白底 (#f7f8fa)
     —— 用于公网公开访问的合规版

   Dark 模式（用户在右上角主题切换为 dark）：
     —— 金 (#d4b106) + 黑 (#0f0f0f) + glow
     —— 用于登录后的工作台 / 企业专线后台

   两套皮肤共用一份 CSS——newapi 已有 html body[theme-mode="dark"]
   切换机制，本文件只需对应两个分支即可。

   适用：智炎创科学习园地（newapi 大陆站，先行测试）
   ============================================================ */

/* ============================================================
   Light 模式 / 合规版（默认状态）
   覆盖 Semi UI 的 light token + 全局基础
   ============================================================ */
:root,
body:not([theme-mode="dark"]) {
  /* 主色：深科技蓝 */
  --semi-color-primary:                  rgb(29, 78, 216);   /* #1d4ed8 */
  --semi-color-primary-hover:            rgb(30, 64, 175);   /* #1e40af */
  --semi-color-primary-active:           rgb(30, 58, 138);   /* #1e3a8a */
  --semi-color-primary-disabled:         rgb(173, 198, 248); /* light blue */
  --semi-color-primary-light-default:    rgb(239, 246, 255); /* #eff6ff */
  --semi-color-primary-light-hover:      rgb(219, 234, 254); /* #dbeafe */
  --semi-color-primary-light-active:     rgb(191, 219, 254); /* #bfdbfe */

  /* 链接 */
  --semi-color-link:                     rgb(29, 78, 216);
  --semi-color-link-hover:               rgb(30, 64, 175);
  --semi-color-link-active:              rgb(30, 58, 138);
  --semi-color-link-visited:             rgb(76, 29, 149);

  /* 信息 / 成功 / 警告 / 错误 — 收敛灰中带蓝的合规口径 */
  --semi-color-success:                  rgb(13, 159, 110);
  --semi-color-success-hover:            rgb(11, 138, 96);
  --semi-color-success-light-default:    rgb(236, 253, 245);
  --semi-color-warning:                  rgb(180, 83, 9);
  --semi-color-warning-hover:            rgb(146, 64, 14);
  --semi-color-warning-light-default:    rgb(255, 251, 235);
  --semi-color-danger:                   rgb(217, 45, 32);
  --semi-color-danger-hover:             rgb(180, 35, 24);
  --semi-color-danger-light-default:     rgb(254, 243, 242);
  --semi-color-info:                     rgb(29, 78, 216);
  --semi-color-info-light-default:       rgb(239, 246, 255);

  /* 中性背景 */
  --semi-color-bg-0:                     rgb(247, 248, 250);   /* 整页底 */
  --semi-color-bg-1:                     rgb(255, 255, 255);   /* 卡片 */
  --semi-color-bg-2:                     rgb(238, 240, 243);
  --semi-color-bg-3:                     rgb(228, 231, 236);
  --semi-color-bg-4:                     rgb(228, 231, 236);

  /* 填充 */
  --semi-color-fill-0:                   rgba(15, 23, 42, 0.04);
  --semi-color-fill-1:                   rgba(15, 23, 42, 0.06);
  --semi-color-fill-2:                   rgba(15, 23, 42, 0.10);

  /* 文字 */
  --semi-color-text-0:                   rgb(31, 35, 41);     /* 主文字 */
  --semi-color-text-1:                   rgb(77, 87, 98);     /* 次文字 */
  --semi-color-text-2:                   rgb(143, 149, 158);  /* 辅助 */
  --semi-color-text-3:                   rgb(197, 200, 205);  /* 占位 */

  /* 边框 / 分割线 */
  --semi-color-border:                   rgb(228, 231, 236);
  --semi-color-nav-bg:                   rgb(255, 255, 255);
  --semi-color-disabled-fill:            rgb(238, 240, 243);
  --semi-color-disabled-bg:              rgb(247, 248, 250);
  --semi-color-disabled-text:            rgb(143, 149, 158);
  --semi-color-disabled-border:          rgb(228, 231, 236);

  /* 阴影 */
  --semi-shadow-elevated:                0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --semi-shadow-card:                    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);

  /* 圆角整体放圆一点（合规版适合较圆角，给"克制+亲和"感） */
  --semi-border-radius-extra-small:      4px;
  --semi-border-radius-small:            6px;
  --semi-border-radius-medium:           10px;
  --semi-border-radius-large:            14px;
}


/* ============================================================
   Dark 模式 / 工作台金黑版
   生效于：用户在右上角主题切换器选择 dark，或系统主题为 dark
   ============================================================ */
html body[theme-mode="dark"] {
  /* 主色：金 */
  --semi-color-primary:                  rgb(212, 177, 6);    /* #d4b106 */
  --semi-color-primary-hover:            rgb(230, 192, 18);   /* #e6c012 */
  --semi-color-primary-active:           rgb(184, 154, 5);    /* #b89a05 */
  --semi-color-primary-disabled:         rgb(110, 92, 5);
  --semi-color-primary-light-default:    rgb(42, 37, 16);     /* 金底 dim */
  --semi-color-primary-light-hover:      rgb(58, 51, 22);
  --semi-color-primary-light-active:     rgb(78, 68, 28);

  --semi-color-link:                     rgb(212, 177, 6);
  --semi-color-link-hover:               rgb(230, 192, 18);
  --semi-color-link-active:              rgb(184, 154, 5);
  --semi-color-link-visited:             rgb(168, 138, 5);

  /* 语义色：保留鲜明，便于工作台区分 */
  --semi-color-success:                  rgb(0, 230, 118);
  --semi-color-success-hover:            rgb(0, 200, 100);
  --semi-color-success-light-default:    rgb(10, 40, 24);
  --semi-color-warning:                  rgb(255, 183, 77);
  --semi-color-warning-hover:            rgb(255, 167, 38);
  --semi-color-warning-light-default:    rgb(42, 34, 16);
  --semi-color-danger:                   rgb(255, 77, 79);
  --semi-color-danger-hover:             rgb(255, 100, 102);
  --semi-color-danger-light-default:     rgb(42, 16, 16);
  --semi-color-info:                     rgb(41, 121, 255);
  --semi-color-info-light-default:       rgb(10, 26, 42);

  /* 中性背景：黑系 */
  --semi-color-bg-0:                     rgb(15, 15, 15);     /* 整页底 #0f0f0f */
  --semi-color-bg-1:                     rgb(20, 20, 20);     /* 面板 #141414 */
  --semi-color-bg-2:                     rgb(26, 26, 26);     /* 卡片 #1a1a1a */
  --semi-color-bg-3:                     rgb(31, 31, 31);     /* 抬升 */
  --semi-color-bg-4:                     rgb(42, 42, 42);     /* 强调 */

  /* 填充 */
  --semi-color-fill-0:                   rgba(255, 255, 255, 0.04);
  --semi-color-fill-1:                   rgba(255, 255, 255, 0.06);
  --semi-color-fill-2:                   rgba(255, 255, 255, 0.10);

  /* 文字 */
  --semi-color-text-0:                   rgb(224, 224, 224);   /* #e0e0e0 */
  --semi-color-text-1:                   rgb(176, 176, 176);   /* #b0b0b0 */
  --semi-color-text-2:                   rgb(119, 119, 119);   /* #777 */
  --semi-color-text-3:                   rgb(85, 85, 85);

  /* 边框 / 分割线 */
  --semi-color-border:                   rgb(42, 42, 42);     /* #2a2a2a */
  --semi-color-nav-bg:                   rgb(20, 20, 20);
  --semi-color-disabled-fill:            rgb(31, 31, 31);
  --semi-color-disabled-bg:              rgb(20, 20, 20);
  --semi-color-disabled-text:            rgb(85, 85, 85);
  --semi-color-disabled-border:          rgb(42, 42, 42);

  /* 阴影：含金色 glow */
  --semi-shadow-elevated:                0 4px 12px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.30);
  --semi-shadow-card:                    0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.30);
}

/* ============================================================
   组件级精修：金黑工作台才需要 glow / 金边
   ============================================================ */
html body[theme-mode="dark"] .semi-button-primary,
html body[theme-mode="dark"] .semi-button-primary:not([disabled]):not(.semi-button-primary-loading) {
  background-color: var(--semi-color-primary);
  color: #000 !important;                     /* 金底黑字 */
  border-color: var(--semi-color-primary);
  font-weight: 600;
  transition: all 0.18s ease;
}
html body[theme-mode="dark"] .semi-button-primary:hover {
  background-color: var(--semi-color-primary-hover) !important;
  box-shadow: 0 0 16px rgba(212, 177, 6, 0.40);
  transform: translateY(-1px);
}

/* 输入框 focus glow */
html body[theme-mode="dark"] .semi-input-wrapper:focus-within,
html body[theme-mode="dark"] .semi-input-wrapper-focus,
html body[theme-mode="dark"] .semi-textarea-wrapper:focus-within {
  border-color: var(--semi-color-primary) !important;
  box-shadow: 0 0 0 2px rgba(212, 177, 6, 0.18) !important;
}

/* 卡片在金黑模式下加微金色边框 hover */
html body[theme-mode="dark"] .semi-card {
  background-color: var(--semi-color-bg-2);
  border: 1px solid var(--semi-color-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
html body[theme-mode="dark"] .semi-card:hover {
  border-color: rgba(212, 177, 6, 0.30);
}

/* 侧栏选中态：金底 + 金字 */
html body[theme-mode="dark"] .semi-navigation-item-selected {
  background-color: rgba(212, 177, 6, 0.12) !important;
  color: var(--semi-color-primary) !important;
}
html body[theme-mode="dark"] .semi-navigation-item-selected .semi-navigation-item-icon {
  color: var(--semi-color-primary) !important;
}

/* 顶部导航在金黑下的玻璃感 */
html body[theme-mode="dark"] .semi-navigation-horizontal {
  background-color: rgba(20, 20, 20, 0.85) !important;
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--semi-color-border);
}

/* 滚动条更纤细 */
html body[theme-mode="dark"] ::-webkit-scrollbar { width: 6px; height: 6px; }
html body[theme-mode="dark"] ::-webkit-scrollbar-track { background: transparent; }
html body[theme-mode="dark"] ::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
html body[theme-mode="dark"] ::-webkit-scrollbar-thumb:hover { background: #555; }

/* ============================================================
   首页 HomePageContent 注入容器：保证我们写在 home.html 里
   的样式不被 newapi 全局污染（用 .corp-home-root 作命名空间）
   ============================================================ */
.corp-home-root, .corp-home-root * { box-sizing: border-box; }
.corp-home-root { font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif; line-height: 1.5; }

/* ============================================================
   主题切换平滑过渡
   ============================================================ */
body, .semi-card, .semi-button, .semi-input-wrapper, .semi-navigation, .semi-table {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* ============================================================
   打印样式（合规法律页打印友好）
   ============================================================ */
@media print {
  body { background: white !important; color: black !important; }
  .semi-navigation, .semi-side-sheet, [data-print-hide] { display: none !important; }
}
