/* ============================================================================
   SWISS INTERNATIONAL STYLE  —  Cloudreve V4 skin
   ----------------------------------------------------------------------------
   设计原则（Josef Müller-Brockmann / International Typographic Style）：
   1. 网格先于装饰      2. 字体即图形      3. 单一强调色
   4. 零圆角、零阴影    5. 用 1px 细线组织信息，不用投影
   ----------------------------------------------------------------------------
   覆盖目标：MUI v6 全局类名（.Mui*）+ CSS 变量 + 元素选择器三重兜底
   安装位置：/opt/cloudreve/data/statics/theme-swiss.css
   加载方式：index.html </head> 前插入 <link rel="stylesheet" href="/theme-swiss.css?v=1">
   ========================================================================== */

/* ---------------------------------------------------------------- 1. TOKENS */
:root {
  /* 明度轴：只用白、黑、三级灰 */
  --sw-white:    #FFFFFF;
  --sw-black:    #0A0A0A;
  --sw-gray-1:   #F6F6F6;   /* 背景分区 */
  --sw-gray-2:   #E3E3E3;   /* 分割线 */
  --sw-gray-3:   #B4B4B4;   /* 禁用 */
  --sw-gray-4:   #6B6B6B;   /* 次级文字 */

  /* 唯一强调色：IKB 国际克莱因蓝 */
  --sw-accent:      #002FA7;
  --sw-accent-deep: #001F70;
  --sw-accent-wash: #EBEFF9;

  /* 语义色：克制使用，仅用于明确的对错 */
  --sw-danger: #D3202A;
  --sw-ok:     #00794F;

  --sw-line: 1px solid var(--sw-gray-2);

  /* 字体：Helvetica 系（瑞士风格的核心物质） */
  --sw-font: "Helvetica Neue", Helvetica, "Inter", Arial,
             "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --sw-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 8px 基线栅格 */
  --sw-u: 8px;
  --sw-gutter: 24px;
}

