/* ============================================
   KANXO DAI - LEADERBOARD CSS (Compact)
   ============================================ */

/* ---- Header ---- */
.lb-header {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  color: #fff;
  padding: 1.25rem 0 1rem;
}
.lb-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.lb-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 0.2rem;
}
.lb-header h1 i { color: #ffd700; margin-right: 0.35rem; }
.lb-header p  { margin: 0; font-size: 0.8rem; opacity: .85; }
.lb-header small { font-size: 0.72rem; opacity: .7; display: block; margin-top: 0.2rem; }

/* My rank card (shown when logged in) */
.lb-my-rank {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 0.75rem;
  padding: 0.6rem 1rem;
  font-size: 0.78rem;
  min-width: 160px;
}
.lb-my-rank strong { display: block; font-size: 0.8rem; margin-bottom: 0.25rem; }
.lb-rank-item { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.15rem; }
.lb-rank-item i { width: 14px; opacity: .8; }

/* ---- Tab Section ---- */
.lb-section { padding: 1rem 0 2rem; background: #f8fafc; min-height: 60vh; }

.lb-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.lb-tab-btn {
  flex: 1;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.6rem;
  padding: 0.5rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  transition: all .2s;
}
.lb-tab-btn i { font-size: 1rem; }
.lb-tab-btn .tab-count { font-size: 0.62rem; font-weight: 400; opacity: .7; }
.lb-tab-btn.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,.25);
}
.lb-tab-btn:hover:not(.active) { border-color: #4f46e5; color: #4f46e5; }

/* ---- Card ---- */
.lb-card {
  background: #fff;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.lb-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  color: #fff;
}
.lb-card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.lb-card-header p  { margin: 0.15rem 0 0; font-size: 0.72rem; opacity: .85; }
.lb-card-header .lb-badge {
  background: rgba(255,255,255,.2);
  border-radius: 2rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.7rem;
  white-space: nowrap;
}
.weekly-hdr  { background: linear-gradient(135deg,#10b981,#059669); }
.monthly-hdr { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.alltime-hdr { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }

.lb-card-body { padding: 0.75rem; }

/* ---- Top 3 Podium ---- */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0 1rem;
}
.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 110px;
}
.podium-item.pos-1 { order: 2; }
.podium-item.pos-2 { order: 1; }
.podium-item.pos-3 { order: 3; }

.podium-avatar-wrap {
  position: relative;
  margin-bottom: 0.35rem;
}
.podium-avatar {
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid #ccc;
}
.podium-item.pos-1 .podium-avatar { width: 68px; height: 68px; border-color: #ffd700; }
.podium-item.pos-2 .podium-avatar { width: 54px; height: 54px; border-color: #c0c0c0; }
.podium-item.pos-3 .podium-avatar { width: 54px; height: 54px; border-color: #cd7f32; }

.podium-crown {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.3rem;
  line-height: 1;
}
.podium-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-amount {
  font-size: 0.85rem;
  font-weight: 800;
  color: #4f46e5;
  text-align: center;
}
.podium-item.pos-1 .podium-amount { color: #f59e0b; font-size: 0.95rem; }
.podium-item.pos-2 .podium-amount { color: #6b7280; }
.podium-item.pos-3 .podium-amount { color: #cd7f32; }

.podium-bar {
  width: 100%;
  border-radius: 0.5rem 0.5rem 0 0;
  margin-top: 0.4rem;
}
.podium-item.pos-1 .podium-bar { height: 60px; background: linear-gradient(180deg,#ffd700,#f59e0b); }
.podium-item.pos-2 .podium-bar { height: 44px; background: linear-gradient(180deg,#d1d5db,#9ca3af); }
.podium-item.pos-3 .podium-bar { height: 32px; background: linear-gradient(180deg,#d97706,#92400e); }

.podium-pos-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 6px;
  border-radius: 2rem;
  margin-top: 0.25rem;
  display: inline-block;
}
.podium-item.pos-1 .podium-pos-label { background: #f59e0b; }
.podium-item.pos-2 .podium-pos-label { background: #9ca3af; }
.podium-item.pos-3 .podium-pos-label { background: #d97706; }

/* ---- List Rows (position 4+) ---- */
.lb-list { display: flex; flex-direction: column; gap: 0.4rem; }

.lb-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.55rem 0.75rem;
  transition: border-color .15s, box-shadow .15s;
}
.lb-row:hover { border-color: #4f46e5; box-shadow: 0 2px 8px rgba(79,70,229,.1); }
.lb-row.is-me   { background: #f0fdf4; border-color: #10b981; }

/* Rank badge circle */
.lb-pos {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg,#4f46e5,#3730a3);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Avatar in list */
.lb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
}

/* User info */
.lb-info { flex: 1; min-width: 0; }
.lb-username {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  overflow: hidden;
}
.lb-username span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-meta { font-size: 0.7rem; color: #94a3b8; }

/* Amount + progress */
.lb-right { text-align: right; flex-shrink: 0; }
.lb-amount { font-size: 0.9rem; font-weight: 800; color: #4f46e5; white-space: nowrap; }
.lb-progress {
  width: 60px; height: 4px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 4px;
  margin-left: auto;
}
.lb-progress-fill {
  height: 100%;
  background: linear-gradient(90deg,#4f46e5,#06b6d4);
  border-radius: 9999px;
  transition: width 1s ease-out;
}
.lb-progress-fill.legendary { background: linear-gradient(90deg,#8b5cf6,#ec4899); }

/* Small badges */
.badge-you {
  background: #10b981; color: #fff;
  font-size: 0.6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  text-transform: uppercase;
}
.badge-legend {
  background: linear-gradient(135deg,#8b5cf6,#7c3aed); color: #fff;
  font-size: 0.6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  text-transform: uppercase;
}
.badge-private {
  background: #e5e7eb; color: #6b7280;
  font-size: 0.6rem;
  padding: 1px 5px; border-radius: 999px;
}

/* ---- Empty State ---- */
.lb-empty { text-align: center; padding: 2rem 1rem; color: #94a3b8; }
.lb-empty i { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.lb-empty h4 { font-size: 1rem; color: #1e293b; margin: 0 0 0.4rem; }
.lb-empty p  { margin: 0 0 1rem; font-size: 0.85rem; }

/* ---- CTA Section ---- */
.lb-cta { padding: 1.25rem 0 2rem; background: #fff; }
.lb-cta-card {
  background: linear-gradient(135deg,#4f46e5,#06b6d4);
  border-radius: 0.75rem;
  padding: 1.25rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: #fff;
  flex-wrap: wrap;
}
.lb-cta-card h3 { margin: 0 0 0.2rem; font-size: 1.1rem; font-weight: 700; }
.lb-cta-card p  { margin: 0; font-size: 0.8rem; opacity: .85; }
.lb-cta-btns { display: flex; gap: 0.5rem; flex-shrink: 0; flex-wrap: wrap; }
.lb-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid #fff;
  transition: all .2s;
  display: inline-block;
}
.lb-btn-solid { background: #fff; color: #4f46e5; }
.lb-btn-solid:hover { background: transparent; color: #fff; }
.lb-btn-outline { background: transparent; color: #fff; }
.lb-btn-outline:hover { background: #fff; color: #4f46e5; }

/* Tab panes */
.lb-pane { display: none; }
.lb-pane.active { display: block; }

/* ---- Avatar icon fallback (person silhouette) ---- */
.lb-avatar-init {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
}
.lb-avatar-init svg { width: 20px; height: 20px; }

.podium-avatar-init {
  border-radius: 50%;
  background: #e0e7ff;
  color: #4f46e5;
  display: flex; align-items: center; justify-content: center;
}
.podium-item.pos-1 .podium-avatar-init { width: 68px; height: 68px; border: 3px solid #ffd700; }
.podium-item.pos-2 .podium-avatar-init { width: 54px; height: 54px; border: 3px solid #c0c0c0; }
.podium-item.pos-3 .podium-avatar-init { width: 54px; height: 54px; border: 3px solid #cd7f32; }
.podium-item.pos-1 .podium-avatar-init svg { width: 36px; height: 36px; }
.podium-item.pos-2 .podium-avatar-init svg,
.podium-item.pos-3 .podium-avatar-init svg { width: 28px; height: 28px; }

/* Crown glow */
@keyframes crownBounce {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
.podium-crown { animation: crownBounce 2s ease-in-out infinite; }

/* Progress bar shimmer */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.lb-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,transparent,rgba(255,255,255,.4),transparent);
  animation: shimmer 2s infinite;
}
.lb-progress-fill { position: relative; }

/* ---- Mobile ---- */
@media (max-width: 480px) {
  .lb-header h1 { font-size: 1.15rem; }
  .lb-tab-btn span { font-size: 0.68rem; }
  .lb-tab-btn .tab-count { display: none; }
  .lb-amount { font-size: 0.82rem; }
  .lb-username span { font-size: 0.8rem; }
  .lb-meta { font-size: 0.65rem; }
  .podium-name { font-size: 0.7rem; }
  .podium-amount { font-size: 0.75rem; }
  .lb-cta-card { flex-direction: column; }
  .lb-cta-btns { width: 100%; }
  .lb-btn { width: 100%; text-align: center; }
  .lb-header-inner { flex-direction: column; align-items: flex-start; }
  .lb-my-rank { width: 100%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}