/* ===== LexiRank Enterprise Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core palette */
  --bg-primary: #060b1a;
  --bg-secondary: #0a1030;
  --bg-card: #0f1740;
  --bg-elevated: #151e50;
  --bg-hover: #1a2560;
  --border-subtle: rgba(96, 165, 250, 0.12);
  --border-medium: rgba(96, 165, 250, 0.22);
  --border-bright: rgba(96, 165, 250, 0.4);

  /* Text */
  --text-primary: #e8edf5;
  --text-secondary: #94a3c8;
  --text-tertiary: #5c6e9a;
  --text-muted: #3d4a70;

  /* Brand colors */
  --accent: #60a5fa;
  --accent-glow: rgba(96, 165, 250, 0.3);
  --accent-strong: #3b82f6;
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.25);
  --warning: #fbbf24;
  --danger: #f87171;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --pink: #f472b6;

  /* Tier colors */
  --tier-frontier: #60a5fa;
  --tier-balanced: #34d399;
  --tier-budget: #fbbf24;
  --tier-opensource: #a78bfa;
  --tier-reasoning: #f472b6;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadow */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(96, 165, 250, 0.08);

  /* Layout */
  --nav-height: 64px;
  --max-width: 1440px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(96, 165, 250, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(167, 139, 250, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Navigation ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 16, 48, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 40px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex: 1;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-meta {
  margin-left: auto;
}

.update-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 120px 32px 80px;
  text-align: center;
  overflow: hidden;
  z-index: 1;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle 600px at 50% 0%, rgba(96, 165, 250, 0.08) 0%, transparent 70%),
    radial-gradient(circle 400px at 80% 100%, rgba(167, 139, 250, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 40%, #34d399 70%, #60a5fa 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto 48px;
  font-weight: 400;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 36px;
  text-align: center;
  min-width: 140px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-value {
  display: block;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Main Container ===== */
.main-container {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 32px;
}

/* ===== Sections ===== */
.section {
  margin-bottom: 80px;
}

.section-header {
  margin-bottom: 32px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.section-desc {
  color: var(--text-tertiary);
  font-size: 15px;
  line-height: 1.6;
}

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-input {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  width: 300px;
  transition: all 0.2s ease;
  outline: none;
}

.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 36px 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3c8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Table ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.leaderboard-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.leaderboard-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 14px 14px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 2px solid var(--border-subtle);
  cursor: default;
  user-select: none;
}

.leaderboard-table th.sortable {
  cursor: pointer;
  transition: color 0.2s;
}

.leaderboard-table th.sortable:hover {
  color: var(--accent);
}

.leaderboard-table th.sortable::after {
  content: ' ⇅';
  opacity: 0.3;
  font-size: 10px;
}

.leaderboard-table th.sortable.sorted-asc::after {
  content: ' ▲';
  opacity: 1;
  color: var(--accent);
}

.leaderboard-table th.sortable.sorted-desc::after {
  content: ' ▼';
  opacity: 1;
  color: var(--accent);
}

.leaderboard-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.leaderboard-table tbody tr {
  transition: all 0.15s ease;
}

.leaderboard-table tbody tr:hover {
  background: var(--bg-hover);
}

/* Rank styling */
.rank-cell {
  font-weight: 700;
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary);
  text-align: center;
}

.rank-1 { color: #fbbf24 !important; font-size: 18px; }
.rank-2 { color: #c0c0c0 !important; font-size: 17px; }
.rank-3 { color: #cd7f32 !important; font-size: 16px; }

/* Model name */
.model-name {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-name small {
  display: block;
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 11px;
  margin-top: 2px;
}

/* Provider */
.provider-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.provider-openai { background: rgba(16, 163, 127, 0.15); color: #10a37f; }
.provider-anthropic { background: rgba(212, 119, 87, 0.15); color: #d47757; }
.provider-google { background: rgba(66, 133, 244, 0.15); color: #4285f4; }
.provider-deepseek { background: rgba(79, 70, 229, 0.15); color: #818cf8; }
.provider-xai { background: rgba(255, 255, 255, 0.12); color: #ccc; }
.provider-moonshot { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.provider-alibaba { background: rgba(255, 106, 0, 0.15); color: #ff6a00; }
.provider-zai { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.provider-minimax { background: rgba(236, 72, 153, 0.15); color: #f472b6; }
.provider-meta { background: rgba(0, 119, 242, 0.15); color: #0077f2; }
.provider-mistral { background: rgba(250, 153, 27, 0.15); color: #fa991b; }
.provider-tencent { background: rgba(0, 196, 255, 0.15); color: #00c4ff; }

/* Tier badge */
.tier-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.tier-frontier { background: var(--tier-frontier); box-shadow: 0 0 6px rgba(96, 165, 250, 0.5); }
.tier-balanced { background: var(--tier-balanced); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.tier-budget { background: var(--tier-budget); box-shadow: 0 0 6px rgba(251, 191, 36, 0.5); }
.tier-opensource { background: var(--tier-opensource); box-shadow: 0 0 6px rgba(167, 139, 250, 0.5); }
.tier-reasoning { background: var(--tier-reasoning); box-shadow: 0 0 6px rgba(244, 114, 182, 0.5); }

/* Score cells */
.score-high { color: var(--success); font-weight: 700; }
.score-mid { color: var(--warning); font-weight: 600; }
.score-low { color: var(--text-secondary); }

.quality-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-bar-fill {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--success), var(--accent), var(--purple));
  transition: width 0.5s ease;
}

.quality-value {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  min-width: 28px;
  text-align: right;
}

/* Price cells */
.price-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.price-low { color: var(--success); }
.price-high { color: var(--warning); }

/* Link */
.ext-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
}

.ext-link:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* Speed */
.speed-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* ===== Table Footer ===== */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  gap: 12px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ===== Calculator ===== */
.calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.calculator-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.calculator-card > p {
  color: var(--text-tertiary);
  font-size: 14px;
  margin-bottom: 20px;
}

.calc-inputs {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-field label {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.calc-field input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  width: 140px;
  outline: none;
  transition: all 0.2s;
}

.calc-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-calc {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  border: none;
  color: #fff;
  padding: 11px 28px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-calc:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ===== Charts ===== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.chart-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.chart-full {
  grid-column: 1 / -1;
}

.chart-card canvas {
  max-height: 320px;
}

/* ===== Methodology ===== */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.method-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.3s ease;
}

.method-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.method-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.method-card h4 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.method-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.method-weight {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  margin-top: 80px;
  padding: 56px 32px 24px;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 64px;
  flex-wrap: wrap;
}

.footer-brand p {
  max-width: 360px;
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

.footer-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.footer-disclaimer {
  font-size: 12px !important;
  margin-top: 12px !important;
  color: var(--text-muted) !important;
}

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-tertiary);
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    gap: 16px;
  }

  .stat-card {
    padding: 18px 24px;
    min-width: 120px;
  }

  .stat-value {
    font-size: 24px;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 16px;
    gap: 20px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 100px 16px 60px;
  }

  .hero-title {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-stats {
    gap: 12px;
  }

  .stat-card {
    padding: 14px 20px;
    min-width: 100px;
  }

  .stat-value {
    font-size: 22px;
  }

  .main-container {
    padding: 0 16px;
  }

  .filter-bar {
    flex-direction: column;
  }

  .filter-input {
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .table-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-content {
    gap: 32px;
  }

  .footer-links {
    gap: 32px;
  }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-bright);
}

/* ===== No results state ===== */
.no-results {
  text-align: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 15px;
}

/* ===== Loading shimmer ===== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ===== Tooltip for long text ===== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  z-index: 10;
  margin-bottom: 4px;
}