/* ------------------------------------------------------- 2. GLOBAL SUBTRACT */
/* 减法：把 MUI 的圆角与投影全部归零 */
*,
*::before,
*::after {
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* 字体统一：覆盖 @fontsource/roboto */
html, body,
.MuiTypography-root,
.MuiButton-root,
.MuiInputBase-root,
.MuiInputBase-input,
.MuiTableCell-root,
.MuiMenuItem-root,
.MuiListItemText-primary,
.MuiListItemText-secondary,
.MuiChip-root,
.MuiTab-root,
.MuiFormLabel-root,
.MuiFormHelperText-root,
.MuiDialogTitle-root,
.MuiDialogContentText-root,
input, textarea, select, button {
  font-family: var(--sw-font) !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
}

html, body {
  background: var(--sw-white) !important;
  color: var(--sw-black) !important;
}

/* 标题：压缩字距 + 重字重，瑞士海报式排版 */
.MuiTypography-h1, .MuiTypography-h2, .MuiTypography-h3,
.MuiTypography-h4, .MuiTypography-h5, .MuiTypography-h6,
h1, h2, h3, h4, h5, h6 {
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: var(--sw-black) !important;
}

/* 正文行高：国际主义典型的紧凑但有呼吸 */
.MuiTypography-body1, .MuiTypography-body2, p, li, td, th {
  letter-spacing: 0 !important;
  line-height: 1.55 !important;
}

/* 次级文字：只用灰阶，不用蓝灰 */
.MuiTypography-body2,
.MuiTypography-caption,
.MuiTypography-overline,
.MuiListItemText-secondary,
.MuiFormHelperText-root {
  color: var(--sw-gray-4) !important;
}

/* 链接：细下划线，hover 才变强调色 */
a {
  color: var(--sw-black) !important;
  text-decoration: none !important;
  border-bottom: 1px solid var(--sw-gray-3);
  transition: color .12s linear, border-color .12s linear;
}
a:hover {
  color: var(--sw-accent) !important;
  border-bottom-color: var(--sw-accent) !important;
}

/* 选中文本：反白块，不用半透明蓝 */
::selection {
  background: var(--sw-accent) !important;
  color: var(--sw-white) !important;
}

/* 滚动条：1px 细线，极简 */
* {
  scrollbar-width: thin !important;
  scrollbar-color: var(--sw-gray-3) transparent !important;
}
::-webkit-scrollbar { width: 8px !important; height: 8px !important; }
::-webkit-scrollbar-track { background: transparent !important; }
::-webkit-scrollbar-thumb {
  background: var(--sw-gray-2) !important;
  border-radius: 0 !important;
}
::-webkit-scrollbar-thumb:hover { background: var(--sw-gray-3) !important; }

/* ----------------------------------------------------------- 3. SURFACES */
/* 所有 Paper 面：纯白 + 1px 边框，替代投影 */
.MuiPaper-root,
.MuiCard-root,
.MuiDialog-paper,
.MuiMenu-paper,
.MuiPopover-paper,
.MuiAccordion-root {
  background-color: var(--sw-white) !important;
  background-image: none !important;
  color: var(--sw-black) !important;
  border: var(--sw-line) !important;
}

/* 弹窗/菜单：用细边框 + 无投影，靠 1px 线做层次 */
.MuiDialog-paper {
  border: 1px solid var(--sw-black) !important;
}

/* 分割线：1px 实线 */
.MuiDivider-root,
hr {
  border: 0 !important;
  border-top: var(--sw-line) !important;
  background: none !important;
  height: 0 !important;
}

/* -------------------------------------------------------------- 4. BUTTONS */
.MuiButton-root {
  text-transform: none !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  padding: 8px 20px !important;
  min-height: 36px !important;
  border: 1px solid transparent !important;
  transition: background-color .12s linear, color .12s linear, border-color .12s linear !important;
}

/* 主按钮：实心 IKB，唯一大面积色块 */
.MuiButton-contained,
.MuiButton-containedPrimary {
  background-color: var(--sw-accent) !important;
  color: var(--sw-white) !important;
  border-color: var(--sw-accent) !important;
}
.MuiButton-contained:hover,
.MuiButton-containedPrimary:hover {
  background-color: var(--sw-accent-deep) !important;
  border-color: var(--sw-accent-deep) !important;
}

/* 次按钮：白底黑框，hover 反色 */
.MuiButton-outlined,
.MuiButton-outlinedPrimary {
  background-color: transparent !important;
  color: var(--sw-black) !important;
  border: 1px solid var(--sw-black) !important;
}
.MuiButton-outlined:hover,
.MuiButton-outlinedPrimary:hover {
  background-color: var(--sw-black) !important;
  color: var(--sw-white) !important;
}

/* 文字按钮 */
.MuiButton-text,
.MuiButton-textPrimary {
  color: var(--sw-black) !important;
  background: transparent !important;
}
.MuiButton-text:hover { color: var(--sw-accent) !important; }

/* 图标按钮：hover 只加浅灰底，不加圆 */
.MuiIconButton-root {
  color: var(--sw-black) !important;
}
.MuiIconButton-root:hover {
  background-color: var(--sw-gray-1) !important;
  color: var(--sw-accent) !important;
}

/* 禁用态：脱色，不用降低透明度（透明度会灰得脏） */
.MuiButton-root.Mui-disabled,
.Mui-disabled {
  color: var(--sw-gray-3) !important;
  border-color: var(--sw-gray-2) !important;
  background-color: var(--sw-gray-1) !important;
  opacity: 1 !important;
}

/* --------------------------------------------------------------- 5. INPUTS */
.MuiInputBase-root,
.MuiOutlinedInput-root {
  background-color: var(--sw-white) !important;
  border-radius: 0 !important;
}
.MuiOutlinedInput-notchedOutline {
  border: 1px solid var(--sw-gray-2) !important;
  border-radius: 0 !important;
}
.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
  border-color: var(--sw-gray-4) !important;
}
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border: 1px solid var(--sw-accent) !important;
  border-width: 1px !important;   /* 不用 2px，避免跳动 */
}
.MuiInputLabel-root {
  color: var(--sw-gray-4) !important;
  font-size: 13px !important;
}
.MuiInputLabel-root.Mui-focused {
  color: var(--sw-accent) !important;
}
/* 标签不要压在边框上留缺口 —— 瑞士风格偏好完整矩形 */
.MuiInputLabel-outlined {
  background: var(--sw-white) !important;
  padding: 0 4px !important;
}

/* 复选框/单选：方形，纯黑描边 */
.MuiCheckbox-root, .MuiRadio-root {
  color: var(--sw-gray-3) !important;
}
.MuiCheckbox-root.Mui-checked,
.MuiRadio-root.Mui-checked {
  color: var(--sw-accent) !important;
}

/* 开关：选中 IKB */
.MuiSwitch-track { background-color: var(--sw-gray-2) !important; }
.MuiSwitch-thumb { background-color: var(--sw-white) !important; }
.Mui-checked + .MuiSwitch-track,
.MuiSwitch-colorPrimary.Mui-checked + .MuiSwitch-track {
  background-color: var(--sw-accent) !important;
}

/* --------------------------------------------------------------- 6. LISTS */
/* 文件列表：48px 行高 + 1px 分隔，取代斑马纹与卡片 */
.MuiListItem-root,
.MuiListItemButton-root {
  border-bottom: var(--sw-line) !important;
  min-height: 48px !important;
  transition: background-color .1s linear !important;
}
.MuiListItem-root:last-child,
.MuiListItemButton-root:last-child {
  border-bottom: none !important;
}
.MuiListItemButton-root:hover {
  background-color: var(--sw-gray-1) !important;
}

