/*
 * THMP 后台管理 - 现代化视觉基础样式表
 * 2026-07-26 新增，覆盖层，不修改 webarch.css 本体
 * 详见 back_file/2026-07-26-后台全站视觉美化规划.md
 * 引入方式：在 webarch.css 之后追加一行 <link>，纯覆盖不改变任何 DOM 结构/JS 行为
 */

:root {
  --thmp-primary: #2f6feb;
  --thmp-primary-dark: #2457c2;
  --thmp-primary-tint: #eaf1ff;
  --thmp-accent: #0aa699;
  --thmp-success: #16a673;
  --thmp-success-tint: #e7f7f1;
  --thmp-warning: #f59e0b;
  --thmp-warning-tint: #fef3e2;
  --thmp-danger: #e0453f;
  --thmp-danger-tint: #fdecec;
  --thmp-text: #26313f;
  --thmp-text-muted: #7c8896;
  --thmp-border: #e4e8ee;
  --thmp-border-soft: #edf0f4;
  --thmp-bg: #f3f5f8;
  --thmp-card-bg: #ffffff;
  --thmp-radius: 10px;
  --thmp-radius-sm: 6px;
  --thmp-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --thmp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* ---------- 1. 页面整体背景/字体 ---------- */
body {
  background-color: var(--thmp-bg) !important;
}
body,
.form-control,
.btn,
table {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Arial, sans-serif;
}

/* ---------- 2. 卡片/面板 .grid.simple ---------- */
.grid.simple {
  background: var(--thmp-card-bg);
  border-radius: var(--thmp-radius);
  box-shadow: var(--thmp-shadow);
  overflow: hidden;
  border: 1px solid var(--thmp-border-soft);
}
.grid.simple .grid-title {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--thmp-border-soft);
  background: var(--thmp-card-bg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.grid.simple .grid-title.no-border {
  border-bottom: 1px solid var(--thmp-border-soft);
}
.grid.simple .grid-title h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--thmp-text);
  margin: 0;
  white-space: nowrap;
}
.grid.simple .grid-title .tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.grid.simple .grid-title .tools .row-fluid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* 老代码在筛选组外层写死了 margin-top:-8px/-9px 之类的手调负边距来凑对齐，
   现在工具条是 flex + align-items:center，这些负边距反而把筛选组顶得比右侧操作图标高一截 */
.grid.simple .grid-title .tools > div {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  float: none;
}
.grid.simple .grid-title .tools .btn-group {
  margin: 0 !important;
}
.grid.simple .grid-body {
  padding: 20px 22px;
  color: var(--thmp-text);
  /* js/js.js:28 每次 resize 把 .grid-body 高度写死成视口高度（仅 thmpcms 豁免），
     而上方 .grid.simple 为裁圆角设了 overflow:hidden——两者叠加会把超出视口的内容
     直接裁掉且不给滚动条，运营根本不知道下面还有东西（实测 voice 被裁 219px、
     clitools 180px、applets 137px，多数页的分页控件也在裁切区外）。
     这里只把「裁掉」改成「可滚动」，不碰高度、不碰布局，元素位置零变化。
     方案：back_file/2026-08-05-后台页内容被裁切无法滚动全站排查与修复规划.md */
  overflow-y: auto;
}
.grid.simple .grid-body.no-padding {
  padding: 0;
}
/* 表格型卡片：表格四周都不需要外层留白——左右留白会让表格比工具条窄一圈，
   上方留白会在标题栏和表头之间留出一道空白缝。改由表格首尾列自带内边距顶到卡片边缘，
   视觉上和上方工具条对齐，表头直接贴住标题栏分隔线 */
.grid.simple .grid-body:has(> table),
.grid.simple .grid-body:has(> .dataTables_wrapper) {
  padding: 0 0 20px;
}

