/* ============================================================
   智能简历筛选 V3 — 设计系统 Tokens
   风格：数据密集 + 暖色调（米白底 + 深棕主色）
   完全采用 Claude Design 输出的「荐才」HR 工具风格
   ============================================================ */

:root {
  /* —— 中性色（米白 / 暖灰） —— */
  --bg-page:        #F6F1E8;
  --bg-surface:     #FBF7EF;
  --bg-elevated:    #FFFFFF;
  --bg-muted:       #EFE7D7;
  --bg-hover:       #ECE2CE;
  --bg-active:      #E3D5B8;

  /* —— 主色：深棕 —— */
  --brand-50:       #F5EDE0;
  --brand-100:      #E9D9BD;
  --brand-200:      #D4B988;
  --brand-300:      #B89360;
  --brand-400:      #8E6A3E;
  --brand-500:      #6B4A28;
  --brand-600:      #543719;
  --brand-700:      #3F2810;

  /* —— 文字 —— */
  --text-primary:   #2A1F12;
  --text-secondary: #5C4A36;
  --text-tertiary:  #8B7B65;
  --text-disabled:  #B8AC97;
  --text-inverse:   #FBF7EF;

  /* —— 边框 —— */
  --border-subtle:  #E5DAC4;
  --border-default: #D4C4A6;
  --border-strong:  #B89F76;

  /* —— 状态色（暖色调 friendly） —— */
  --success-bg:     #E8EFDD;
  --success-fg:     #4A6228;
  --success-border: #BFD08A;

  --warning-bg:     #F6E6C9;
  --warning-fg:     #8A5A14;
  --warning-border: #D9B774;

  --danger-bg:      #F1D9CE;
  --danger-fg:      #8B3A1E;
  --danger-border:  #D89B7E;

  --info-bg:        #DCE4E8;
  --info-fg:        #2F5063;
  --info-border:    #9CB3BE;

  /* —— 匹配度色阶（百分比条用） —— */
  --match-high:     #6B8E3D;
  --match-mid:      #C68A2E;
  --match-low:      #B5573A;

  /* —— 阴影 —— */
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.04);
  --shadow-md: 0 2px 8px rgba(60, 40, 20, 0.06), 0 1px 2px rgba(60, 40, 20, 0.04);
  --shadow-lg: 0 8px 24px rgba(60, 40, 20, 0.10), 0 2px 6px rgba(60, 40, 20, 0.05);

  /* —— 圆角 —— */
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* —— 间距 —— */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* —— 字号（数据密集型偏紧凑） —— */
  --fs-xs:  11px;
  --fs-sm:  12px;
  --fs-base:13px;
  --fs-md:  14px;
  --fs-lg:  16px;
  --fs-xl:  18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;

  /* —— 字体 —— */
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;

  /* —— 行高 —— */
  --lh-tight: 1.3;
  --lh-base:  1.55;
  --lh-loose: 1.75;

  /* —— 过渡 —— */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 400ms ease;

  /* —— Z-index 层级 —— */
  --z-dropdown: 100;
  --z-sticky: 500;
  --z-drawer: 900;
  --z-modal: 1000;
  --z-toast: 2000;
  --z-tooltip: 3000;

  /* —— 布局尺寸 —— */
  --topbar-h: 52px;
  --sidebar-w: 220px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "tnum" 1, "kern" 1;
  height: 100vh;
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

ul, ol { list-style: none; padding: 0; margin: 0; }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Selection */
::selection { background: var(--brand-200); color: var(--brand-700); }

/* Focus */
:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* ============================================================
   通用工具类
   ============================================================ */
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--success-fg); }
.text-warning { color: var(--warning-fg); }
.text-danger { color: var(--danger-fg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }

/* ============================================================
   通用基础组件
   ============================================================ */

/* 卡片 */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* Section 卡片 */
.section-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.section-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  font-family: var(--font-serif);
}
.section-body { padding: 8px 0; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand-500);
  color: var(--text-inverse);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-600); color: var(--text-inverse); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger {
  background: var(--danger-fg);
  color: var(--text-inverse);
}
.btn-danger:hover:not(:disabled) { background: #6F2D17; color: var(--text-inverse); }
.btn-secondary.btn-danger {
  background: var(--bg-elevated);
  color: var(--danger-fg);
  border-color: var(--danger-border);
}
.btn-secondary.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm { height: 26px; padding: 0 10px; font-size: var(--fs-sm); }
.btn-lg { height: 38px; padding: 0 18px; font-size: var(--fs-lg); }
.btn-icon-only {
  width: 32px;
  padding: 0;
}
.btn-icon-only.btn-sm { width: 26px; }

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: var(--fs-xs);
  font-weight: 500;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.tag-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-border); }
.tag-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-border); }
.tag-danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-border); }
.tag-info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-border); }
.tag-brand   { background: var(--brand-50);   color: var(--brand-600);  border-color: var(--brand-100); }

/* 输入框 */
.input {
  height: 32px;
  padding: 0 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
  width: 100%;
}
.input:focus { border-color: var(--brand-400); }
.input::placeholder { color: var(--text-tertiary); }
textarea.input { height: auto; padding: 8px 10px; line-height: var(--lh-base); resize: vertical; }

/* Select */
.select {
  height: 28px;
  padding: 0 24px 0 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%238B7B65' d='M5 7L1 3h8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  outline: none;
}
.select:focus { border-color: var(--brand-400); }
.select.input { height: 32px; padding-right: 28px; font-size: var(--fs-md); }

/* 分隔线 */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 16px 0;
}
.vdivider {
  width: 1px;
  background: var(--border-subtle);
  align-self: stretch;
}

/* Avatar */
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-200);
  color: var(--brand-700);
  display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
  font-family: var(--font-serif);
  flex-shrink: 0;
}
.avatar-lg {
  width: 64px; height: 64px;
  font-size: 24px;
}

/* Field */
.field-group {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
}
.field-label .required { color: var(--danger-fg); margin-left: 2px; }
.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.3s ease-out; }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-muted);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }

/* Loading */
.loading-container {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px;
  gap: 12px;
}
.loading-text {
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  font-size: var(--fs-md);
}
.empty-icon {
  font-size: 32px;
  color: var(--text-disabled);
  margin-bottom: 12px;
}
.empty-text {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.empty-hint {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  max-width: 380px;
  margin: 0 auto 16px;
  line-height: var(--lh-base);
}

/* Print */
@media print {
  body { overflow: visible; height: auto; background: white; }
  .topbar, .sidebar, .toast-container, .modal-root, .drawer, .help-drawer,
  .filter-bar, .page-header-row > div:last-child, .lib-toolbar-batch,
  .results-batch-bar { display: none !important; }
  .app { display: block; height: auto; }
  .main { overflow: visible; }
  .section-card, .resume-content { break-inside: avoid; }
}
