/* =========================================================
   pro.css — Ant Design Pro 设计语言层（零构建实现）
   参照：ProLayout（页头+面包屑+可折叠侧栏）、ProTable（工具栏/对齐/分页右置）、
        PageContainer（页头下沉）、antd Tag/Empty/Statistic 视觉规范。
   品牌策略：结构规范取 AntD，颜色仍走 tokens.css 的 MEKO 令牌。
   加载顺序：style.css → tokens.css → common.css → pro.css（最后覆盖）。
   ========================================================= */

/* ---------- 全局底色与节奏（AntD：colorBgLayout #f5f7fa、圆角 8） ---------- */
body {
  background: var(--bg-1);
}

:root {
  --ant-radius: 8px;
  --ant-split: #f0f0f0;
  --ant-table-header: #fafafa;
  --ant-hover: #fafafa;
  --ant-control-h: 36px;
}

/* ---------- 侧边栏：AntD 暗色菜单规范（深色底 + 主色选中块 + 圆角项） ---------- */
.sidebar {
  width: var(--sidebar-w);
  transition: width .2s ease;
}

.sidebar-menu .menu-item {
  margin: 2px 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: var(--ant-radius);
  border-left: none;               /* AntD 用色块选中，不用左条 */
}

.sidebar-menu .menu-item.active {
  background: var(--brand-500);
  color: #fff;
}

.sidebar-menu .menu-group-title {
  padding: 14px 20px 4px;
}

/* ---------- 折叠态（ProLayout 收窄到 64px 图标栏） ---------- */
.layout.collapsed .sidebar { width: 64px; }
.layout.collapsed .mi-label,
.layout.collapsed .menu-group-title,
.layout.collapsed .logo-sub { display: none; }
.layout.collapsed .sidebar-menu .menu-item { justify-content: center; padding: 0; }
.layout.collapsed .sidebar-logo { justify-content: center; padding: 0 8px; }
.layout.collapsed .main-wrapper { margin-left: 64px; }

.main-wrapper { transition: margin-left .2s ease; }

/* ---------- 顶栏：ProLayout（折叠按钮 + 面包屑 + 头像下拉） ---------- */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
}

.breadcrumb em { font-style: normal; color: var(--gray-300); }

.breadcrumb .crumb-current { color: var(--text-2); }

/* 头像下拉（ProLayout 右上角账户区） */
.user-dropdown { position: relative; }

.user-dropdown .user-info {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--ant-radius);
  font-size: 14px;
  color: var(--text-1);
}

.user-dropdown .user-info:hover { background: var(--ant-hover); }

.user-dropdown .caret {
  font-size: 10px;
  color: var(--text-3);
  margin-left: 2px;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 200px;
  background: var(--bg-2);
  border: 1px solid var(--ant-split);
  border-radius: var(--ant-radius);
  box-shadow: var(--shadow-2);
  z-index: 300;
  overflow: hidden;
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ant-split);
}

.user-menu-head .un-name { font-size: 14px; font-weight: 600; color: var(--text-1); }
.user-menu-head .un-role { font-size: 12px; color: var(--text-3); }

.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-1);
  cursor: pointer;
}

.user-menu-item:hover { background: var(--ant-hover); color: var(--brand-500); }

/* ---------- PageContainer：页头下沉到内容区 ---------- */
.page-header {
  padding: 0 0 16px;
}

.page-header .ph-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.4;
}

.page-header .ph-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- Card：AntD 卡片（描边为主、圆角 8、头部分割线） ---------- */
.card {
  border-radius: var(--ant-radius);
  border-color: var(--ant-split);
  box-shadow: none;
}

.card:hover { box-shadow: var(--shadow-1); }

.card-header { padding: 14px 20px; }
.card-body { padding: 20px; }

.card-title { font-size: 15px; font-weight: 600; }

/* ---------- ProTable：表头 #fafafa、描边容器、右对齐分页 ---------- */
.table-wrapper {
  border: 1px solid var(--ant-split);
  border-radius: var(--ant-radius);
  overflow: hidden;
}

.table th {
  background: var(--ant-table-header);
  font-weight: 500;
}

.table td { height: 48px; }

.table tr:hover td { background: var(--ant-hover); }

.pagination {
  justify-content: flex-end;
}

.pagination button {
  min-width: 32px;
  height: 32px;
  border-radius: var(--ant-radius);
  border-color: var(--gray-300);
}

