/* 统计报表页面样式 */

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.page-desc {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

/* 统计卡片 - 自适应网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

/* 响应式断点 */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 14px;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
}

/* 图表区域网格布局 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.chart-card .card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

.chart-card canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* 响应式：移动端图表单列 */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-card {
        padding: 16px;
    }
    
    .chart-card > div[style*="height: 350px"] {
        height: 280px !important;
    }
}

/* 筛选器样式 */
.filter-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

/* 分类标签扩展颜色 */
.category-tag.category-Runtime { background: #e0e7ff; color: #4f46e5; }
.category-tag.category-Feature { background: #d1fae5; color: #059669; }
.category-tag.category-Error { background: #fee2e2; color: #dc2626; }
.category-tag.category-Performance { background: #fef3c7; color: #d97706; }
.category-tag.category-Migration { background: #ede9fe; color: #7c3aed; }
.category-tag.category-UserAction { background: #cffafe; color: #0891b2; }
.category-tag.category-Other { background: #f3f4f6; color: #6b7280; }

/* 热门事件表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
}

.data-table th {
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
}

.data-table td {
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #374151;
}

/* 排名徽章 */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.rank-badge.top {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

/* 分类标签 */
.category-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.category-tag.category-Error {
    background: #fee2e2;
    color: #991b1b;
}

.category-tag.category-Warning {
    background: #fef3c7;
    color: #92400e;
}

.category-tag.category-Info {
    background: #dbeafe;
    color: #1e40af;
}

.category-tag.category-Success {
    background: #d1fae5;
    color: #065f46;
}

.category-tag.category-Debug {
    background: #e0e7ff;
    color: #3730a3;
}

/* 移动端表格优化 - 卡片式布局，避免横向溢出 */
@media (max-width: 768px) {
    #top-events-table thead {
        display: none;
    }

    /* 表格容器去除横向滚动，改为卡片堆叠 */
    #top-events-table,
    #top-events-table tbody {
        display: block;
        width: 100%;
    }

    #top-events-table tbody tr {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 8px 12px;
        align-items: center;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 10px;
    }

    #top-events-table td {
        border: none;
        padding: 0;
        max-width: none;
        font-size: 12px;
    }

    /* 第一行：排名徽章 + 事件名称（事件名可换行） */
    #top-events-table td[data-label="#"] {
        grid-column: 1;
        grid-row: 1;
        text-align: center;
    }

    #top-events-table td[data-label="事件名称"] {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        white-space: normal;
        word-break: break-word;
    }

    #top-events-table td[data-label="事件名称"] code {
        display: inline;
        white-space: normal;
        word-break: break-word;
    }

    /* 第二行：分类 + 出现次数 并排 */
    #top-events-table td[data-label="分类"] {
        grid-column: 1;
        grid-row: 2;
    }

    #top-events-table td[data-label="出现次数"] {
        grid-column: 2;
        grid-row: 2;
    }

    /* 兼容：其它非 TOP20 表格保留原横向滚动策略 */
    .data-table {
        table-layout: auto;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }
}