/* 选中态：左侧 3px IKB 竖条 + 极浅蓝底（唯一的"色块"） */
.Mui-selected,
.MuiListItemButton-root.Mui-selected,
.MuiMenuItem-root.Mui-selected {
  background-color: var(--sw-accent-wash) !important;
  color: var(--sw-black) !important;
  box-shadow: inset 3px 0 0 0 var(--sw-accent) !important;
}
.MuiListItemButton-root.Mui-selected:hover {
  background-color: var(--sw-accent-wash) !important;
}

/* 列表主文字 */
.MuiListItemText-primary {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: var(--sw-black) !important;
}
.MuiListItemText-secondary {
  font-size: 12px !important;
  font-family: var(--sw-mono) !important;   /* 尺寸/时间用等宽，像数据表 */
}

/* --------------------------------------------------------------- 7. TABLES */
.MuiTableCell-root,
table {
  border-bottom: var(--sw-line) !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
}
.MuiTableCell-head,
th {
  color: var(--sw-gray-4) !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  letter-spacing: .08em !important;
  text-transform: uppercase !important;    /* 表头全大写，瑞士式 */
  border-bottom: 1px solid var(--sw-black) !important;
}
.MuiTableRow-root:hover {
  background-color: var(--sw-gray-1) !important;
}

/* ---------------------------------------------------------------- 8. CHROME */
/* 顶栏：白底 + 底部 1px 黑线，不用投影 */
header,
.MuiAppBar-root,
.MuiToolbar-root {
  background-color: var(--sw-white) !important;
  background-image: none !important;
  color: var(--sw-black) !important;
  box-shadow: none !important;
}
header,
.MuiAppBar-root {
  border-bottom: 1px solid var(--sw-black) !important;
}

/* 品牌标记：左侧一条 IKB 装订线，贯穿全屏 —— 这是整套设计唯一的"签名" */
body::before {
  content: "";
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--sw-accent);
  z-index: 9999;
  pointer-events: none;
}

/* 侧栏：白底 + 右侧 1px 线 */
.MuiDrawer-paper {
  background-color: var(--sw-white) !important;
  border-right: 1px solid var(--sw-black) !important;
  border-left: none !important;
}

/* 标签页：下划线 2px，选中变 IKB 且文字加粗 */
.MuiTabs-root { border-bottom: var(--sw-line) !important; min-height: 40px !important; }
.MuiTab-root {
  text-transform: none !important;
  font-weight: 500 !important;
  min-height: 40px !important;
  font-size: 13px !important;
}
.MuiTabs-indicator {
  background-color: var(--sw-accent) !important;
  height: 2px !important;
}
.MuiTab-root.Mui-selected {
  color: var(--sw-black) !important;
  font-weight: 700 !important;
}

/* 徽标：方形小色块 */
.MuiChip-root {
  background-color: var(--sw-white) !important;
  border: 1px solid var(--sw-gray-2) !important;
  color: var(--sw-black) !important;
  font-size: 11px !important;
  height: 22px !important;
}
.MuiChip-root.MuiChip-colorPrimary,
.MuiChip-filledPrimary {
  background-color: var(--sw-accent) !important;
  color: var(--sw-white) !important;
  border-color: var(--sw-accent) !important;
}

/* 头像：唯一保留圆形的元素（人的脸不该被切成方块） */
.MuiAvatar-root {
  border-radius: 50% !important;
  background-color: var(--sw-black) !important;
  color: var(--sw-white) !important;
  font-weight: 600 !important;
}

/* ------------------------------------------------------------ 9. PROGRESS */
.MuiLinearProgress-root {
  background-color: var(--sw-gray-2) !important;
  height: 3px !important;
}
.MuiLinearProgress-bar {
  background-color: var(--sw-accent) !important;
}
.MuiCircularProgress-colorPrimary { color: var(--sw-accent) !important; }

/* 滑块：方形手柄 */
.MuiSlider-thumb { background-color: var(--sw-black) !important; }
.MuiSlider-track { background-color: var(--sw-accent) !important; }
.MuiSlider-rail { background-color: var(--sw-gray-2) !important; }

/* --------------------------------------------------------- 10. FEEDBACK */
/* 提示条：左侧 3px 色条 + 无投影 */
.MuiAlert-root {
  border: var(--sw-line) !important;
  border-left: 3px solid var(--sw-black) !important;
  background-color: var(--sw-white) !important;
  color: var(--sw-black) !important;
}
.MuiAlert-standardError,
.MuiAlert-filledError {
  border-left-color: var(--sw-danger) !important;
  background-color: var(--sw-white) !important;
  color: var(--sw-black) !important;
}
.MuiAlert-standardSuccess {
  border-left-color: var(--sw-ok) !important;
  background-color: var(--sw-white) !important;
}
.MuiAlert-standardInfo,
.MuiAlert-standardWarning {
  border-left-color: var(--sw-accent) !important;
  background-color: var(--sw-white) !important;
}

