/**
 * Firetalk Leaderboard Stylesheet
 * Exact match to the Paltalk Leaderboards layout, SVG sprites, and assets.
 */

.leaderboard-body {
  background-color: #f8fafc;
  color: #333333;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

#leaderboard {
  max-width: 1260px;
  margin: 24px auto 70px;
  padding: 0 20px;
}

/* ==========================================================================
   TITLE & MONTH/YEAR (Hidden to match exact Paltalk layout)
   ========================================================================== */
.board-msg {
  display: none !important;
}

/* ==========================================================================
   PERIOD SELECTION TABS
   ========================================================================== */
.leaderboard-period-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.period-tab {
  border: none;
  background: #f1f5f9;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.period-tab:hover {
  background: #e2e8f0;
  color: #334155;
}

.period-tab.active {
  background-color: #334155;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   REGION SELECTION PILLS
   ========================================================================== */
.leaderboard-header {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.region-selection ul {
  list-style: none;
  display: inline-flex;
  padding: 3px;
  margin: 0;
  background-color: #f1f5f9;
  border-radius: 20px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.region-selection li {
  margin: 0;
}

.region-selection .btn {
  border: none;
  background: transparent;
  padding: 5px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.4px;
}

.region-selection .btn.active {
  background-color: #334155;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   LAST MONTH'S WINNERS BANNER
   ========================================================================== */
.top-members {
  margin: 0 auto 28px;
  text-align: center;
  display: flex;
  justify-content: center;
}

.top-members .banner {
  width: 826px;
  height: 160px;
  position: relative;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 50, 100, 0.25);
  background: radial-gradient(260.08% 260.08% at 68.56% -28.26%, #00b9f8 0%, #00143b 100%);
  margin: 0 auto 28px;
  text-align: center;
}

.top-members .banner::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: transparent url("../assets/leaderboard/lastmonthwinners-banner-bg.svg") no-repeat center center;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.top-members .banner .banner-title {
  display: block !important;
  position: absolute;
  top: 32px;
  left: 39px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  color: #ffffff;
  font-weight: 700;
  font-size: 19.5px;
  line-height: 1.3;
  text-align: left;
  z-index: 2;
}

.top-members .banner .banner-title span {
  display: block;
  color: #ccf1ff;
  font-size: 36px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0px 0px 2px rgba(0, 216, 255, 0.81), 0px 3px 18px rgba(0, 34, 68, 0.63);
}

.top-members .banner .content {
  position: relative;
  background: transparent url("../assets/leaderboard/lastmonthwinners-profile-bg.svg") no-repeat center right;
  width: 100%;
  height: 160px;
  margin: 0 !important;
  z-index: 4;
}

.top-members .banner .content .most-valuable,
.top-members .banner .content .most-generous,
.top-members .banner .content .most-adored {
  display: block;
  width: 140px;
  height: 100%;
  position: absolute;
  text-align: center;
  text-decoration: none;
  top: 0;
}

.top-members .banner .content .most-valuable {
  right: 328px;
  left: auto;
}

.top-members .banner .content .most-generous {
  right: 174px;
  left: auto;
}

.top-members .banner .content .most-adored {
  right: 17px;
  left: auto;
}

.top-members .banner .content .profile-pic {
  display: block;
  margin: 0 auto;
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 84px;
  z-index: 2;
}

.top-members .banner .content .profile-pic img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.35);
  object-fit: cover;
  display: block;
}

.top-members .banner .content .title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box !important;
  width: auto;
  max-width: 130px;
  white-space: nowrap;
  padding: 4.5px 12px;
  border-radius: 9999px;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  z-index: 5;
}

.top-members .banner .content .most-valuable .title {
  background: linear-gradient(180deg, #003a5c 0%, #011c40 100%) padding-box,
              linear-gradient(135deg, #baff24 0%, #00bcf1 100%) border-box;
  border: 1.8px solid transparent;
  box-shadow: 0 0 10px rgba(0, 188, 241, 0.7), 0 2px 6px rgba(0, 0, 0, 0.45);
}

.top-members .banner .content .most-generous .title {
  background: linear-gradient(180deg, #003a5c 0%, #011c40 100%) padding-box,
              linear-gradient(135deg, #ff8d21 0%, #ff45cf 100%) border-box;
  border: 1.8px solid transparent;
  box-shadow: 0 0 10px rgba(255, 69, 207, 0.7), 0 2px 6px rgba(0, 0, 0, 0.45);
}

.top-members .banner .content .most-adored .title {
  background: linear-gradient(180deg, #003a5c 0%, #011c40 100%) padding-box,
              linear-gradient(135deg, #34d3ff 0%, #e342ff 100%) border-box;
  border: 1.8px solid transparent;
  box-shadow: 0 0 10px rgba(227, 66, 255, 0.7), 0 2px 6px rgba(0, 0, 0, 0.45);
}

.top-members .banner .content .nickname {
  font-size: 13.5px;
  font-weight: 700;
  color: #ffffff;
  position: absolute;
  top: 134px;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 94%;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  z-index: 4;
}

/* ==========================================================================
   3 COLUMNS SECTION
   ========================================================================== */
.leaderboard-container {
  margin-top: 10px;
}

.leaderboard-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.leaderboard-section {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

/* Icons from sprite-leaderboards.svg */
.icon-valuablemembers, .icon-giftssent, .icon-giftsreceived {
  display: inline-block;
  background-image: url('../assets/leaderboard/sprite-leaderboards.svg');
  background-color: transparent;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.icon-valuablemembers {
  background-position: -162px -74px;
  width: 17px;
  height: 16px;
}

.icon-giftssent {
  background-position: -88px -72.5px;
  width: 17px;
  height: 16px;
}

.icon-giftsreceived {
  background-position: -7px -72.5px;
  width: 17px;
  height: 16px;
}

.panel-content {
  padding: 10px 16px 24px;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ==========================================================================
   RANK 1 HERO ITEM
   ========================================================================== */
.leaderboard-list li.rank-1 {
  text-align: center;
  padding: 18px 0 22px;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 10px;
}

.leaderboard-list li.rank-1 a {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rank-1 .sno-gold-star {
  display: inline-block;
  background-image: url('../assets/leaderboard/sprite-leaderboards.svg');
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: 0 -2px;
  width: 38px;
  height: 38px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 39px;
  text-align: center;
  margin-bottom: 8px;
}

.rank-1 .profile-pic {
  position: relative;
  width: 78px;
  height: 78px;
  margin: 0 auto 10px;
}

.rank-1 .profile-pic img.avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  border: 2.5px solid #ffffff;
}

.rank-1 .profile-pic img.flag {
  position: absolute;
  bottom: 1px;
  left: 3px;
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  object-fit: cover;
}

.rank-1 .nick-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.rank-1 .nick-row .crown-svg {
  height: 20px;
  width: auto;
  max-width: none !important;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

.rank-1 .nick-row .nick-text {
  font-size: 16.5px;
  font-weight: 800;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-1 .score-total {
  font-size: 13.5px;
  font-weight: 700;
  color: #475569;
}

/* ==========================================================================
   RANKS 2 - 50 ROWS
   ========================================================================== */
.leaderboard-list li.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px;
  border-bottom: 1px solid #f8fafc;
  transition: background-color 0.15s ease;
  border-radius: 6px;
}

.leaderboard-list li.rank-item:hover {
  background-color: #f1f5f9;
}

.leaderboard-list li.rank-item a {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.rank-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

/* Stars for 2 & 3 from sprite-leaderboards.svg */
.sno-silver-star {
  display: inline-block;
  background-image: url('../assets/leaderboard/sprite-leaderboards.svg');
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: -85px -15px;
  width: 25px;
  height: 25px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  flex-shrink: 0;
}

.sno-bronze-star {
  display: inline-block;
  background-image: url('../assets/leaderboard/sprite-leaderboards.svg');
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: -159px -15px;
  width: 25px;
  height: 25px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  flex-shrink: 0;
}

.sno-number {
  width: 25px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  flex-shrink: 0;
}

.rank-item .profile-pic {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.rank-item .profile-pic img.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rank-item .profile-pic img.flag {
  position: absolute;
  bottom: -1px;
  left: -2px;
  width: 15px;
  height: 11px;
  border-radius: 1.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  object-fit: cover;
}

.leaderboard-list li.list-empty {
  text-align: center;
  padding: 36px 16px;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 500;
}

.rank-item .crown-svg {
  height: 16px;
  width: auto;
  max-width: none !important;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

.rank-item .nick-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-width: 0;
  max-width: 160px;
  overflow: hidden;
}

.rank-item .nick-text {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rank-item .score-total {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  text-align: right;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .leaderboard-content {
    grid-template-columns: 1fr;
  }
  .top-members .banner {
    width: 100%;
    height: 140px;
  }
  .top-members .banner .banner-title {
    display: none;
  }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.leaderboard-footer {
  margin-top: 60px;
  padding: 32px 0 40px;
  border-top: 1px solid #e2e8f0;
  background-color: #ffffff;
  text-align: center;
}

.leaderboard-footer p {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* Loading / error rows inside leaderboard columns */
.list-loading,
.list-error {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-weight: 500;
  font-size: 13px;
}

/* ==========================================================================
   UNIVERSAL DARK MODE OVERRIDES (LEADERBOARD.CSS)
   ========================================================================== */
html[data-theme="dark"] .leaderboard-body,
html.dark .leaderboard-body {
  background-color: var(--bg-page);
  color: var(--text-secondary);
}

html[data-theme="dark"] .top-members,
html.dark .top-members {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .leaderboard-section,
html.dark .leaderboard-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .panel-header,
html.dark .panel-header {
  border-bottom: 1px solid var(--border-subtle);
}

html[data-theme="dark"] .panel-header h4,
html.dark .panel-header h4 {
  color: var(--text-primary);
}

html[data-theme="dark"] .rank-1,
html.dark .rank-1 {
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.15) 0%, rgba(16, 22, 36, 0.95) 100%);
  border-bottom: 1px solid var(--border-subtle);
}

html[data-theme="dark"] .rank-item,
html.dark .rank-item {
  border-bottom: 1px solid var(--border-subtle);
}

html[data-theme="dark"] .rank-item a,
html.dark .rank-item a {
  color: var(--text-primary);
}

html[data-theme="dark"] .rank-item a:hover,
html.dark .rank-item a:hover {
  background: var(--bg-surface-hover);
}

html[data-theme="dark"] .rank-item .score-total,
html.dark .rank-item .score-total {
  color: var(--text-muted);
}

html[data-theme="dark"] .sno-number,
html.dark .sno-number {
  color: var(--text-faint);
}

html[data-theme="dark"] .leaderboard-footer,
html.dark .leaderboard-footer {
  background-color: var(--bg-page);
  border-top: 1px solid var(--border-subtle);
}

/* Strict avatar constraints for leaderboard */
.rank-1 .profile-pic {
  position: relative;
  width: 54px !important;
  height: 54px !important;
  margin: 0 auto 8px !important;
  display: block !important;
}

.rank-1 .profile-pic img.avatar {
  width: 54px !important;
  height: 54px !important;
  max-width: 54px !important;
  max-height: 54px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}

.rank-item .profile-pic {
  position: relative !important;
  width: 36px !important;
  height: 36px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.rank-item .profile-pic img.avatar {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}
