/* 统计页面样式 */
.statistics-page {
    display: flex;
    min-height: calc(100vh - 70px);
    background: var(--bg-secondary);
}

/* 左侧边栏 */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 8px 24px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1) 0%, transparent 100%);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* 右侧内容区 */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.total {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: var(--primary-color);
}

.stat-icon.parameters {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
    color: var(--accent-color);
}

.stat-icon.types {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    color: #8b5cf6;
}

.stat-icon.updates {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    color: var(--success-color);
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 图表区域 */
.charts-section {
    margin-bottom: 32px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

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

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-filter {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.chart-filter:focus {
    border-color: var(--primary-color);
}

.chart-content {
    min-height: 300px;
}

/* 饼图 */
.pie-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 280px;
    position: relative;
}

.pie-chart-svg {
    width: 280px;
    height: 280px;
    transform: rotate(-90deg);
}

.pie-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

.pie-center-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pie-center-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.pie-slice {
    cursor: pointer;
    transition: all 0.3s;
}

.pie-slice:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
    transform-origin: center;
}

.pie-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.legend-line {
    width: 24px;
    height: 3px;
    border-radius: 2px;
}

/* 柱状图 */
.bar-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 250px;
    padding: 20px 0;
}

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

.bar {
    width: 40px;
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: all 0.3s;
    cursor: pointer;
}

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

.bar-value {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.bar-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 混合图表 */
.mixed-chart-container {
    height: 300px;
    position: relative;
}

.mixed-chart-svg {
    width: 100%;
    height: 100%;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.chart-bar {
    transition: all 0.3s;
    cursor: pointer;
}

.chart-bar:hover {
    filter: brightness(1.1);
}

.chart-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-point {
    fill: white;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.3s;
}

.chart-line-point:hover {
    r: 6;
}

.chart-grid-line {
    stroke: var(--border-color);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.chart-axis-text {
    font-size: 12px;
    fill: var(--text-secondary);
}

.chart-bar-label {
    font-size: 12px;
    fill: var(--text-primary);
    text-anchor: middle;
}

.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.chart-tooltip.show {
    opacity: 1;
}

/* 参数网格 */
.parameter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.parameter-item {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
}

.parameter-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.parameter-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.parameter-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.parameter-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 数据表格 */
.data-table-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

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

.table-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 12px;
}

.search-input {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    width: 250px;
    outline: none;
    transition: all 0.3s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-export {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-export:hover {
    background: var(--primary-dark);
}

.table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    width: 100%;
}

/* 表格固定表头 */
.table-container table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    width: max-content;
}

.table-container thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-secondary);
}

/* 自定义滚动条样式 */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.metal {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.badge.inorganic {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-color);
}

.badge.polymer {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.badge.composite {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge.nano {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge.functional {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge.creep {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.badge.electronic {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-color);
}

.badge.elastic {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.btn-view {
    padding: 6px 16px;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-view:hover {
    background: var(--primary-color);
    color: white;
}

.table-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.pagination-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

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

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

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .main-content {
        padding: 20px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .parameter-grid {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .table-actions {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }
}