/* 通知（notistack） */
.SnackbarItem-variantSuccess,
.SnackbarItem-variantError,
.SnackbarItem-variantInfo {
  border: 1px solid var(--sw-black) !important;
  background-color: var(--sw-white) !important;
  color: var(--sw-black) !important;
}

/* 提示气泡 */
.MuiTooltip-tooltip {
  background-color: var(--sw-black) !important;
  color: var(--sw-white) !important;
  font-size: 11px !important;
  border-radius: 0 !important;
  padding: 4px 8px !important;
}
.MuiTooltip-arrow { color: var(--sw-black) !important; }

/* ------------------------------------------------------------ 11. MENUS */
.MuiMenuItem-root {
  font-size: 13px !important;
  min-height: 36px !important;
  border-bottom: 1px solid var(--sw-gray-1) !important;
}
.MuiMenuItem-root:hover {
  background-color: var(--sw-gray-1) !important;
}
.MuiMenu-paper { border: 1px solid var(--sw-black) !important; }

/* --------------------------------------------------------------- 12. ICONS */
/* 线性图标统一 1.5px 描边观感，去掉彩色填充 */
.MuiSvgIcon-root { color: inherit !important; }

/* ------------------------------------------------------------- 13. SCROLL */
/* 悬浮操作条：白底黑框，不用浮起感 */
.MuiSpeedDial-root .MuiFab-root,
.MuiFab-root {
  background-color: var(--sw-black) !important;
  color: var(--sw-white) !important;
  border: none !important;
}
.MuiFab-primary {
  background-color: var(--sw-accent) !important;
}
.MuiBackdrop-root {
  background-color: rgba(10,10,10,.48) !important;
  backdrop-filter: none !important;
}

/* -------------------------------------------------------- 14. LOGIN SCREEN */
/* 大标题：瑞士海报式字号，标题即图形 */
.MuiTypography-h3 { font-size: 34px !important; line-height: 1.15 !important; }
.MuiTypography-h4 { font-size: 28px !important; line-height: 1.2 !important; }
.MuiTypography-h5 { font-size: 22px !important; line-height: 1.25 !important; }
.MuiTypography-h6 { font-size: 17px !important; line-height: 1.3 !important; }

/* 登录卡片：只用 1px 黑框界定，靠留白而不是靠投影组层次 */
.MuiPaper-root[class*="login"],
.MuiDialog-paper { background: var(--sw-white) !important; }

/* 覆盖 MUI 默认的"渐变/浮起"登录背景 */
.MuiBox-root[style*="linear-gradient"],
.MuiStack-root[style*="background"] {
  background-image: none !important;
  background-color: var(--sw-white) !important;
}

/* 兜底：MUI 的彩色渐变背景一律抹平 */
.MuiBox-root[style*="gradient"],
.MuiPaper-root[style*="gradient"] {
  background-image: none !important;
}

/* ------------------------------------------------ 15. TABLE DENSITY FIXES */
/* 只对表格单元格用等宽数字，绝不能碰按钮（MuiButton-sizeMedium 会中招） */
.MuiTableCell-root {
  font-variant-numeric: tabular-nums !important;
}
.MuiTableCell-root.MuiTableCell-alignRight {
  font-family: var(--sw-mono) !important;
  font-size: 12px !important;
}

/* --------------------------------------------- 16. REDUCED-MOTION RESPECT */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ------------------------------------------------------ 17. MOBILE ADJUST */
@media (max-width: 600px) {
  .MuiListItem-root,
  .MuiListItemButton-root { min-height: 56px !important; }
  .MuiButton-root { padding: 10px 16px !important; }
  .sw-login-mark { width: 5px; }
}

/* ------------------------------------------- 18. 外壳层透明（露出纯白 body） */
/* Cloudreve 用 MUI background.default (#f5f5f5) 铺满整屏，
   这里把最外层容器打通，让 body 的白透出来；卡片/侧栏/顶栏自带底色不受影响 */
#root,
#root > div,
#root > div > div {
  background-color: transparent !important;
  background-image: none !important;
}

/* 兜底：任何仍残留的浅灰大面积容器 */
.MuiBox-root[class*="css-"] {
  background-image: none !important;
}

/* ---------------------------------------- 19. Logo 横版自适应（图标 + 字标） */
img[src*="logo"],
img[alt*="logo" i] {
  width: auto !important;
  height: 36px !important;
  max-width: 200px !important;
  object-fit: contain !important;
  object-position: left center !important;
}
