/* ============================================
   SQL-IQ Leaderboard - Custom Styles
   ============================================ */

/* --- Hero Background --- */
.grid-bg {
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f0fdf4 100%);
  position: relative;
  overflow: hidden;
}

.grid-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.grid-bg::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
  border-radius: 50%;
}

/* --- Navigation --- */
.nav-link {
  position: relative;
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #111827;
}

.nav-link.active {
  color: #111827;
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #111827;
  border-radius: 1px;
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background-color: #ffffff;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.btn-secondary:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

/* --- View Tabs --- */
.view-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e5e7eb;
}

.view-tab {
  padding: 0.6rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.view-tab:hover {
  color: #4f46e5;
}

.view-tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* --- Filter Buttons --- */
.filter-btn {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  color: #6b7280;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}

.filter-btn.active {
  background-color: #111827;
  color: #ffffff;
  border-color: #111827;
}

/* --- Leaderboard Table --- */
.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.leaderboard-table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.leaderboard-table thead th:hover {
  color: #111827;
}

.leaderboard-table thead th.sorted-asc::after {
  content: ' ↑';
  font-size: 0.7rem;
}

.leaderboard-table thead th.sorted-desc::after {
  content: ' ↓';
  font-size: 0.7rem;
}

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

.leaderboard-table tbody tr:hover {
  background-color: #f9fafb;
}

.leaderboard-table tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
}

.leaderboard-table tbody tr:last-child td {
  border-bottom: none;
}

/* Rank column */
.leaderboard-table .rank-cell {
  font-weight: 600;
  color: #9ca3af;
  width: 3rem;
  text-align: center;
}

.leaderboard-table .rank-1 { color: #d97706; }
.leaderboard-table .rank-2 { color: #6b7280; }
.leaderboard-table .rank-3 { color: #b45309; }

/* Model column */
.leaderboard-table .model-cell {
  font-weight: 600;
  color: #111827;
}

/* Score columns */
.leaderboard-table .score-cell {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.leaderboard-table .score-best {
  font-weight: 700;
  color: #111827;
}

.leaderboard-table .score-na {
  color: #d1d5db;
}

/* Overall column highlight */
.leaderboard-table .overall-cell {
  font-weight: 700;
  color: #111827;
}

/* --- Table Container (responsive) --- */
.table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background-color: #ffffff;
}

/* --- Footnote --- */
.footnote {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 1rem;
}

.footnote a {
  color: #4b5563;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footnote a:hover {
  color: #111827;
}

/* --- Section Title --- */
.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 2rem;
}

/* --- Stat Cards (Dataset page) --- */
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: #111827;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Stat Cards V2 (with icons) --- */
.stat-card-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card-v2:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.stat-v2-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.625rem;
  margin-bottom: 0.75rem;
}

.stat-v2-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: #111827;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-v2-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Dimension Groups (Dataset page) --- */
.dimension-group {
  margin-bottom: 2.5rem;
}

.dimension-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dimension-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.dimension-badge.generation {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.dimension-badge.comprehension {
  background-color: #ede9fe;
  color: #6d28d9;
}

.dimension-badge.debugging {
  background-color: #fef3c7;
  color: #b45309;
}

.dimension-badge.adaptation {
  background-color: #d1fae5;
  color: #047857;
}

.dimension-desc {
  font-size: 0.85rem;
  color: #6b7280;
}

/* --- Task Cards (Dataset page) --- */
.task-card {
  padding: 1.25rem 1.5rem;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.task-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.task-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.task-card-desc {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.meta-tag {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 500;
  background-color: #f3f4f6;
  color: #4b5563;
  border-radius: 0.375rem;
}

.meta-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
  margin-left: 0.25rem;
  transition: color 0.2s ease;
}

.meta-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.external-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  background-color: #fef3c7;
  color: #92400e;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --- Content Sections (Submission / Evaluation pages) --- */
.content-section {
  margin-bottom: 3rem;
}

.content-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}

/* --- Steps (Submission page) --- */
.steps-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #111827;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 50%;
}

.step-content {
  flex: 1;
  padding-top: 0.15rem;
}

.step-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.25rem;
}

.step-desc {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.6;
}

/* --- Code Block --- */
.code-block {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: #f9fafb;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background-color: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}

.code-filename {
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
}

.code-lang {
  font-size: 0.65rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-content {
  padding: 1rem 1.25rem;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #1f2937;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  overflow-x: auto;
  margin: 0;
}

.code-content code {
  font-family: inherit;
}

/* --- Info Box --- */
.info-box {
  border: 1px solid #dbeafe;
  background-color: #eff6ff;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.info-box-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 0.5rem;
}

.info-box-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-box-list li {
  font-size: 0.82rem;
  color: #374151;
  padding: 0.25rem 0;
  padding-left: 0.75rem;
  position: relative;
}

.info-box-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #93c5fd;
}

.info-box-list code {
  font-size: 0.78rem;
  background-color: #dbeafe;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Highlight Box (warning style) --- */
.highlight-box {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.75rem;
}

.highlight-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.highlight-box code {
  font-size: 0.78rem;
  background-color: #fef3c7;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Rules Grid --- */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .rules-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.rule-item {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background-color: #ffffff;
  transition: border-color 0.2s ease;
}

.rule-item:hover {
  border-color: #d1d5db;
}

.rule-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #d1fae5;
  color: #047857;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
}

.rule-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.2rem;
}

.rule-desc {
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.5;
}

/* --- Disclaimer Box --- */
.disclaimer-box {
  padding: 1.25rem 1.5rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.7;
}

.disclaimer-box ul {
  list-style: disc;
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.disclaimer-box li {
  padding: 0.15rem 0;
}

/* --- Inline link --- */
.inline-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.inline-link:hover {
  color: #1d4ed8;
}

/* Inline code in paragraphs */
.step-desc code,
.rule-desc code,
.highlight-box p code,
.highlight-box li code,
.disclaimer-box code,
.formula-desc code,
.formula-notes code,
.detail-desc code {
  font-size: 0.78rem;
  background-color: #f3f4f6;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Metrics Table (Evaluation page) --- */
.metrics-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.metrics-table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.metrics-table tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  color: #4b5563;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.metrics-table tbody tr:last-child td {
  border-bottom: none;
}

.metrics-table tbody tr:hover {
  background-color: #f9fafb;
}

.metric-badge {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  background-color: #ede9fe;
  color: #6d28d9;
  border-radius: 0.375rem;
  white-space: nowrap;
}

/* --- Formula Cards (Evaluation page) --- */
.formula-card {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background-color: #ffffff;
}

.formula-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
}

.formula-desc {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.formula-box {
  padding: 1rem 1.25rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.formula-box code {
  font-size: 0.9rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: #111827;
  font-weight: 500;
}

.formula-notes {
  list-style: none;
  padding: 0;
  margin: 0;
}

.formula-notes li {
  font-size: 0.82rem;
  color: #4b5563;
  padding: 0.2rem 0;
  padding-left: 0.75rem;
  position: relative;
}

.formula-notes li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #d1d5db;
}

/* --- Environment Grid (Evaluation page) --- */
.env-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .env-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.env-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background-color: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.env-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.env-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.env-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

.env-icon.sqlite {
  background-color: #dbeafe;
  color: #2563eb;
}

.env-icon.multi {
  background-color: #d1fae5;
  color: #047857;
}

.env-icon.llm {
  background-color: #ede9fe;
  color: #6d28d9;
}

.env-icon.external {
  background-color: #fef3c7;
  color: #b45309;
}

.env-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.env-card-desc {
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.env-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* --- Details List (Evaluation page) --- */
.details-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-item {
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background-color: #ffffff;
}

.detail-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.3rem;
}

.detail-desc {
  font-size: 0.82rem;
  color: #4b5563;
  line-height: 1.6;
}

/* --- Page Transition --- */
.page-content {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
