/* =========================================================
   BQ24 — PREMIUM CLASS RANKING DESIGN SYSTEM
   Academic Leaderboard · Premium SaaS · Responsive
   ========================================================= */

/* =========================================================
   1. PAGE HEADER
   ========================================================= */

.ranking-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-top: 4px;
}

.ranking-header-left {
  flex: 1;
  min-width: 260px;
}

.ranking-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ranking-header-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--brand-indigo, #3b82f6);
  flex-shrink: 0;
}

.ranking-header-icon-box svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.25;
}

.ranking-page-header h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.2;
}

.ranking-header-subtitle,
.ranking-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 600px;
}

/* =========================================================
   2. UPDATE META
   ========================================================= */

.ranking-meta-capsule,
.ranking-update-meta,
.ranking-update-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card-bg-subtle, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.ranking-meta-icon,
.ranking-update-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand-indigo, #3b82f6);
  flex-shrink: 0;
}

.ranking-meta-icon svg,
.ranking-update-icon svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}

.ranking-meta-label,
.ranking-update-label {
  font-weight: 700;
  color: var(--ink);
}

.ranking-meta-dot,
.ranking-update-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  flex-shrink: 0;
}

.ranking-meta-freq {
  color: var(--muted);
}

/* =========================================================
   3. RANKING SHELL / CARDS
   ========================================================= */

.ranking-podium-section,
#rankingPodiumSection {
  margin-bottom: 22px;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.ranking-main-card,
#rankingTableCard {
  margin-bottom: 22px;
  padding: 22px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

/* =========================================================
   4. SHELL HEADER
   ========================================================= */

.ranking-section-header {
  margin-bottom: 16px;
}

.ranking-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-section-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand-indigo, #3b82f6);
  flex-shrink: 0;
}

.ranking-section-icon-box svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.ranking-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ranking-section-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.ranking-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}

.ranking-header-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ranking-title-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-top-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-indigo, #3b82f6);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}

.ranking-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.015em;
}

.ranking-card-subtitle {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.ranking-live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.ranking-live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* =========================================================
   5. TOP 3 (PODIUM)
   ========================================================= */

.podium-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.podium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card-bg-subtle, rgba(255, 255, 255, 0.03));
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-width: 0;
}

.podium-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* 1st Place - Prominent visual highlight */
.podium-1 {
  border-color: rgba(234, 179, 8, 0.45);
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.10), rgba(234, 179, 8, 0.02) 65%), var(--card-bg-subtle);
  box-shadow: 0 4px 18px rgba(234, 179, 8, 0.07);
}

.podium-1:hover {
  border-color: rgba(234, 179, 8, 0.65);
  box-shadow: 0 8px 24px rgba(234, 179, 8, 0.14);
}

/* 2nd Place - Slate/Silver highlight */
.podium-2 {
  border-color: rgba(148, 163, 184, 0.38);
  background: linear-gradient(145deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.02) 65%), var(--card-bg-subtle);
}

/* 3rd Place - Warm Bronze highlight */
.podium-3 {
  border-color: rgba(217, 119, 6, 0.38);
  background: linear-gradient(145deg, rgba(217, 119, 6, 0.08), rgba(217, 119, 6, 0.02) 65%), var(--card-bg-subtle);
}

.podium-card.is-me {
  box-shadow: inset 0 0 0 1.5px var(--brand-indigo, #3b82f6), 0 4px 18px rgba(59, 130, 246, 0.12);
}

.podium-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.podium-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  flex-shrink: 0;
}

.podium-pct-block {
  text-align: right;
  flex-shrink: 0;
}

.podium-pct-text {
  display: block;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
}

.podium-pct-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1;
}

.podium-card-body {
  margin-top: 14px;
  min-width: 0;
}

.podium-name-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 750;
  color: var(--ink);
  line-height: 1.35;
  min-width: 0;
}

.podium-name-val {
  min-width: 0;
  word-break: normal;
  overflow-wrap: anywhere;
}

.podium-meta-text {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.podium-meta-sep {
  opacity: 0.4;
}

/* =========================================================
   6. PERSONAL RANK ZONE
   ========================================================= */

.my-rank-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
  margin-bottom: 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.09), rgba(56, 189, 248, 0.05)), var(--card-bg);
  border: 1px solid rgba(59, 130, 246, 0.30);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.06);
  position: relative;
  overflow: hidden;
}

.my-rank-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-indigo, #3b82f6);
}

.my-rank-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.my-rank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-indigo, #3b82f6), #2563eb);
  color: #ffffff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

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

.my-rank-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-indigo, #3b82f6);
}

.my-rank-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  margin-top: 2px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.my-rank-group {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.my-rank-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.my-rank-pct-wrap {
  text-align: right;
}

.my-rank-pct {
  font-size: 24px;
  font-weight: 900;
  color: var(--brand-cyan, #38bdf8);
  line-height: 1;
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
}

.my-rank-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1;
}

/* =========================================================
   7. RANKING LIST & ROWS
   ========================================================= */

#rankingTableContainer {
  width: 100%;
}

