/* ============================================
   ICTSVR Design System — 组件层
   依据：统一设计语言（Logo 主蓝 #00a1e9，Poppins+Roboto）
   加载顺序：bootstrap → variables → base → design-system（本文件最后，优先级最高）
   ============================================ */

/* ---------- 0. 基础排版（规范 2.3）---------- */
body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg-color);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--text-primary);
  font-family: var(--font-family-heading);
  font-weight: 600;
  line-height: 1.4;
}
h1, .h1 { font-size: 1.5rem; }
h2, .h2 { font-size: 1.25rem; }
h3, .h3 { font-size: 1.125rem; }
h4, .h4 { font-size: 1rem; }
h5, .h5 { font-size: var(--font-size-lg); }
h6, .h6 { font-size: var(--font-size-base); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

small, .small, .text-small { font-size: var(--font-size-xs); }
.text-muted, .text-secondary { color: var(--text-light) !important; }

/* ---------- 1. 容器 ---------- */
/* 恢复 Bootstrap 默认容器宽度（大屏 1320px），不再整体压缩 */

/* ---------- 2. 导航栏（规范 3.1）---------- */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  padding-top: 0;
  padding-bottom: 0;
  min-height: var(--navbar-height);
}
.navbar > .container,
.navbar > .container-fluid { min-height: var(--navbar-height); }
.navbar-brand {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.navbar-brand img { max-height: 34px; width: auto; }

.navbar .nav-link,
.nav-link {
  padding: .45rem .8rem;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.navbar .nav-link:hover,
.nav-link:hover { background: var(--bg-tertiary); color: var(--brand); }
.navbar .nav-link.active,
.navbar-nav .nav-link.active,
.nav-link.active {
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 600;
}
/* 去掉 Bootstrap 的下划线伪元素，改用规范胶囊底 */
.navbar-nav .nav-link.active::after { display: none; }

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-lg);
  padding: .35rem;
  font-size: var(--font-size-base);
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: .45rem .7rem;
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}
.dropdown-item:hover,
.dropdown-item:focus { background: var(--brand-bg); color: var(--brand-dark); }
.dropdown-item:active { background: var(--brand); color: #fff; }

/* 移动端：<lg 横向滚动次级导航条 */
@media (max-width: 991.98px) {
  .nav-scroll {
    display: flex;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    background: #fff;
    -webkit-overflow-scrolling: touch;
  }
  .nav-scroll::-webkit-scrollbar { display: none; }
  .nav-scroll .nav-link { white-space: nowrap; }
}

/* ---------- 3. 按钮（规范 4.1）---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  border-radius: var(--radius-btn);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.4;
  padding: var(--btn-padding-base);
  border: 1px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast), box-shadow var(--transition-fast),
              transform var(--transition-fast);
}
.btn:focus,
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(0, 168, 232, .2); outline: none; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  border-color: var(--border-dark);
  color: var(--text-secondary);
}
.btn-secondary:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
}
.btn-ghost:hover { background: var(--brand-bg); color: var(--brand-dark); }

.btn-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }

.btn-outline-primary {
  background: #fff;
  border-color: var(--brand);
  color: var(--brand);
}
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.btn-sm { padding: var(--btn-padding-sm); border-radius: var(--radius-sm); font-size: var(--font-size-sm); }
.btn-lg { padding: var(--btn-padding-lg); }

.btn:disabled,
.btn.disabled { opacity: .55; }

/* 首页 CTA 渐变（靛蓝渐变，走 token） */
.welcome-actions .btn {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.welcome-actions .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ---------- 4. 徽章 / 胶囊（规范 4.2）---------- */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: .35em .7em;
}
.badge-brand  { background: var(--brand-bg);   color: var(--brand-dark); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-gray   { background: var(--bg-tertiary);color: var(--text-light); }
.badge-orange { background: var(--warning-bg); color: var(--warning); }
.badge-red    { background: var(--danger-bg);  color: var(--danger); }
.badge-blue   { background: var(--info-bg);    color: var(--info); }

.badge-src-center { background: var(--info-bg);    color: var(--info); }
.badge-src-school { background: var(--bg-tertiary); color: var(--text-light); }
.badge-cert-premium { background: #fffbeb; color: #b45309; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-full);
  background: var(--brand-bg);
  color: var(--brand-dark);
  font-size: 12px;
  padding: .3em .8em;
}
.pill-gray { background: var(--bg-tertiary); color: var(--text-light); }

/* ---------- 5. 卡片 / 分区（规范 4.3）---------- */
.card {
  background: var(--card-bg);
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card + .card { margin-top: var(--space-lg); }
.card-body { padding: 1.25rem 1.5rem; }
.card-header {
  background: transparent;
  border: 0;
  border-bottom: 0;
  padding: 1.1rem 1.5rem .4rem;
  font-family: var(--font-family-heading);
  font-weight: 600;
  color: var(--text-primary);
}
/* 紧凑表头（后台仪表盘 / 统计卡）保持紧凑间距 */
.card-header.compact,
.card-header.bg-light,
.card-sm .card-header,
.card.compact .card-header {
  padding: .75rem 1.25rem;
}
.card-footer { background: #fff; border-top: 1px solid var(--border); padding: .9rem 1.5rem; }
.card-title { font-size: var(--font-size-lg); font-weight: 600; color: var(--text-primary); }

/* 栅格内卡片间距归零 */
.row > [class*="col-"] .card + .card,
.card-deck .card + .card,
.grid > .card + .card { margin-top: 0; }

.section {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 1.5rem;
}
.section + .section { margin-top: var(--space-lg); }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding-left: .75rem;
  border-left: 3px solid var(--brand);
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.section-title .count {
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-light);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: .2em .7em;
}

.detail-stack { display: flex; flex-direction: column; gap: var(--space-lg); }
.detail-stack > * { margin-top: 0 !important; margin-bottom: 0 !important; }

/* ---------- 6. 数据表（规范 4.4）---------- */
.data-table,
.table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--font-size-base);
}
.data-table thead th,
.table thead th {
  background: #f9fafb;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding: .7rem .9rem;
  white-space: nowrap;
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-btn); }
.data-table thead th:last-child  { border-top-right-radius: var(--radius-btn); }
.data-table tbody td,
.table tbody td {
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr:hover,
.table tbody tr:hover { background: var(--brand-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions,
.table .actions { text-align: right; white-space: nowrap; }
.data-table .col-name,
.table .col-name { white-space: nowrap; min-width: 4.5em; }
.data-table .row-top,
.table .row-top { background: #fffbeb; }

.table-responsive {
  border-radius: var(--radius-card);
  border: 1px solid var(--border-light);
  background: #fff;
}

/* ---------- 7. 表单（规范 4.5）---------- */
.form-control,
.form-select,
.form-control:disabled {
  height: var(--form-control-height);
  padding: var(--form-control-padding);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-btn);
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  background-color: #fff;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea.form-control { height: auto; min-height: 90px; }
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-light);
  box-shadow: var(--form-control-focus-ring);
  outline: none;
}
.form-control::placeholder { color: var(--text-muted); }

/* select 去原生箭头，自定义 SVG 箭头 */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}

.form-label,
label {
  font-size: var(--font-size-base);
  font-weight: var(--form-label-weight);
  color: var(--text-primary);
  margin-bottom: .35rem;
}
label.required::after,
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
}
.form-stack { display: flex; flex-direction: column; gap: var(--space-md); width: 100%; }
@media (max-width: 767.98px) {
  .form-grid { grid-template-columns: 1fr; }
}

