/* 数据可视化区块样式 */
.charts-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #141e30 0%, #243b55 100%);
    position: relative;
}

.charts-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="80" height="80" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="0" width="80" height="80" fill="none" stroke="rgba(255,215,0,0.05)" stroke-width="1"/></svg>') repeat;
    opacity: 0.5;
}

.charts-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.charts-header {
    text-align: center;
    margin-bottom: 50px;
}

.charts-title {
    font-size: 2.5em;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.charts-subtitle {
    font-size: 1.1em;
    color: #ccc;
}

/* 图表控制面板 */
.charts-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.chart-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #fff;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1em;
}

.chart-btn:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: #ffd700;
    transform: translateY(-2px);
}

.chart-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

/* 图表网格布局 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
}

.chart-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.chart-card:hover {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-icon {
    font-size: 1.5em;
}

.chart-refresh {
    background: rgba(255, 215, 0, 0.1);
    border: none;
    color: #ffd700;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.chart-refresh:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: rotate(180deg);
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 20px;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
}

.chart-canvas {
    width: 100%;
    height: 100%;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 215, 0, 0.3);
}

.stat-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 5px;
}

.stat-label {
    color: #999;
    font-size: 0.9em;
}

.stat-change {
    font-size: 0.85em;
    margin-top: 10px;
}

.stat-change.positive {
    color: #64ff64;
}

.stat-change.negative {
    color: #ff6464;
}

/* 简单柱状图样式 */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 100%;
    padding: 20px 0;
    gap: 10px;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.bar {
    width: 60%;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px 5px 0 0;
    transition: all 0.3s ease;
    position: relative;
    min-height: 20px;
}

.bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
    transform-origin: bottom;
}

.bar-value {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bar:hover .bar-value {
    opacity: 1;
}

.bar-label {
    color: #ccc;
    font-size: 0.85em;
    text-align: center;
}

/* 简单饼图样式 */
.pie-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    position: relative;
}

.pie {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        #667eea 0deg 90deg,
        #764ba2 90deg 180deg,
        #f093fb 180deg 270deg,
        #f5576c 270deg 360deg
    );
    position: relative;
}

.pie-legend {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #ccc;
    font-size: 0.9em;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* 简单折线图样式 */
.line-chart {
    position: relative;
    height: 100%;
    padding: 20px;
}

.line-grid {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.grid-line {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.grid-line span {
    position: absolute;
    left: -30px;
    top: -10px;
    color: #999;
    font-size: 0.8em;
}

.line-data {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 40px;
}

.data-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-point:hover {
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.data-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #999;
    font-size: 0.8em;
    white-space: nowrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .charts-controls {
        flex-direction: column;
        align-items: center;
    }

    .chart-btn {
        width: 100%;
        max-width: 300px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-title {
        font-size: 2em;
    }

    .pie {
        width: 150px;
        height: 150px;
    }

    .pie-legend {
        position: static;
        transform: none;
        margin-top: 20px;
        text-align: center;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.chart-card {
    animation: fadeIn 0.6s ease forwards;
}

.chart-card:nth-child(1) { animation-delay: 0.1s; }
.chart-card:nth-child(2) { animation-delay: 0.2s; }
.chart-card:nth-child(3) { animation-delay: 0.3s; }
.chart-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes growUp {
    from {
        transform: scaleY(0);
    }
    to {
        transform: scaleY(1);
    }
}

.bar {
    transform-origin: bottom;
    animation: growUp 0.6s ease forwards;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.chart-refresh.loading {
    animation: spin 1s linear infinite;
}

/* 加载动画 */
.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ffd700;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
