/* ===== 统计面板专属CSS样式 ===== */

/* CSS变量系统 - 统一管理设计令牌 */
:root {
  /* === 间距系统 === */
  --spacing-xs: 4px;    /* 最小间距 */
  --spacing-sm: 8px;    /* 小间距 */
  --spacing-md: 12px;   /* 中等间距 */
  --spacing-lg: 15px;   /* 大间距 */
  --spacing-xl: 20px;   /* 最大间距 */

  /* === 字体大小系统 === */
  --font-xs: 10px;      /* 极小文字 */
  --font-sm: 12px;      /* 小文字 */
  --font-base: 13px;    /* 基础文字 */
  --font-md: 14px;      /* 中等文字 */
  --font-lg: 16px;      /* 大文字 */
  --font-xl: 18px;      /* 特大文字 */
  --font-2xl: 24px;     /* 数值显示 */

  /* === 圆角系统 === */
  --radius-sm: 6px;     /* 小圆角 */
  --radius-md: 8px;     /* 中等圆角 */
  --radius-lg: 10px;    /* 大圆角 */

  /* === 阴影系统 === */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* === 通用工具类 === */
/* Flex布局工具类 */
.flex { display: flex; }
.flex-center {
  display: flex;
  align-items: center;
}
.flex-column {
  display: flex;
  flex-direction: column;
}
.flex-center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 间距工具类 */
.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* 组件基础类 */
.card-base {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* === 统计面板展开/收起功能 === */
.stats-toggle {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: none;
  border: none;
  font-size: var(--font-sm);
  color: #3d68a8;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  text-decoration: none;
}

.stats-toggle:hover {
  color: #7a97d0;
  transform: none;
  box-shadow: none;
}

.stats-toggle.active {
  color: #2c5094;
  background: none;
}

.stats-toggle.active:hover {
  color: #7a97d0;
}

.toggle-icon {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: -3px;
}

.stats-toggle.active .toggle-icon {
  transform: rotate(180deg);
}

/* 统计面板容器 - 合并重复规则 */
.stats-panel {
    border: 1px solid #e3e3e3;
    border-radius: var(--radius-lg);
    background-color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.stats-panel.show {
  animation: slideDown 0.3s ease-out;
}

/* 移除收起动画，直接隐藏 */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stats-panel:hover {
    box-shadow: var(--shadow-md);
}

/* 统计面板头部 */
.stats-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, #e5f3ee 0%, #f0f8f5 100%);
    border-bottom: 1px solid #d0e9dc;
}

.stats-header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.stats-icon {
    font-size: var(--font-2xl);
    line-height: 1;
}

.stats-title h3 {
    margin: 0;
    font-size: var(--font-xl);
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
}

.stats-subtitle {
    margin: 2px 0 0 0;
    font-size: var(--font-base);
    color: #7f8c8d;
    line-height: 1.2;
}

/* 统计内容区域 */
.stats-content {
    padding: 15px;
}

/* 统计卡片行 */
.stats-main-row {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.stats-main-row:last-child {
    margin-bottom: 0;
}

/* 单个统计卡片 */
.stats-item {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md); /* 进一步减少上下内边距，从10px改为8px */
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stats-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    transition: all 0.3s ease;
}

/* 胜率饼图卡片样式 */
.stats-item.stats-winrate-chart {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-color: #e9ecef;
    min-height: 200px;
}

.stats-item.stats-winrate-chart:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 饼图容器 */
.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm); /* 固定间距，从10px改为8px，让内容更紧凑 */
    padding-top: var(--spacing-sm); /* 进一步减少顶部间距，从8px改为6px */
}

