/* 龙虎榜页面样式 - 基于 UIPro Figma 设计 */
@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

.leaderboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  font-family: 'Noto Sans SC', $font-family-base;
}

/* 页面头部 */
.leaderboard__header {
  align-self: stretch;
  backdrop-filter: blur(4px);
  background-color: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 0;
  gap: 10px;
}

.leaderboard__title {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  color: #0f172a;
}

.leaderboard__exportBtn {
  cursor: pointer;
  border: none;
  padding: 8px 12px;
  background-color: #fff;
  box-shadow: 0px 0px 0px #fff inset, 0px 0px 0px 1px #cbd5e1 inset, 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  @include transition-fast;

  &:hover {
    background-color: #f9fafb;
  }

  svg {
    width: 18px;
    height: 18px;
    color: #334155;
  }
}

.leaderboard__exportText {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: #334155;
}

/* 主内容区域 */
.leaderboard__content {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

/* 榜单列表区域 */
.leaderboard__boards {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  min-width: 346px;
}

/* 单个榜单卡片 */
.leaderboard__board {
  align-self: stretch;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  gap: 16px;
}

/* 榜单头部 */
.leaderboard__boardHeader {
  align-self: stretch;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: 16px;
  gap: 10px;
}

.leaderboard__boardInfo {
  display: flex;
  align-items: center;
  gap: 16px;
}

.leaderboard__boardTitle {
  margin: 0;
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  color: #0f172a;
}

.leaderboard__boardDesc {
  font-size: 14px;
  line-height: 20px;
  color: #64748b;
}

.leaderboard__boardToggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #64748b;
}

.leaderboard__toggleLabel {
  font-weight: 500;
}

/* 排名表格 */
.leaderboard__table {
  align-self: stretch;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.leaderboard__tableHeader {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  min-width: 453px;
}

.leaderboard__tableHeaderCell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: #64748b;

  &--rank {
    flex: 1;
    min-width: 61px;
    max-width: 96px;
  }

  &--avatar {
    width: 64px;
  }

  &--nickname {
    flex: 1;
    min-width: 154px;
  }

  &--count {
    flex: 1;
    min-width: 87px;
    max-width: 128px;
  }

  &--team {
    flex: 1;
    min-width: 87px;
    max-width: 128px;
  }
}

.leaderboard__tableBody {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 453px;
}

.leaderboard__tableRow {
  align-self: stretch;
  display: flex;
  align-items: center;
  border-top: 1px solid #f3f4f6;

  &--gold {
    background-color: #f3f4f6;
  }

  &--silver {
    background-color: #f8f8f8;
  }

  &--bronze {
    background-color: #f3f4f6;
  }
}

.leaderboard__tableCell {
  display: flex;
  align-items: center;
  padding: 16px;
  font-size: 14px;
  line-height: 20px;
  color: #475569;

  &--rank {
    flex: 1;
    min-width: 61px;
    max-width: 96px;
  }

  &--avatar {
    width: 64px;
    padding: 0;
  }

  &--nickname {
    flex: 1;
    min-width: 154px;
    gap: 8px;
    color: #1e293b;
    font-weight: 500;
  }

  &--count {
    flex: 1;
    min-width: 87px;
    max-width: 128px;
    font-weight: 500;
  }

  &--team {
    flex: 1;
    min-width: 87px;
    max-width: 128px;
  }
}

/* 排名样式 */
.leaderboard__rankMedal {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;

  &--gold {
    color: #d4af37;
  }

  &--silver {
    color: #a0a0a0;
  }

  &--bronze {
    color: #cd7f32;
  }

  &--normal {
    color: #64748b;
    font-weight: 500;
  }
}

/* 头像 */
.leaderboard__avatar {
  width: 60px;
  height: 60px;
  border-radius: 9999px;
  object-fit: cover;
}

/* 虚拟标签 */
.leaderboard__virtualTag {
  border-radius: 9999px;
  background-color: #e5e7eb;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: #475569;
}

/* 空状态 */
.leaderboard__empty {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  gap: 16px;
}

.leaderboard__emptyIcon {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background-color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;

  svg {
    width: 32px;
    height: 32px;
    color: #94a3b8;
  }
}

.leaderboard__emptyTitle {
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  color: #334155;
  margin: 0;
}

.leaderboard__emptyStatus {
  font-size: 14px;
  line-height: 20px;
  color: #64748b;
}

/* 设置面板 */
.leaderboard__settings {
  flex: 0 0 auto;
  width: 100%;
  max-width: 384px;
  min-width: 316px;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  gap: 23px;
}

.leaderboard__settingsTitle {
  align-self: stretch;
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.leaderboard__settingsContent {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
}

.leaderboard__settingsSection {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.leaderboard__sectionTitle {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.leaderboard__settingsItem {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.leaderboard__settingsLabel {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: #334155;
}

/* 数量输入和滑块 */
.leaderboard__sliderGroup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.leaderboard__numberInput {
  width: 80px;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  background-color: #fff;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 20px;
  color: #1e293b;
  text-align: right;

  &:focus {
    outline: none;
    border-color: #005a9c;
  }
}

.leaderboard__slider {
  flex: 1;
  height: 8px;
  border-radius: 12px;
  background-color: #e2e8f0;
  appearance: none;
  cursor: pointer;

  &::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #4f46e5;
    cursor: pointer;
  }

  &::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #4f46e5;
    cursor: pointer;
    border: none;
  }
}

/* 规则说明折叠 */
.leaderboard__rulesToggle {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 0;

  span {
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
    color: #334155;
  }

  svg {
    width: 24px;
    height: 24px;
    color: #64748b;
    @include transition-fast;
  }

  &--expanded svg {
    transform: rotate(180deg);
  }
}

/* 实时预览 */
.leaderboard__preview {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard__previewTitle {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: #334155;
}

.leaderboard__previewList {
  align-self: stretch;
  border-radius: 6px;
  background-color: #f8fafc;
  border: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px;
  gap: 8px;
}

.leaderboard__previewItem {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard__previewAvatar {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  object-fit: cover;
}

.leaderboard__previewName {
  flex: 1;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: #1e293b;
}

.leaderboard__previewTag {
  border-radius: 9999px;
  background-color: #e5e7eb;
  padding: 2px 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: #475569;
}

/* 显示设置选择器 */
.leaderboard__select {
  align-self: stretch;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  background-color: #fff;
  border: 1px solid #cbd5e1;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 20px;
  color: #1e293b;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* 保存按钮区域 */
.leaderboard__settingsFooter {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.leaderboard__saveBtn {
  cursor: pointer;
  border: none;
  padding: 10px 16px;
  background-color: #4f46e5;
  align-self: stretch;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: #fff;
  @include transition-fast;

  &:hover {
    background-color: #4338ca;
  }
}

/* Toggle 开关样式 */
.leaderboard__toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  cursor: pointer;
  @include transition-fast;

  &--on {
    background-color: #4f46e5;
  }

  &--off {
    background-color: #cbd5e1;
  }
}

.leaderboard__toggleHandle {
  position: absolute;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background-color: #fff;
  @include transition-fast;

  &--on {
    left: 24px;
  }

  &--off {
    left: 4px;
  }
}