.pagination button.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
}

/* ---------- Tag 化徽章（AntD Tag：小圆角 + 同色描边） ---------- */
.badge {
  border-radius: 4px;
  padding: 1px 8px;
  border: 1px solid transparent;
}

.badge-primary { border-color: color-mix(in srgb, var(--brand-500) 25%, transparent); }
.badge-success { border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge-warning { border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge-danger  { border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.badge-info    { border-color: color-mix(in srgb, var(--info) 30%, transparent); }

/* ---------- 按钮（AntD：主按钮实色、默认按钮描边 #d9d9d9） ---------- */
.btn { border-radius: 6px; }

.btn-primary:hover { background: var(--brand-700); }

.btn-outline { border-color: var(--gray-300); color: var(--text-1); }

.btn-outline:hover {
  color: var(--brand-500);
  border-color: var(--brand-500);
  background: var(--bg-2);
}

.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, black); }

/* ---------- 表单（AntD 控件高度 36、聚焦主色环） ---------- */
.form-control,
.form-select,
.form-textarea {
  min-height: var(--ant-control-h);
  border-radius: 6px;
  border-color: var(--gray-300);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-500) 12%, transparent);
}

/* ---------- Empty（AntD 空态：圆形图标容器 + 弱化文案） ---------- */
.empty-state i {
  width: 64px;
  height: 64px;
  line-height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--ant-table-header);
  border: 1px solid var(--ant-split);
  font-size: 26px;
  font-style: normal;
}

/* ---------- Statistic（统计卡数值用数字字体，与 Pro 一致） ---------- */
.stat-card .stat-label { font-size: 13px; color: var(--text-3); }

/* ---------- 移动端微调 ---------- */
@media (max-width: 1023px) {
  .breadcrumb { display: none; }
}

@media (max-width: 768px) {
  .page-header .ph-title { font-size: 18px; }
}

/* =========================================================
   ProTable 增强层（questions.html 首发，其余列表页可复用）
   ========================================================= */

/* data-table：4 个列表页都在用这个类名，但此前全站没有任何定义（浏览器裸样式） */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--ant-split); }
.data-table th { background: var(--ant-table-header); font-weight: 500; color: var(--text-2); white-space: nowrap; }
.data-table tr:hover td { background: var(--ant-hover); }

/* 密度（ProTable density：宽松/默认/紧凑） */
.tbl-compact .data-table th, .tbl-compact .data-table td { padding: 6px 12px; }
.tbl-comfortable .data-table th, .tbl-comfortable .data-table td { padding: 18px 16px; }

/* 列设置（column settings）：col-off-N 隐藏第 N 列（选择/题干/操作列不参与） */
.col-off-2 th:nth-child(2), .col-off-2 td:nth-child(2),
.col-off-4 th:nth-child(4), .col-off-4 td:nth-child(4),
.col-off-5 th:nth-child(5), .col-off-5 td:nth-child(5),
.col-off-6 th:nth-child(6), .col-off-6 td:nth-child(6),
.col-off-7 th:nth-child(7), .col-off-7 td:nth-child(7),
.col-off-8 th:nth-child(8), .col-off-8 td:nth-child(8) { display: none; }

/* 工具条右侧 options 区（刷新/密度/列设置） */
.pro-options { display: flex; align-items: center; gap: 6px; }
.pro-opt-wrap { position: relative; }
.pro-opt-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-300); border-radius: 6px;
  background: var(--bg-2); color: var(--text-2); font-size: 14px; cursor: pointer;
}
.pro-opt-btn:hover { color: var(--brand-500); border-color: var(--brand-500); }
.pro-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 150px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--ant-split);
  border-radius: var(--ant-radius); box-shadow: var(--shadow-2); z-index: 260;
}
.pro-menu label, .pro-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; border: none; border-radius: 4px;
  background: transparent; font-size: 13px; color: var(--text-1); cursor: pointer; text-align: left;
}
.pro-menu label:hover, .pro-menu button:hover { background: var(--ant-hover); }

/* 选中提示条（rowSelection alert） */
.pro-alert {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 20px 12px; padding: 10px 14px;
  background: var(--brand-100);
  border: 1px solid color-mix(in srgb, var(--brand-500) 25%, transparent);
  border-radius: var(--ant-radius);
  font-size: 13px; color: var(--text-1);
}
.pro-alert b { color: var(--brand-500); }
.pro-alert .spacer { flex: 1; }