.errorlist,
.form-error {
  color: var(--danger);
  font-size: var(--font-size-xs);
  list-style: none;
  margin: .25rem 0 0;
  padding: 0;
}
.form-text, .help-text { font-size: var(--font-size-xs); color: var(--text-light); }

.input-group .btn { height: var(--form-control-height); }

/* ---------- 8. 头像（规范 4.6）---------- */
.avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  flex-shrink: 0;
}
.avatar-lg { width: 3rem; height: 3rem; font-size: var(--font-size-lg); }

/* 消息中心 / 聊天 */
.msg-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
}
.msg-row.unread { border-left-color: var(--brand); background: var(--brand-bg); }
.chat-mine,
.chat-other {
  max-width: 72%;
  padding: .55rem .85rem;
  border-radius: var(--radius-btn);
  font-size: var(--font-size-base);
  line-height: 1.5;
}
.chat-mine  { background: var(--brand-bg); color: var(--text-primary); margin-left: auto; }
.chat-other { background: var(--bg-tertiary); color: var(--text-primary); margin-right: auto; }

/* ---------- 9. 搜索 / 筛选 / 分页（规范 4.7）---------- */
.search-bar { display: flex; gap: .5rem; flex-wrap: wrap; }
.filter-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-bar > * { min-width: 120px; flex: 1 1 120px; }

.pagination { gap: .25rem; margin: 0; }
.pagination .page-link {
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  padding: .35rem .7rem;
}
.pagination .page-link:hover { background: var(--brand-bg); color: var(--brand-dark); border-color: var(--brand-light); }
.pagination .active > .page-link,
.pagination .page-link.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.upload-zone {
  border: 1.5px dashed var(--border-dark);
  border-radius: var(--radius-card);
  background: var(--bg-secondary);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-light);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.upload-zone:hover { border-color: var(--brand-light); background: var(--brand-bg); }