.ranking-table {
  width: 100%;
}

.ranking-list-card {
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg-subtle, rgba(255, 255, 255, 0.02));
  overflow: hidden;
}

.ranking-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  gap: 14px;
  transition: background-color 0.15s ease;
  min-width: 0;
}

.ranking-row-item:last-child {
  border-bottom: none;
}

.ranking-row-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.ranking-row-item.is-me {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--brand-indigo, #3b82f6);
}

.ranking-row-item.is-me:hover {
  background: rgba(59, 130, 246, 0.12);
}

.ranking-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.ranking-row-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  font-size: 13px;
  font-weight: 800;
  font-feature-settings: 'tnum';
  flex-shrink: 0;
  color: var(--muted);
}

.ranking-row-rank.rank-gold {
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.35);
  background: rgba(234, 179, 8, 0.10);
}

.ranking-row-rank.rank-silver {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.10);
}

.ranking-row-rank.rank-bronze {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.10);
}

.ranking-row-identity {
  min-width: 0;
  flex: 1;
}

.ranking-row-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ranking-row-name {
  font-size: 14px;
  font-weight: 750;
  color: var(--ink);
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: anywhere;
  min-width: 0;
}

.ranking-me-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--brand-indigo, #3b82f6);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.ranking-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.ranking-row-sep {
  opacity: 0.4;
}

.ranking-row-right {
  text-align: right;
  flex-shrink: 0;
  padding-left: 8px;
}

.ranking-row-pct {
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  font-feature-settings: 'tnum';
  letter-spacing: -0.02em;
  color: var(--ink);
}

.ranking-row-pct.pct-high {
  color: var(--green, #10b981);
}

.ranking-row-pct.pct-mid {
  color: var(--brand-cyan, #38bdf8);
}

.ranking-row-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1;
}

/* =========================================================
   8. EMPTY STATE
   ========================================================= */

.ranking-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px;
  min-height: 280px;
}

.ranking-empty-orbit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
}

.ranking-empty-orbit::before,
.ranking-empty-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.ranking-empty-orbit::before {
  inset: 0;
}

.ranking-empty-orbit::after {
  inset: 8px;
  border-color: rgba(59, 130, 246, 0.08);
}

.ranking-empty-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(59, 130, 246, 0.10);
  color: var(--brand-indigo, #3b82f6);
}

.ranking-empty-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.ranking-empty-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.ranking-empty-kicker {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand-indigo, #3b82f6);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ranking-empty-content h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.ranking-empty-content p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* =========================================================
   9. DARK MODE
   ========================================================= */

[data-theme="dark"] .ranking-header-icon-box {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.20), rgba(56, 189, 248, 0.10));
  border-color: rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .podium-1 {
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.12), rgba(234, 179, 8, 0.02) 65%), #1e293b;
  border-color: rgba(234, 179, 8, 0.45);
}

[data-theme="dark"] .podium-2 {
  background: linear-gradient(145deg, rgba(148, 163, 184, 0.10), rgba(148, 163, 184, 0.02) 65%), #1e293b;
  border-color: rgba(148, 163, 184, 0.32);
}

[data-theme="dark"] .podium-3 {
  background: linear-gradient(145deg, rgba(217, 119, 6, 0.10), rgba(217, 119, 6, 0.02) 65%), #1e293b;
  border-color: rgba(217, 119, 6, 0.32);
}

[data-theme="dark"] .my-rank-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(56, 189, 248, 0.06)), #1e293b;
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .ranking-row-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .ranking-row-item.is-me {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="dark"] .ranking-row-item.is-me:hover {
  background: rgba(59, 130, 246, 0.16);
}

/* =========================================================
   10. RESPONSIVE (MOBILE & TABLET)
   ========================================================= */

@media (max-width: 768px) {
  .ranking-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
  }

  .podium-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .podium-card {
    padding: 14px;
  }

  .ranking-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ranking-live-status {
    font-size: 11.5px;
  }
}

@media (max-width: 480px) {
  .ranking-page-header h1 {
    font-size: 21px;
  }

  .ranking-header-subtitle,
  .ranking-subtitle {
    font-size: 13px;
  }

  .ranking-meta-capsule,
  .ranking-update-meta,
  .ranking-update-note {
    font-size: 11px;
    padding: 5px 10px;
  }

  .ranking-podium-section,
  #rankingPodiumSection,
  .ranking-main-card,
  #rankingTableCard {
    padding: 16px 14px;
    border-radius: 14px;
  }

  .ranking-row-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .ranking-row-rank {
    width: 30px;
    height: 30px;
    font-size: 12px;
    border-radius: 8px;
  }

  .ranking-row-name {
    font-size: 13.5px;
  }

  .ranking-row-pct {
    font-size: 16px;
  }

  .my-rank-banner {
    padding: 14px 14px;
    border-radius: 14px;
  }

  .my-rank-badge {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }

  .my-rank-pct {
    font-size: 21px;
  }
}

/* =========================================================
   11. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .podium-card,
  .ranking-row-item,
  .ranking-live-pulse {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}