/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #eee;
    min-height: 100vh;
    line-height: 1.6;
}

/* 头部 */
header {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #888;
}

/* 主内容 */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 4rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* 汇总卡片 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.2);
}

.card h3 {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 1.8rem;
    font-weight: bold;
    color: #00d4ff;
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover, .tab.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border-color: #00d4ff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 表格 */
table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #00d4ff;
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

td a {
    color: #fff;
    text-decoration: none;
}

td a:hover {
    color: #00d4ff;
}

.description {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #888;
    font-size: 0.9rem;
}

/* 图表 */
#charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-container h3 {
    margin-bottom: 1rem;
    color: #00d4ff;
}

/* 底部 */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 2rem;
}

/* 时间范围切换 */
.period-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.period-tab {
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.period-tab:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

.period-tab.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border-color: #00d4ff;
}

/* 高亮卡片 */
.card.highlight p {
    color: #10b981;
}

/* 排行榜标题 */
#rankings h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* 排名 */
.rank {
    font-weight: bold;
    color: #00d4ff;
    font-size: 1.1rem;
}

/* 项目名称 */
.project-name {
    display: flex;
    flex-direction: column;
}

.project-name strong {
    color: #fff;
}

.project-name .owner {
    font-size: 0.8rem;
    color: #666;
}

/* 语言标签 */
.lang-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(124, 58, 237, 0.2);
    border-radius: 4px;
    font-size: 0.8rem;
    color: #a78bfa;
}

/* 新增 Stars */
.stars-period {
    color: #10b981;
    font-weight: bold;
}

/* 总 Stars */
.stars-total {
    color: #f59e0b;
}

/* 更新信息 */
.update-info {
    text-align: center;
    margin-top: 2rem;
    color: #666;
    font-size: 0.9rem;
}

.update-info .powered-by {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #555;
}

/* 评分样式 */
.score {
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
}

.score-high {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.score-medium {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.score-low {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.score-na {
    color: #666;
}

/* 统计分析区域 */
.stats-section {
    margin-top: 2rem;
}

.stats-section h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: #00d4ff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card h4 {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.stat-card p {
    font-size: 1.5rem;
    font-weight: bold;
    color: #7c3aed;
}

.stat-card .unit {
    font-size: 0.8rem;
    color: #666;
}

/* 提交趋势区域 */
.commit-section {
    margin-top: 2rem;
}

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

.trend-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.trend-label {
    color: #888;
    font-size: 0.9rem;
}

.trend-value {
    font-weight: bold;
    font-size: 1.1rem;
}

.trend-up {
    color: #10b981;
}

.trend-down {
    color: #ef4444;
}

.trend-stable {
    color: #f59e0b;
}

/* 响应式 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .period-tabs {
        flex-wrap: wrap;
    }

    .period-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

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

    #charts {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }

    .description {
        max-width: 150px;
    }
}
