/* ============================================
   TenderWatch Gamification — Leaderboard & Badges
   ============================================ */

/* --- Community Tab Navigation --- */
.community-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.community-tab { padding: 10px 20px; font-size: 14px; font-weight: 600; color: var(--gray-500); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.community-tab:hover { color: var(--gray-700); }
.community-tab.active { color: #002855; border-bottom-color: #d4af37; }

/* --- Section Header --- */
.community-section { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }
.community-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.community-header h3 { font-size: 20px; font-weight: 800; color: #0f172a; margin: 0; }
.community-stats { display: flex; gap: 24px; flex-wrap: wrap; }
.community-stat { text-align: center; }
.community-stat-value { font-size: 22px; font-weight: 800; color: #002855; }
.community-stat-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; }

/* --- Leaderboard Filter --- */
.lb-filters { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.lb-filter-btn { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1px solid var(--gray-300); background: #fff; color: var(--gray-600); cursor: pointer; transition: all 0.2s; }
.lb-filter-btn:hover { border-color: #d4af37; color: #92400e; }
.lb-filter-btn.active { background: linear-gradient(135deg, #d4af37, #f59e0b); color: #fff; border-color: transparent; }

/* --- Leaderboard Rows --- */
.lb-container { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); overflow: hidden; }
.lb-row { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--gray-100); gap: 14px; transition: background 0.15s; animation: lbSlideIn 0.3s ease both; }
.lb-row:hover { background: #fefce8; }
.lb-row:last-child { border-bottom: none; }
.lb-row--top { background: linear-gradient(90deg, rgba(212,175,55,0.06), transparent); }
.lb-row--top:hover { background: linear-gradient(90deg, rgba(212,175,55,0.12), transparent); }

@keyframes lbSlideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }

.lb-rank { width: 32px; text-align: center; font-size: 16px; font-weight: 800; color: var(--gray-500); flex-shrink: 0; }
.lb-row--top .lb-rank { font-size: 20px; }
.lb-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0; }
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 14px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-province { font-size: 11px; color: var(--gray-500); }
.lb-score { font-size: 18px; font-weight: 800; color: #002855; text-align: right; min-width: 60px; }
.lb-score-label { font-size: 10px; font-weight: 500; color: var(--gray-400); margin-left: 2px; }
.lb-badges { font-size: 13px; color: var(--gray-500); min-width: 50px; text-align: center; }
.lb-badge-icon { font-size: 14px; }

/* --- Badge Cards --- */
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.badge-card { background: #fff; border-radius: 12px; border: 2px solid var(--gray-200); padding: 20px; text-align: center; transition: transform 0.2s, box-shadow 0.2s; }
.badge-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.badge-icon { margin-bottom: 10px; }
.badge-icon svg { width: 36px; height: 36px; }
.badge-name { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.badge-desc { font-size: 12px; color: var(--gray-500); line-height: 1.4; margin-bottom: 10px; }
.badge-tier { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 0.5px; margin-bottom: 6px; }
.badge-earners { font-size: 11px; color: var(--gray-400); }

/* --- Mini Leaderboard (Sidebar) --- */
.mini-lb { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 16px; margin-bottom: 20px; }
.mini-lb-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mini-lb-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.mini-lb-link { font-size: 11px; color: #d4af37; text-decoration: none; font-weight: 600; }
.mini-lb-link:hover { text-decoration: underline; }
.mini-lb-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.mini-lb-medal { font-size: 16px; width: 22px; text-align: center; }
.mini-lb-avatar { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.mini-lb-name { font-size: 12px; font-weight: 600; color: #334155; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-lb-pts { font-size: 12px; font-weight: 700; color: #002855; }

/* --- Tab Panels --- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* --- Mobile --- */
@media (max-width: 640px) {
  .community-section { padding: 20px 14px; }
  .community-header { flex-direction: column; align-items: flex-start; }
  .community-stats { gap: 16px; }
  .lb-row { padding: 10px 12px; gap: 8px; }
  .lb-avatar { width: 30px; height: 30px; font-size: 13px; }
  .lb-score { font-size: 15px; min-width: 48px; }
  .lb-badges { display: none; }
  .badges-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .badge-card { padding: 14px; }
  .lb-filters { gap: 6px; }
  .lb-filter-btn { padding: 5px 10px; font-size: 11px; }
}