.exp-item { position: relative; padding-left: 1.25rem; }
.exp-item::before {
  content: '';
  position: absolute;
  left: .1rem;
  top: .55rem;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--brand);
}
.exp-item::after {
  content: '';
  position: absolute;
  left: .38rem;
  top: 1.1rem;
  bottom: -.4rem;
  width: 1px;
  border-left: 1px dashed var(--border-dark);
}
.exp-item:last-child::after { display: none; }

.cp-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--brand-bg);
  color: var(--brand-dark);
  border-radius: var(--radius-full);
  font-size: 12px;
  padding: .25em .7em;
}

/* ---------- 10. 工作台骨架（规范 3.2）---------- */
.wb-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.wb-topbar-inner {
  width: 100%;
  height: 100%;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wb-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}
.wb-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-btn);
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.wb-topbar-actions { display: flex; align-items: center; gap: .5rem; }

.workbench {
  display: flex;
  min-height: calc(100vh - var(--topbar-height));
  align-items: stretch;
}
.wb-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 1rem .75rem;
}
.wb-sidebar-title {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .25rem .6rem .5rem;
}
.wb-nav-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .7rem;
  border-radius: var(--radius-nav);
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  margin-bottom: .15rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.wb-nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.wb-nav-item.active {
  background: var(--brand-bg);
  color: var(--brand-dark);
  font-weight: 600;
}
.wb-nav-item i { width: 1.1em; text-align: center; color: var(--text-muted); }
.wb-nav-item.active i { color: var(--brand); }

.wb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wb-tabs {
  display: flex;
  gap: 1.25rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: #fff;
  overflow-x: auto;
}
.wb-tab {
  padding: .7rem 0;
  border-bottom: 2px solid transparent;
  color: var(--text-light);
  font-size: var(--font-size-base);
  white-space: nowrap;
}
.wb-tab:hover { color: var(--brand); }
.wb-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.wb-content { padding: 1.25rem; }
/* 通栏：内容紧贴左侧栏，不再 max-width 居中（否则宽屏下侧栏与内容之间出现大片留白） */
.wb-content-inner { width: 100%; }

.wb-overlay { display: none; }
.wb-hamburger { display: none; }

@media (max-width: 767.98px) {
  .wb-hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    background: #fff;
    color: var(--text-secondary);
  }
  .wb-sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    z-index: var(--z-sidebar);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
  }
  .wb-sidebar.open { transform: translateX(0); }
  .wb-overlay {
    display: none;
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    background: rgba(17, 24, 39, .35);
    z-index: calc(var(--z-sidebar) - 1);
  }
  .wb-overlay.show { display: block; }
}

/* ---------- 11. 富文本正文（规范 6.5）---------- */
.richtext-body ul,
.richtext-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.richtext-body ul { list-style: disc; }
.richtext-body ol { list-style: decimal; }
.richtext-body li { margin-bottom: .35rem; }
.richtext-body p { margin-bottom: .9rem; }
.richtext-body img { max-width: 100%; height: auto; border-radius: var(--radius-btn); }
.richtext-body h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
.richtext-body h3 { font-size: 1.125rem; margin: 1.25rem 0 .6rem; }
.richtext-body table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.richtext-body th,
.richtext-body td { border: 1px solid var(--border); padding: .5rem .7rem; }
.richtext-body th { background: #f9fafb; font-weight: 600; }

/* ---------- 12. 提示框 ---------- */
.alert {
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-size: var(--font-size-base);
  padding: .7rem 1rem;
}
.alert-success { background: var(--success-bg); border-color: #a7f3d0; color: #047857; }
.alert-warning { background: var(--warning-bg); border-color: #fed7aa; color: #b45309; }
.alert-danger  { background: var(--danger-bg);  border-color: #fecaca; color: #b91c1c; }
.alert-info    { background: var(--info-bg);    border-color: #bfdbfe; color: #1d4ed8; }

/* ---------- 13. 页脚（深色底，与 base.css 页脚子样式配套）---------- */
footer {
  background: var(--bg-dark);
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .85);
  font-size: var(--font-size-sm);
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
}
footer h5,
footer h6 { color: #fff; font-size: var(--font-size-base); font-weight: 600; margin-bottom: 1rem; }
footer a { color: rgba(255, 255, 255, .8); }
footer a:hover { color: #fff; }
footer .text-muted,
footer .footer-description { color: rgba(255, 255, 255, .7) !important; }
footer hr { border-color: rgba(255, 255, 255, .1); opacity: 1; }
.footer-link { display: inline-flex; align-items: center; }
.contact-list li { margin-bottom: .5rem; }
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: #fff;
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}
.social-link:hover { background: var(--brand-bg); border-color: var(--brand-light); }

/* ---------- 14. 工具类补充 ---------- */
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
}
.stack { display: flex; flex-direction: column; gap: var(--space-lg); }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: var(--font-size-base);
}
.empty-state i { font-size: 2.5rem; color: var(--border-dark); display: block; margin-bottom: .75rem; }
