/* 数据统计页面样式 - 基于 UIPro Figma 设计 */
@use '@/styles/variables' as *;
@use '@/styles/mixins' as *;

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

/* 页面标题 */
.statistics__title {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  color: #0f172a;
}

/* [2026-01-04] 新增：主Tab切换样式 */
/* 回滚方式：删除以下 mainTabs 和 mainTab 样式 */
.statistics__mainTabs {
  align-self: stretch;
  display: flex;
  gap: 8px;
  padding: 4px;
  background-color: #f3f4f6;
  border-radius: 10px;
  width: fit-content;
}

.statistics__mainTab {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  background-color: transparent;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;

  &:hover {
    color: #374151;
    background-color: rgba(255, 255, 255, 0.5);
  }

  &--active {
    background-color: #fff;
    color: #1f2937;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
}

/* 统计概览卡片组 */
.statistics__overview {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.statistics__overviewCard {
  flex: 1;
  min-width: 144px;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  gap: 7px;
}

.statistics__overviewLabel {
  align-self: stretch;
  font-size: 16px;
  line-height: 24px;
  color: #6b7280;
}

.statistics__overviewValue {
  align-self: stretch;
  margin: 0;
  font-size: 30px;
  line-height: 36px;
  font-weight: 700;
  color: #0f172a;
}

/* [2026-01-06] 新增：积分副标题样式 */
.statistics__overviewSubValue {
  align-self: stretch;
  font-size: 14px;
  line-height: 20px;
  color: #9ca3af;
  margin-top: 4px;
}

/* 通用卡片样式 */
.statistics__card {
  align-self: stretch;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  gap: 16px;
}

.statistics__cardHeader {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

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

/* 时间周期切换按钮组 */
.statistics__periodTabs {
  border-radius: 8px;
  background-color: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  gap: 4px;
}

.statistics__periodTab {
  cursor: pointer;
  border: none;
  padding: 4px 12px;
  background-color: transparent;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  font-family: inherit;
  color: #4b5563;
  @include transition-fast;

  &:hover {
    background-color: rgba(255, 255, 255, 0.5);
  }

  &--active {
    background-color: #fff;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: #475569;
  }
}

/* 图表区域 [2026-01-06] 更新：支持真实图表 */
.statistics__chartArea {
  align-self: stretch;
  min-height: 320px;
  border-radius: 8px;
  background-color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #94a3b8;
  padding: 16px;
}

/* 图表加载状态 */
.statistics__chartLoading {
  color: #6b7280;
  font-size: 14px;
}

/* 图表错误状态 */
.statistics__chartError {
  color: #dc2626;
  font-size: 14px;
}

/* 图表空数据状态 */
.statistics__chartEmpty {
  color: #9ca3af;
  font-size: 14px;
}

/* 龙虎榜与排名统计 */
.statistics__sectionTitle {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  color: #0f172a;
}

/* Tab 导航 */
.statistics__tabs {
  align-self: stretch;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding-top: 8px;
}

.statistics__tab {
  cursor: pointer;
  border: none;
  padding: 8px 16px;
  background-color: transparent;
  font-size: 16px;
  line-height: 24px;
  font-family: inherit;
  color: #6b7280;
  @include transition-fast;

  &:hover {
    color: #475569;
  }

  &--active {
    border-bottom: 2px solid #475569;
    font-weight: 700;
    color: #475569;
  }
}

/* 排名表格区域 */
.statistics__rankingSection {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.statistics__rankingTable {
  flex: 1;
  min-width: 310px;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* 表格通用样式 */
.statistics__table {
  align-self: stretch;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.statistics__tableHeader {
  align-self: stretch;
  background-color: #f8fafc;
  display: flex;
  align-items: center;
  min-width: 400px;
}

.statistics__tableRow {
  align-self: stretch;
  background-color: #fff;
  display: flex;
  align-items: center;
  min-width: 400px;

  &--bordered {
    border-bottom: 1px solid #e5e7eb;
  }
}

.statistics__tableCell {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  font-size: 14px;
  line-height: 20px;
  color: #6b7280;

  &--header {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
  }

  &--rank {
    flex: 0.5;
    min-width: 72px;
  }

  &--account {
    flex: 0.7;
    min-width: 117px;
    font-weight: 500;
    color: #0f172a;
  }

  &--count {
    flex: 0.65;
    min-width: 96px;
  }

  &--province {
    flex: 0.65;
    min-width: 84px;
  }

  &--city {
    flex: 1;
    min-width: 36px;
  }
}

/* 排名高亮卡片 */
.statistics__highlightCards {
  flex: 1;
  min-width: 175px;
  max-width: 304px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.statistics__highlightCard {
  align-self: stretch;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.statistics__highlightTitle {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: #4b5563;
  padding: 12px 0;
}

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

.statistics__highlightData {
  font-size: 14px;
  line-height: 20px;
  color: #6b7280;
}

/* 区域统计卡片 */
.statistics__regionCard {
  align-self: stretch;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  gap: 16px;
}

.statistics__regionHeader {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

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

/* 区域统计切换按钮 */
.statistics__regionTabs {
  flex: 1;
  max-width: 200px;
  border-radius: 8px;
  background-color: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  gap: 4px;
}

.statistics__regionTab {
  flex: 1;
  cursor: pointer;
  border: none;
  padding: 6px 16px;
  background-color: transparent;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  font-family: inherit;
  color: #4b5563;
  text-align: center;
  @include transition-fast;

  &--active {
    background-color: #fff;
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    color: #475569;
  }
}

/* 区域统计内容 */
.statistics__regionContent {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  gap: 24px;

  @media (max-width: 768px) {
    flex-direction: column;
  }
}

.statistics__regionChart {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
}

.statistics__regionChartTitle {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: #334155;
}

.statistics__regionChartArea {
  align-self: stretch;
  border-radius: 8px;
  background-color: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 148px 0;
  font-size: 16px;
  color: #94a3b8;
}

.statistics__regionTableWrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 0;
}

/* 区域表格单元格 */
.statistics__regionCell {
  &--region {
    flex: 0.55;
    min-width: 98px;
    font-weight: 500;
    color: #0f172a;
  }

  &--period {
    flex: 0.6;
    min-width: 107px;
  }

  &--count {
    flex: 0.65;
    min-width: 96px;
  }

  &--ratio {
    flex: 1;
    min-width: 40px;
  }
}

/* 社区明细链接 */
.statistics__viewDetail {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.statistics__viewDetailLink {
  cursor: pointer;
  border: none;
  padding: 0;
  background-color: transparent;
  font-size: 14px;
  line-height: 20px;
  font-family: inherit;
  color: #475569;
  @include transition-fast;

  &:hover {
    text-decoration: underline;
  }
}

/* 省/市公司运营统计 */
.statistics__operationCard {
  align-self: stretch;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  gap: 24px;
}

.statistics__operationHeader {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

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

.statistics__exportBtn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background-color: rgba(12, 102, 164, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  font-family: inherit;
  color: #475569;
  @include transition-fast;

  &:hover {
    background-color: rgba(12, 102, 164, 0.15);
  }

  svg {
    width: 16px;
    height: 24px;
  }
}

/* 运营指标卡片组 */
.statistics__metricsGrid {
  align-self: stretch;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.statistics__metricCard {
  flex: 1;
  min-width: 116px;
  border-radius: 8px;
  background-color: #f8f8f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  text-align: center;
}

.statistics__metricLabel {
  font-size: 14px;
  line-height: 20px;
  color: #6b7280;
}

.statistics__metricValue {
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
  color: #0f172a;
}

/* 运营表格单元格 */
.statistics__operationCell {
  &--type {
    flex: 1;
    min-width: 203px;
  }

  &--name {
    flex: 1;
    min-width: 126px;
    font-weight: 500;
    color: #0f172a;
  }

  &--month {
    flex: 1;
    min-width: 107px;
  }

  &--hashrate {
    flex: 1;
    min-width: 105px;
  }

  &--mining {
    flex: 1;
    min-width: 104px;
  }

  &--commission {
    flex: 1;
    min-width: 91px;
  }
}

/* 收益明细与来源 */
.statistics__revenueCard {
  align-self: stretch;
  box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px -1px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background-color: #fff;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  gap: 15px;
}

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

/* 筛选区域 */
.statistics__filters {
  align-self: stretch;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.statistics__filterGroup {
  flex: 1;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

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

.statistics__filterSelect {
  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 13px;
  font-size: 16px;
  line-height: 24px;
  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 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
}

.statistics__filterInputWrapper {
  align-self: stretch;
  display: flex;
  align-items: flex-start;
}

.statistics__filterIcon {
  height: 37px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;

  svg {
    width: 20px;
    height: 20px;
  }
}

.statistics__filterInput {
  flex: 1;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  background-color: #fff;
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  font-size: 16px;
  color: #1e293b;
  outline: none;
  font-family: inherit;

  &::placeholder {
    color: #6b7280;
  }
}

/* 收益表格单元格 */
.statistics__revenueCell {
  &--time {
    flex: 1;
    min-width: 165px;
  }

  &--account {
    flex: 1;
    min-width: 117px;
    font-weight: 500;
    color: #0f172a;
  }

  &--source {
    flex: 1;
    min-width: 104px;
  }

  &--amount {
    flex: 1;
    min-width: 114px;
    font-weight: 700;
    color: #16a34a;
  }

  &--address {
    flex: 1;
    min-width: 111px;
  }

  &--txId {
    flex: 1;
    min-width: 151px;
  }
}

/* 查看时间轴链接 */
.statistics__timelineLink {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
