@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* === 品牌色 — 森林绿系统 === */
  --green-950: #0F1F12;
  --green-900: #1A2E1D;
  --green-800: #2D5E35;
  --green-700: #3C623F;
  --green-600: #00693E;
  --green-500: #2E8B57;
  --green-400: #4CAF50;
  --green-300: #81C784;
  --green-200: #A5D6A7;
  --green-100: #C8E6C9;
  --green-50: #E8F5E9;

  /* === 品牌字体 === */
  --brand-title: 'Noto Serif SC', 'Songti SC', serif;

  /* === 暖色中性系 === */
  --warm-50: #F7F6F4;
  --warm-100: #E5E4E2;
  --warm-200: #D6D4D2;
  --warm-300: #C4C2BF;
  --warm-400: #B0AEAB;
  --warm-500: #9A9895;

  /* === 页面差异化色 === */
  --page-dashboard: #3C623F;
  --page-match: #2D5E35;
  --page-report: #00693E;
  --page-auto: #2E8B57;
  --page-history: #4B5563;
  --page-guide: #1A2E1D;

  /* === 功能色 === */
  --amber: #F59E0B;
  --red: #DC2626;
  --red-light: #FEE2E2;

  /* === 文字 === */
  --text-primary: #1A1A1A;
  --text-secondary: #4B5563;
  --text-tertiary: #9CA3AF;
  --text-on-brand: #FFFFFF;

  /* === 圆角系统 === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* === 阴影 === */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-modal: 0 10px 40px rgba(0,0,0,0.12);
  --shadow-sidebar: 4px 0 20px rgba(0,0,0,0.08);

  /* === 字体 === */
  --font-heading: 'Noto Serif SC', 'Songti SC', serif;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--warm-50);
}

/* === 品牌字体 === */
.font-heading {
  font-family: var(--font-heading);
}

/* === Lucide 图标 === */
.lu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lu-sm { width: 14px; height: 14px; }
.lu-md { width: 18px; height: 18px; }
.lu-lg { width: 22px; height: 22px; }
.lu-xl { width: 28px; height: 28px; }

/* === 图标包装器 === */
.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}
.icon-wrap-sm { width: 28px; height: 28px; border-radius: 6px; }
.icon-wrap-lg { width: 48px; height: 48px; border-radius: 12px; }

/* === 品牌按钮 === */
.btn-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  line-height: 1.4;
  font-family: var(--font-body);
}
.btn-brand:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-brand-primary {
  background: var(--green-700);
  color: white;
}
.btn-brand-primary:hover:not(:disabled) {
  background: var(--green-800);
  box-shadow: 0 2px 8px rgba(60, 98, 63, 0.3);
  transform: translateY(-1px);
}
.btn-brand-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-brand-secondary {
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-200);
}
.btn-brand-secondary:hover:not(:disabled) {
  background: var(--green-100);
}

.btn-brand-ghost {
  background: transparent;
  color: var(--green-700);
}
.btn-brand-ghost:hover:not(:disabled) {
  background: var(--green-50);
}

/* === 品牌卡片 === */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--warm-100);
}
.card:hover {
  box-shadow: var(--shadow-elevated);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--warm-100);
}

.card-body {
  padding: 1.5rem;
}

/* === 品牌输入框 === */
.input-brand {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--warm-200);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-family: var(--font-body);
  outline: none;
  transition: all 0.2s ease;
  background: white;
  color: var(--text-primary);
}
.input-brand:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(60, 98, 63, 0.12);
}
.input-brand::placeholder {
  color: var(--warm-400);
}

/* === 品牌标签 === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}
.badge-green {
  background: var(--green-50);
  color: var(--green-700);
}
.badge-warm {
  background: var(--warm-100);
  color: var(--text-secondary);
}
.badge-amber {
  background: #FEF3C7;
  color: #92400E;
}

/* === 进度条 === */
.progress-brand {
  height: 6px;
  background: var(--warm-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-brand-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === 表格 === */
.table-brand {
  width: 100%;
  border-collapse: collapse;
}
.table-brand th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--warm-50);
  border-bottom: 1px solid var(--warm-100);
}
.table-brand td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--warm-100);
  color: var(--text-primary);
}
.table-brand tr:last-child td {
  border-bottom: none;
}
.table-brand tbody tr {
  transition: background 0.15s ease;
}
.table-brand tbody tr:hover {
  background: var(--green-50);
}