/* CSS饼图实现 */
.pie-chart {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(
        #4caf50 0deg 216deg,  /* 胜利: 60% = 216度 */
        #f44336 216deg 360deg  /* 失败: 40% = 144度 */
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

/* 无数据状态的饼图 */
.pie-chart.pie-chart-empty {
    background: #e0e0e0; /* 统一的灰色背景 */
}

.pie-chart.pie-chart-empty .pie-center {
    color: #757575; /* 深灰色文字 */
}

.pie-chart.pie-chart-empty .win-rate {
    color: #757575;
    font-size: 24px;
    font-weight: 600;
}

.pie-chart.pie-chart-empty .win-rate-label {
    color: #9e9e9e;
    font-size: 11px;
    margin-top: 2px;
}

/* 饼图中心圆 */
.pie-center {
    position: absolute;
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.win-rate {
    font-size: var(--font-xl);
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.win-rate-label {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
    line-height: 1;
}

/* 图例样式 */
.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: var(--font-base);
	    gap: 5px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-item.legend-win .legend-dot {
    background-color: #4caf50;
}

.legend-item.legend-lose .legend-dot {
    background-color: #f44336;
}

/* 无数据状态的图例样式 */
.legend-item.legend-empty .legend-dot {
    background-color: #e0e0e0;
}

.legend-item.legend-empty .legend-text {
    color: #9e9e9e;
    font-style: italic;
}

.legend-text {
    color: #5a6c7d;
    font-weight: 500;
}

/* 为图例文本中的数字添加左右间距 */
.legend-number {
    margin: 0 var(--spacing-xs); /* 数字左右各2px间距 */
}

/* 收益卡片样式 */
.stats-item.stats-earnings {
    border-color: #c8e6c9;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stats-item.stats-earnings.stats-positive {
    background: linear-gradient(135deg, #e8f5e8 0%, #f4faf4 100%);
}

.stats-item.stats-earnings.stats-negative {
    background: linear-gradient(135deg, #ffebee 0%, #fef7f7 100%);
    border-color: #ffcdd2;
}

.stats-item.stats-earnings:hover {
    transform: translateY(-2px);
}

.stats-item.stats-earnings.stats-positive:hover {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

.stats-item.stats-earnings.stats-negative:hover {
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.15);
}

/* 收益明细样式 */
.earnings-breakdown {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px dashed rgba(76, 175, 80, 0.3);
	transform: translateY(-3px);
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-sm);
}

.breakdown-item:last-child {
    margin-bottom: 0;
}

.breakdown-label {
    color: #6c757d;
    font-weight: 500;
}

.breakdown-value {
    font-weight: 600;
}

.breakdown-value.positive {
    color: #388e3c;
}

.breakdown-value.negative {
    color: #d32f2f;
}

/* 对战统计卡片样式 */
.stats-item.stats-battle {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-color: #e9ecef;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 改回普通布局 */
}

.stats-item.stats-battle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* 统计时间信息样式 */
.stats-time-info {
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px dashed rgba(108, 117, 125, 0.2);
    text-align: center;
}

.time-period {
    font-size: 11px;
    color: #6c757d;
    font-weight: 500;
    line-height: 1.2;
}

/* 对战统计项目（在卡片内） */
.stats-item.stats-battle .battle-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    flex: 0 0 auto;
    padding-top: 8px;
}

.stats-item.stats-battle .battle-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.stats-item.stats-battle .battle-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stats-item.stats-battle .battle-icon {
    font-size: var(--font-md);
    line-height: 1;
}

.stats-item.stats-battle .battle-label {
    font-size: var(--font-base);
    font-weight: 500;
    color: #6c757d;
}

/* 统计卡片头部 */
.stats-item-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: 8px;
}

.stats-item-icon {
    font-size: var(--font-lg);
    line-height: 1;
}

.stats-label {
    font-size: var(--font-md);
    font-weight: 600; /* 加粗标题，从500改为600 */
    color: #5a6c7d;
}

/* 统计数值 */
.stats-value {
    font-size: var(--font-2xl);
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1;
}

.stats-item.stats-earnings.stats-positive .stats-value {
    color: #388e3c;
}

.stats-item.stats-earnings.stats-negative .stats-value {
    color: #d32f2f;
}

/* 统计补充信息 */
.stats-count {
    font-size: var(--font-sm);
    color: #7f8c8d;
    font-weight: 400;
    line-height: 1.2;
}


/* 分组标题样式 */
.section-title {
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 15px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 6px;
}

.title-icon {
    font-size: var(--font-lg);
    line-height: 1;
}

/* 对战统计区域 */
.battle-stats {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.battle-stats:hover {
    box-shadow: var(--shadow-md);
}


/* 进度条样式 */
.battle-progress {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.progress-bar {
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    border-radius: 3px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-sm);
}

.total-games {
    font-weight: 600;
    color: #495057;
}

.win-lose-ratio {
    color: #6c757d;
    font-weight: 500;
}

/* 赌注统计区域 */
.money-stats {
    background: linear-gradient(135deg, #fff8e1 0%, #ffffff 100%);
    border: 1px solid #ffecb3;
    border-radius: 10px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.money-stats:hover {
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.1);
}

.money-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.money-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    transition: all 0.3s ease;
}

.money-item:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 193, 7, 0.4);
    transform: translateY(-1px);
}

.money-item.highlight {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-color: rgba(255, 193, 7, 0.3);
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

.money-item.highlight:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-color: rgba(255, 193, 7, 0.5);
    box-shadow: 0 3px 8px rgba(255, 193, 7, 0.15);
}

.money-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ffc107, #ffb300);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
    flex-shrink: 0;
}

.money-icon {
    font-size: var(--font-lg);
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.money-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.money-label {
    font-size: var(--font-sm);
    color: #6c757d;
    font-weight: 500;
    line-height: 1.2;
}

.money-value {
    font-size: var(--font-lg);
    font-weight: 700;
    color: #f57c00;
    line-height: 1;
}

.money-unit {
    font-size: 11px;
    color: #9e9e9e;
    font-weight: 500;
    line-height: 1;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 响应式设计 - 更新主布局 */
@media (max-width: 600px) {
.stats-main-row{gap: var(--spacing-md);}
}
/* 小屏设备 */
@media (max-width: 480px) {
	.stats-content {
    padding: 10px;
}
    .stats-main-row {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .stats-item {
        flex: none;
        min-height: auto;
        padding: 12px 10px;
    }

    .stats-item.stats-winrate-chart {
        flex: none;
        min-height: auto;
    }

    .stats-item.stats-earnings {
        flex: none;
        min-height: auto;
    }

    .pie-chart-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: var(--spacing-xl);
		margin: 0 5%;
    }

    .chart-legend {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    /* 详细统计响应式 */
    .stats-details {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        margin-top: 10px;
    }

    .battle-stats,
    .money-stats {
        padding: 10px;
    }

    .section-title {
        font-size: var(--font-base);
        margin-bottom: 8px;
        padding-bottom: 3px;
    }

    .title-icon {
        font-size: var(--font-md);
    }

    .battle-items,
    .money-items {
        gap: var(--spacing-sm);
    }

    .money-item {
        padding: 6px;
        gap: var(--spacing-sm);
    }

    .money-icon-wrapper {
        width: 24px;
        height: 24px;
    }

    .money-icon {
        font-size: var(--font-sm);
    }

    .money-label {
        font-size: var(--font-xs);
    }

    .money-value {
        font-size: var(--font-base);
    }

    .money-unit {
        font-size: 9px;
    }
}
@media (max-width: 350px) {
.stats-content {
    padding: 5px;
}
}
@media (max-width: 290px) {
    .pie-chart-container {
		margin: 0 2%;
    }
}