/* 工具条内的筛选下拉/输入框，统一高度和圆角，覆盖内联 min-height/width 造成的参差感 */
.grid-title .tools select.no-boarder,
.grid-title .tools input.no-boarder,
.grid-title .tools select,
.grid-title .tools input[type="text"],
.grid-title .tools input[type="search"] {
  height: 34px !important;
  min-height: 34px !important;
  line-height: 34px;
  border: 1px solid var(--thmp-border) !important;
  border-radius: var(--thmp-radius-sm) !important;
  padding: 0 10px;
  background-color: #fbfcfd;
  color: var(--thmp-text);
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.grid-title .tools select.no-boarder:focus,
.grid-title .tools input.no-boarder:focus {
  border-color: var(--thmp-primary) !important;
  box-shadow: 0 0 0 3px var(--thmp-primary-tint);
  outline: none;
}

/* 工具条图标按钮统一外观：搜索(.thmp-btn-icon)与右侧操作图标(.tools > a)共用同一套 32px 幽灵图标样式。
   webarch.css 的 `.grid-title .tools > a` 自带 height:16px 且比单类选择器更具体，故此处保留 !important 顶掉 */

/* display 单独拆出来，并排除「被内联样式隐藏」的元素。
   ★这里踩过坑：`display: inline-flex !important` 会连同 inline 的 display:none 一起顶掉，
   把按权限隐藏的 .lever 按钮强行显示出来；早期为此加了 `.lever{display:none!important}` 反向压制，
   结果又把 pagelayout/publicpage/mapmarkers/attribute 这几页「本来就该常显」
   （inline 只有 cursor:pointer、没有 display:none）的按钮全藏了。
   所以改成正向排除：只有未被内联隐藏的才给 flex，隐藏与否始终由 JS 写的内联 display 说话。 */
.grid-title .tools > a:not([style*="display:none"]):not([style*="display: none"]),
.grid-title .tools .thmp-btn-icon {
  display: inline-flex !important;
}

.grid-title .tools > a,
.grid-title .tools .thmp-btn-icon {
  align-items: center;
  justify-content: center;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 8px;
  background: transparent !important;
  color: var(--thmp-text-muted) !important;
  font-size: 14px;
  line-height: 1;
  box-shadow: none !important;
  /* webarch 的 .btn-cons 带 margin-bottom:8px，会把按钮在 flex 居中时顶高 4px */
  margin: 0 0 0 2px !important;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.grid-title .tools > a:hover,
.grid-title .tools .thmp-btn-icon:hover,
.grid-title .tools .thmp-btn-icon:focus {
  background-color: var(--thmp-primary-tint) !important;
  color: var(--thmp-primary) !important;
}
/* 搜索按钮历史上带 .reload 类，而 webarch 给 .reload 挂了 :before 伪元素图标，会和内部 <i> 图标重叠 */
.grid-title .tools .thmp-btn-icon:before {
  content: none !important;
}

/* ---------- 3. 按钮 ---------- */
.btn {
  border-radius: var(--thmp-radius-sm);
  font-weight: 500;
  box-shadow: none;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}
.btn:active {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}
.btn-primary {
  background-color: var(--thmp-primary);
  border-color: var(--thmp-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--thmp-primary-dark);
  border-color: var(--thmp-primary-dark);
}
.btn-success {
  background-color: var(--thmp-success);
  border-color: var(--thmp-success);
}
.btn-success:hover,
.btn-success:focus {
  filter: brightness(0.94);
}
.btn-danger {
  background-color: var(--thmp-danger);
  border-color: var(--thmp-danger);
}
.btn-default {
  background-color: #fff;
  border-color: var(--thmp-border);
  color: var(--thmp-text);
}
.btn-default:hover,
.btn-default:focus {
  background-color: #f5f7fa;
  border-color: #d3d9e0;
}
.btn-cons {
  border-radius: var(--thmp-radius-sm);
}

/* ---------- 4. 表单控件 ---------- */
.form-control {
  border: 1px solid var(--thmp-border);
  border-radius: var(--thmp-radius-sm);
  box-shadow: none;
  color: var(--thmp-text);
}
.form-control:focus {
  border-color: var(--thmp-primary);
  box-shadow: 0 0 0 3px var(--thmp-primary-tint);
}
label {
  color: var(--thmp-text);
  font-weight: 500;
}

/* ---------- 5. 表格 / DataTables ---------- */
.grid-body table.table,
table.dataTable {
  border-collapse: separate;
  border-spacing: 0;
}
.grid-body table.table > thead > tr > th,
table.dataTable thead > tr > th {
  background-color: #f7f9fb;
  color: var(--thmp-text-muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--thmp-border) !important;
  border-top: none !important;
  padding: 12px 14px;
  white-space: nowrap;
}
.grid-body table.table > tbody > tr > td,
table.dataTable tbody > tr > td {
  padding: 11px 14px;
  border-top: 1px solid var(--thmp-border-soft) !important;
  color: var(--thmp-text);
  vertical-align: middle;
}
.grid-body table.table > thead > tr > th:first-child,
.grid-body table.table > tbody > tr > td:first-child,
table.dataTable thead > tr > th:first-child,
table.dataTable tbody > tr > td:first-child {
  padding-left: 22px;
}
.grid-body table.table > thead > tr > th:last-child,
.grid-body table.table > tbody > tr > td:last-child,
table.dataTable thead > tr > th:last-child,
table.dataTable tbody > tr > td:last-child {
  padding-right: 22px;
}
.table-striped tbody > tr:nth-child(2n+1) > td,
.table-striped tbody > tr:nth-child(2n+1) > th {
  background-color: #fafbfd;
}
.table-striped > tbody > tr:hover > td,
table.dataTable tbody > tr:hover > td {
  background-color: var(--thmp-primary-tint) !important;
}
/* 表格底部工具条（分页 + 每页条数）：收口线与右对齐。
   问题一「列表没有收尾线」：td 只设 border-top（见上方 apple 层规则），
   最后一行下方本来就没有任何线，列表和分页之间是断开的。
   问题二「分页位置很奇怪」：webarch.css:10387 给 .col-md-6-flex 设了 padding-right:7%，
   百分比相对整行宽度解析 —— 屏幕越宽分页离右边缘越远（1440px 宽下实测 94px），
   像悬在半空。改为 15px，与表格右边缘（Bootstrap 列内边距）严格对齐。
   方案：back_file/2026-08-05-表格底部收口线与分页对齐修复方案.md */
.dataTables_wrapper > .row {
  border-top: 1px solid var(--thmp-border-soft);
  padding-top: 4px;
}
/* 行数少、撑不满滚动区时，上面那条线远在底部工具条处，最后一行下方是一大片空白、
   表格等于没收口（实测 exhibition?mode=config 只有 2 行时尤其明显）。
   故给最后一行补下边框，让列表在任何行数下都自我收口。
   表格撑满时该线与工具条线相距 1px，实测视觉上融为一条，不会出现双线。 */
.grid.simple .grid-body table.dataTable > tbody > tr:last-child > td,
.grid.simple .grid-body table.table > tbody > tr:last-child > td {
  border-bottom: 1px solid var(--thmp-border-soft);
}
.col-md-6-flex {
  padding-right: 15px;
  align-items: center;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--thmp-radius-sm) !important;
  margin: 0 2px;
  border-color: var(--thmp-border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--thmp-primary) !important;
  border-color: var(--thmp-primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border-radius: var(--thmp-radius-sm);
  border: 1px solid var(--thmp-border);
}
.dataTables_scroll {
  background-color: transparent !important;
}
.dataTables_empty {
  color: var(--thmp-text-muted);
  padding: 30px 0 !important;
}

/* ---------- 6. 弹窗 ---------- */
.modal-content {
  border-radius: var(--thmp-radius);
  border: none;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}
.modal-header {
  border-bottom: 1px solid var(--thmp-border-soft);
  padding: 16px 22px;
}
.modal-header h4 {
  font-weight: 600;
  color: var(--thmp-text);
}
.modal-body {
  padding: 20px 22px;
}
.modal-footer {
  border-top: 1px solid var(--thmp-border-soft);
  padding: 14px 22px;
}

/* ---------- 7. 状态标签 / badge ---------- */
.label {
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 500;
}
.label-success { background-color: var(--thmp-success); }
.label-danger { background-color: var(--thmp-danger); }
.label-warning { background-color: var(--thmp-warning); }
.label-primary { background-color: var(--thmp-primary); }

/* ---------- 8. 顶部 header / 左侧导航 轻量精修 ---------- */
.header.navbar.navbar-inverse {
  background-color: #1e2530;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.page-sidebar {
  background-color: #eef1f5 !important;
}
.page-sidebar .page-sidebar-wrapper > ul > li.active > a {
  color: var(--thmp-primary) !important;
  background-color: var(--thmp-primary-tint) !important;
}
.page-sidebar .page-sidebar-wrapper > ul > li.active > a i {
  color: var(--thmp-primary) !important;
}
.page-sidebar .page-sidebar-wrapper > ul > li > a:hover {
  background-color: #e4e9ef;
}

/* ---------- 9. 细节滚动条 (webkit) ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: #c7cdd6;
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background-color: transparent;
}