/* === 弹窗 === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  max-height: 85vh;
  overflow: auto;
  width: 100%;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--warm-100);
}
.modal-body {
  padding: 1.5rem;
}

/* === Toast 通知 === */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
}
.toast-success {
  background: var(--green-700);
  color: white;
}
.toast-error {
  background: var(--red);
  color: white;
}
.toast-info {
  background: var(--green-800);
  color: white;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* === 侧边栏 === */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--green-900) 0%, var(--green-950) 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  box-shadow: var(--shadow-sidebar);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.6);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  font-family: var(--font-body);
  text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}
.nav-item.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-icon {
  background: var(--green-600);
}
.nav-item:not(.active) .nav-icon {
  background: rgba(255,255,255,0.06);
}

.nav-label {
  flex: 1;
  min-width: 0;
}
.nav-label-title {
  font-weight: 500;
  font-size: 0.875rem;
}
.nav-label-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
  margin-top: 1px;
}

/* === 登录页 === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 50%, var(--green-900) 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.03) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(60,98,63,0.2) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  margin: 0 1rem;
  position: relative;
}

.login-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(60, 98, 63, 0.2);
}

/* === 候选人气泡 === */
.candidate-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-xl);
  background: var(--warm-50);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 72px;
}
.candidate-bubble:hover {
  background: var(--green-50);
  border-color: var(--green-200);
  transform: translateY(-2px);
}
.candidate-bubble.selected {
  background: var(--green-50);
  border-color: var(--green-700);
  box-shadow: 0 2px 8px rgba(60, 98, 63, 0.2);
}

/* === 排名卡片 === */
.rank-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border: 1px solid var(--warm-100);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  cursor: pointer;
}
.rank-card:hover {
  border-color: var(--green-200);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

.rank-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.rank-1 { background: linear-gradient(135deg, #F59E0B, #F97316); color: white; }
.rank-2 { background: linear-gradient(135deg, #9CA3AF, #6B7280); color: white; }
.rank-3 { background: linear-gradient(135deg, #D97706, #B45309); color: white; }
.rank-other { background: var(--warm-100); color: var(--text-secondary); }

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
}

.rank-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.rank-scores {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.rank-score-item {
  text-align: center;
  min-width: 48px;
}

.rank-score-nb {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.rank-score-label {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === 进度步骤指示器 === */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
.step-dot.active {
  background: var(--green-700);
  color: white;
  box-shadow: 0 2px 8px rgba(60, 98, 63, 0.3);
}
.step-dot.done {
  background: var(--green-100);
  color: var(--green-700);
}
.step-dot.pending {
  background: var(--warm-100);
  color: var(--text-tertiary);
}
.step-label {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.step-label.active { color: var(--green-700); }
.step-label.done { color: var(--green-600); }
.step-label.pending { color: var(--text-tertiary); }
.step-connector {
  flex: 1;
  height: 2px;
  min-width: 16px;
  border-radius: 1px;
  transition: all 0.3s ease;
}
.step-connector.done { background: var(--green-400); }
.step-connector.pending { background: var(--warm-200); }

/* === 页面差异化头部 === */
.page-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.page-banner-dashboard {
  background: linear-gradient(135deg, #1A2E1D 0%, #3C623F 100%);
}
.page-banner-match {
  background: linear-gradient(135deg, #0F1F12 0%, #2D5E35 100%);
}
.page-banner-report {
  background: linear-gradient(135deg, #1A2E1D 0%, #00693E 100%);
}
.page-banner-auto {
  background: linear-gradient(135deg, #0F1F12 0%, #2E8B57 100%);
}
.page-banner-history {
  background: linear-gradient(135deg, #1F2937 0%, #4B5563 100%);
}
.page-banner-guide {
  background: linear-gradient(135deg, #0F1F12 0%, #1A2E1D 100%);
}
.page-banner h3 {
  color: white;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}
.page-banner p {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* === Loading spinner === */
.loading-spinner {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* === Fade in === */
.fade-in {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Pulse dot === */
.pulse-dot {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === 滚动条美化 === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--warm-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--warm-400);
}

/* === 响应式 === */
@media (max-width: 1280px) {
  .nav-label-sub {
    display: none;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-header h1,
  .sidebar-header p,
  .nav-label {
    display: none;
  }
  .sidebar-header {
    justify-content: center;
    padding: 1rem 0;
  }
  .nav-item {
    justify-content: center;
    padding: 0.7rem;
  }
}
