/* AdvisorPilot - 词典管理页专用样式（复用 style.css 的 CSS 变量） */

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-success {
  background: var(--color-success);
  color: white;
  border: 1px solid var(--color-success);
}

.btn-success:hover {
  background: #047857;
  border-color: #047857;
}

.btn-danger-subtle {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid transparent;
  padding: 4px 8px;
}

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

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ---------- 统计卡 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.color-success  { color: var(--color-success); }
.color-warning  { color: var(--color-warning); }
.color-info     { color: var(--color-info); }
.color-muted    { color: var(--color-text-muted); }
.color-danger   { color: var(--color-danger); }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-left #filter-keyword {
  min-width: 240px;
}

.input {
  padding: 7px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg-card);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--color-primary);
}

.input-sm {
  padding: 6px 8px;
  font-size: 12px;
}

/* ---------- 表格 ---------- */
.terms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.terms-table th,
.terms-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.terms-table th {
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-muted);
  background: #fafbfc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.terms-table tbody tr:hover {
  background: var(--color-primary-light);
}

.terms-table .empty-row {
  text-align: center;
  color: var(--color-text-light);
  padding: 40px 0;
}

.terms-table .term-cell {
  font-weight: 500;
  color: var(--color-text);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.badge-seed    { background: #f3f4f6; color: #4b5563; }
.badge-mined   { background: var(--color-info-bg); color: var(--color-info); }
.badge-manual  { background: var(--color-warning-bg); color: var(--color-warning); }

.badge-active   { background: var(--color-success-bg); color: var(--color-success); }
.badge-disabled { background: #f3f4f6; color: #6b7280; }

.df-tf {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--color-text-muted);
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 4px 0;
  border-top: 1px solid var(--color-border);
  margin-top: 12px;
}

.pager-buttons {
  display: flex;
  gap: 8px;
}

.muted { color: var(--color-text-muted); font-size: 12px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-mask.hidden { display: none; }

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}

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

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--color-border);
}

.form-row {
  margin-bottom: 14px;
}

.form-row label {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.form-row .input {
  width: 100%;
}

.form-row textarea.input {
  resize: vertical;
  min-height: 60px;
}

.checkbox-row {
  display: flex;
  align-items: center;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--color-text);
  font-size: 13px;
}

/* ---------- 挖掘结果区 ---------- */
.mine-result {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}

.mine-result.hidden { display: none; }

.mine-result .result-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.mine-result .candidate-list {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  color: var(--color-text-muted);
}

.mine-result .candidate-list .cand-item strong {
  color: var(--color-text);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  z-index: 200;
  max-width: 80vw;
}

.toast.hidden { display: none; }
.toast.toast-success { background: var(--color-success); }
.toast.toast-error   { background: var(--color-danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .toolbar-left,
  .toolbar-right {
    flex: 1;
  }
  .terms-table th:nth-child(4),
  .terms-table td:nth-child(4),
  .terms-table th:nth-child(8),
  .terms-table td:nth-child(8),
  .terms-table th:nth-child(9),
  .terms-table td:nth-child(9) {
    display: none;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
