.analytics-page {
  min-height: 100vh;
  background: #f5f5f5;
}

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 300px;

  .loading-text {
    margin-top: 16px;
    font-size: 28px;
    color: #999;
  }
}

// 实时数据卡片
.realtime-card {
  background: linear-gradient(135deg, #1890ff, #52c41a);
  padding: 24px;
  margin: 24px;
  border-radius: 16px;
  color: #fff;

  .realtime-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;

    .title {
      font-size: 32px;
      font-weight: 600;
    }

    .live-dot {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 22px;

      .dot {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: #fff;
        animation: pulse 1.5s infinite;
      }
    }
  }

  .realtime-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;

    .stat-item {
      text-align: center;

      .stat-value {
        display: block;
        font-size: 36px;
        font-weight: 600;
        margin-bottom: 4px;

        &.error {
          color: #ff6b6b;
        }
      }

      .stat-label {
        font-size: 22px;
        opacity: 0.8;
      }
    }
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

// 今日概览
.overview-stats {
  display: flex;
  padding: 0 24px;
  gap: 16px;

  .stat-card {
    flex: 1;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    text-align: center;

    .stat-value {
      display: block;
      font-size: 32px;
      font-weight: 600;
      color: #333;
      margin-bottom: 4px;
    }

    .stat-label {
      font-size: 22px;
      color: #999;
    }
  }
}

// Tab 内容
.tab-content {
  height: calc(100vh - 550px);
  padding: 24px;
}

.chart-section,
.metrics-section,
.region-section,
.source-section,
.page-section,
.error-section {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;

  .section-title {
    display: block;
    font-size: 30px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
  }
}

// 图表占位
.chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  background: #fafafa;
  border-radius: 12px;

  .iconfont {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 16px;
  }

  .placeholder-text {
    font-size: 28px;
    color: #666;
    margin-bottom: 8px;
  }

  .placeholder-hint {
    font-size: 22px;
    color: #999;
  }
}

// 饼图
.pie-chart {
  .pie-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;

    &:last-child {
      border-bottom: none;
    }

    .pie-color {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      margin-right: 12px;
    }

    .pie-label {
      flex: 1;
      font-size: 26px;
      color: #333;
    }

    .pie-value {
      font-size: 26px;
      color: #666;
    }
  }
}

// 性能指标
.metric-item {
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;

  &:last-child {
    border-bottom: none;
  }

  .metric-info {
    .metric-name {
      display: block;
      font-size: 26px;
      color: #666;
      margin-bottom: 8px;
    }

    .metric-value-row {
      display: flex;
      align-items: baseline;
      gap: 8px;

      .metric-value {
        font-size: 40px;
        font-weight: 600;
        color: #333;
      }

      .metric-unit {
        font-size: 24px;
        color: #999;
      }
    }
  }
}

// 错误统计
.error-summary {
  display: flex;
  gap: 24px;

  .error-item {
    flex: 1;
    text-align: center;
    padding: 20px;
    background: #fafafa;
    border-radius: 12px;

    .error-value {
      display: block;
      font-size: 40px;
      font-weight: 600;
      margin-bottom: 8px;

      &.error {
        color: #F44336;
      }

      &.warning {
        color: #FF9800;
      }
    }

    .error-label {
      font-size: 24px;
      color: #666;
    }
  }
}

// 用户统计
.user-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;

  .user-card {
    background: #fff;
    padding: 24px 16px;
    border-radius: 12px;
    text-align: center;

    .user-value {
      display: block;
      font-size: 36px;
      font-weight: 600;
      color: #1890ff;
      margin-bottom: 8px;
    }

    .user-label {
      font-size: 24px;
      color: #666;
    }
  }
}

// 区域分布
.region-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;

  &:last-child {
    border-bottom: none;
  }

  .region-rank {
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    background: #1890ff;
    color: #fff;
    border-radius: 50%;
    font-size: 22px;
    margin-right: 12px;
  }

  .region-name {
    width: 100px;
    font-size: 26px;
    color: #333;
  }

  .region-bar {
    flex: 1;
    height: 16px;
    background: #f0f0f0;
    border-radius: 8px;
    margin: 0 12px;
    overflow: hidden;

    .bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #1890ff, #52c41a);
      border-radius: 8px;
    }
  }

  .region-value {
    width: 80px;
    text-align: right;
    font-size: 26px;
    color: #666;
  }
}

// 来源分布
.source-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;

  &:last-child {
    border-bottom: none;
  }

  .source-rank {
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    background: #f0f0f0;
    color: #666;
    border-radius: 50%;
    font-size: 22px;
    margin-right: 12px;
  }

  .source-name {
    flex: 1;
    font-size: 26px;
    color: #333;
  }

  .source-value {
    font-size: 26px;
    color: #666;
  }
}

// 页面排行
.page-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid #f0f0f0;

  &:last-child {
    border-bottom: none;
  }

  .page-rank {
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    background: #1890ff;
    color: #fff;
    border-radius: 50%;
    font-size: 22px;
    margin-right: 12px;
  }

  .page-info {
    flex: 1;

    .page-title {
      display: block;
      font-size: 26px;
      color: #333;
      margin-bottom: 4px;
    }

    .page-path {
      font-size: 22px;
      color: #999;
    }
  }

  .page-stats {
    display: flex;
    gap: 16px;

    .page-stat {
      text-align: center;

      .stat-num {
        display: block;
        font-size: 26px;
        font-weight: 500;
        color: #333;
      }

      .stat-label {
        font-size: 20px;
        color: #999;
      }
    }
  }
}

// 空数据
.empty-data {
  text-align: center;
  padding: 48px;
  font-size: 26px;
  color: #999;
}
