/**
 * 统计页面样式
 */

.statistics-page {
    max-width: 100%;
    margin: 0;
    padding: 2em 3em;
}

/* 移动端统计页面 - 适应固定导航条 */
@media (max-width: 768px) {
    .statistics-page {
        margin-top: 80px; /* 避免被固定导航条遮挡 */
        padding-top: 1em;
    }
}

/* 页面头部 */
.page-header {
    text-align: center;
    margin-bottom: 2.5em;
    padding-bottom: 1em;
    position: relative;
}

.page-title {
    font-size: 2.2em;
    font-weight: 700;
    margin: 0 0 0.5em 0;
    color: #24292e;
    letter-spacing: -0.5px;
}

.page-description {
    font-size: 1em;
    color: #586069;
    margin: 0;
}

/* 概览卡片 */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5em;
    margin-bottom: 2.5em;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.2em;
    padding: 1.5em 1.8em;
    background: #fafbfc;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 0;
}

.stat-card:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 2.8em;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 1em;
    height: 1em;
    color: #24292e;
    transition: color 0.2s ease;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: clamp(1.8em, 4vw, 2.2em);
    font-weight: 700;
    color: #24292e;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: clamp(0.85em, 2vw, 0.95em);
    color: #586069;
    margin-top: 0.4em;
    font-weight: 500;
}

/* 贡献图区域 */
.contribution-section {
    padding: 2.5em 3em;
    background: #fafbfc;
    border-radius: 6px;
    margin-bottom: 2.5em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5em;
    flex-wrap: wrap;
    gap: 1.5em;
}

.section-header h2 {
    margin: 0;
    color: #24292e;
    font-size: 1.5em;
    font-weight: 600;
}

.contribution-stats {
    color: #586069;
    font-size: 0.95em;
    white-space: nowrap;
}

.contribution-stats strong {
    color: #24292e;
    font-weight: 600;
    font-size: 1.1em;
}

/* 贡献图容器 */
.contribution-graph {
    margin-bottom: 1.2em;
}

.graph-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow-x: auto;
    padding: 1em 0 1em 0.3em;
}

/* 月份标签 */
.contribution-months {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 20px;
    gap: 5px;
    margin-bottom: 8px;
    min-height: 20px;
}

.month-label {
    font-size: 12px;
    color: #656d76;
    font-weight: 500;
    text-align: left;
    line-height: 20px;
    white-space: nowrap;
}

/* 贡献日历 */
.contribution-calendar {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 20px);
    grid-auto-columns: 20px;
    gap: 5px;
}

.contribution-day {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background: #ebedf0;
    cursor: default;
    transition: all 0.15s ease;
    position: relative;
}

.contribution-day:hover {
    outline: 2px solid rgba(27, 31, 35, 0.15);
    outline-offset: 1px;
    z-index: 10;
}

/* 夜间模式下无文章方格悬停效果 */
body.dark-mode .contribution-day:hover {
    outline: 2px solid rgba(201, 209, 217, 0.2);
}

/* 有文章的方块可点击 */
.contribution-day[data-url] {
    cursor: pointer;
}

.contribution-day[data-url]:hover {
    transform: scale(1.15);
    outline: 2px solid rgba(27, 31, 35, 0.3);
}

body.dark-mode .contribution-day[data-url]:hover {
    outline: 2px solid rgba(201, 209, 217, 0.4);
}

/* 贡献等级颜色 */
.contribution-day.level-0 {
    background: #ebedf0;
}

.contribution-day.level-1 {
    background: #9be9a8;
}

.contribution-day.level-2 {
    background: #40c463;
}

.contribution-day.level-3 {
    background: #30a14e;
}

.contribution-day.level-4 {
    background: #216e39;
}

/* 贡献图图例 */
.contribution-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6em;
    font-size: 0.9em;
    color: #586069;
}

.legend-colors {
    display: flex;
    gap: 4px;
}

.legend-box {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    cursor: help;
}

/* 图例颜色 */
.legend-box.level-0 {
    background: #ebedf0;
}

.legend-box.level-1 {
    background: #9be9a8;
}

.legend-box.level-2 {
    background: #40c463;
}

.legend-box.level-3 {
    background: #30a14e;
}

.legend-box.level-4 {
    background: #216e39;
}

.legend-label {
    font-weight: 500;
}

/* 贡献详情 */
.contribution-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1em;
    margin-top: 1.5em;
    padding-top: 1.5em;
    border-top: 1px solid #e1e4e8;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    padding: 1em 1.2em;
    background: #fff;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.detail-item:hover {
    background: #f6f8fa;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(27, 31, 35, 0.08);
}

.detail-label {
    font-size: 0.85em;
    color: #656d76;
    font-weight: 500;
}

.detail-value {
    font-size: 1.3em;
    font-weight: 600;
    color: #24292e;
    letter-spacing: -0.3px;
}

/* 文章归档时间线 */
.archive-timeline {
    margin-top: 3em;
    padding: 2.5em 3em;
    background: #fafbfc;
    border-radius: 6px;
}

.timeline-container {
    margin-top: 2em;
}

.timeline-year {
    margin-bottom: 1.5em;
    border-left: 3px solid #e1e4e8;
    padding-left: 2em;
    position: relative;
}

.timeline-year::before {
    content: '';
    position: absolute;
    left: -9px;
    top: 8px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #d0d7de;
    border: 2px solid #fafbfc;
}

.timeline-year.active::before {
    background: #24292e;
}

.year-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.8em 1.2em;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 1em;
    transition: all 0.2s ease;
}

.year-header:hover {
    background: #f6f8fa;
    transform: translateX(2px);
}

.year-title {
    display: flex;
    align-items: center;
    gap: 1em;
}

.year-icon {
    width: 24px;
    height: 24px;
    color: #656d76;
}

.year-title h3 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #24292e;
}

.year-count {
    font-size: 0.9em;
    color: #656d76;
}

.expand-icon {
    width: 20px;
    height: 20px;
    color: #656d76;
    transition: transform 0.3s ease;
}

.timeline-year.active .expand-icon {
    transform: rotate(180deg);
}

.year-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.timeline-year.active .year-content {
    max-height: 10000px;
}

.timeline-month {
    margin-bottom: 2em;
}

.month-header {
    display: flex;
    align-items: center;
    gap: 0.8em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #e1e4e8;
}

.month-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #24292e;
}

.month-count {
    font-size: 0.85em;
    color: #656d76;
    background: #f6f8fa;
    padding: 0.2em 0.6em;
    border-radius: 12px;
}

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 0.8em;
}

.post-item {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 0.8em 1em;
    background: #fff;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.post-item:hover {
    background: #f6f8fa;
    transform: translateX(3px);
}

.post-date {
    font-size: 0.85em;
    color: #656d76;
    font-family: monospace;
    min-width: 45px;
}

.post-title {
    flex: 1;
    color: #24292e;
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-title:hover {
    color: #000;
    text-decoration: underline;
}

.post-comments {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-size: 0.85em;
    color: #656d76;
}

.post-comments svg {
    width: 14px;
    height: 14px;
}

/* 标签云 */
.tag-cloud-section {
    margin-top: 3em;
    padding: 2.5em 3em;
    background: #fafbfc;
    border-radius: 6px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8em;
    margin-top: 2em;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    background: rgba(136, 136, 136, 0.1);
    border-radius: 4px;
    color: rgb(136, 136, 136);
    text-decoration: none;
    font-size: 0.9em;
}

.tag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.4em;
    background: rgba(136, 136, 136, 0.15);
    border-radius: 3px;
    font-size: 0.85em;
    color: #656d76;
    font-weight: 500;
}

.no-tags {
    margin-top: 2em;
    color: #656d76;
    text-align: center;
}

/* 工具提示 */
.contribution-tooltip {
    position: absolute;
    background: rgba(27, 31, 35, 0.95);
    color: #fff;
    padding: 0.6em 1em;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 3px 12px rgba(27, 31, 35, 0.15);
}

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

.contribution-tooltip::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(27, 31, 35, 0.95);
}

/* 夜间模式 */
body.dark-mode .statistics-page {
    background: transparent;
}

body.dark-mode .page-title {
    color: #c9d1d9;
}

body.dark-mode .page-description {
    color: #8b949e;
}

body.dark-mode .stat-card {
    background: #242424;
}

body.dark-mode .stat-card:hover {
    background: #2d2d2d;
}

body.dark-mode .contribution-section {
    background: #242424;
}

body.dark-mode .stat-icon svg {
    color: #c9d1d9;
}

body.dark-mode .stat-value,
body.dark-mode .section-header h2 {
    color: #c9d1d9;
}

body.dark-mode .stat-label,
body.dark-mode .contribution-stats,
body.dark-mode .graph-days,
body.dark-mode .graph-months,
body.dark-mode .legend-label {
    color: #8b949e;
}

body.dark-mode .contribution-stats strong {
    color: #c9d1d9;
}

body.dark-mode .contribution-day.level-0 {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
}

body.dark-mode .contribution-day.level-1 {
    background: #1e4620;
}

body.dark-mode .contribution-day.level-2 {
    background: #26a641;
}

body.dark-mode .contribution-day.level-3 {
    background: #39d353;
}

body.dark-mode .contribution-day.level-4 {
    background: #57e35c;
}

/* 贡献图滚动条夜间模式 */
body.dark-mode .graph-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.dark-mode .graph-wrapper::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

body.dark-mode .graph-wrapper::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

body.dark-mode .graph-wrapper::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* 月份标签夜间模式 */
body.dark-mode .month-label {
    color: #8b949e;
}

/* 夜间模式图例 */
body.dark-mode .legend-box.level-0 {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
}

body.dark-mode .legend-box.level-1 {
    background: #1e4620;
}

body.dark-mode .legend-box.level-2 {
    background: #26a641;
}

body.dark-mode .legend-box.level-3 {
    background: #39d353;
}

body.dark-mode .legend-box.level-4 {
    background: #57e35c;
}

/* 贡献详情夜间模式 */
body.dark-mode .contribution-details {
    border-top-color: #3a3a3a;
}

body.dark-mode .detail-item {
    background: #1a1a1a;
}

body.dark-mode .detail-item:hover {
    background: #2d2d2d;
}

body.dark-mode .detail-label {
    color: #8b949e;
}

body.dark-mode .detail-value {
    color: #c9d1d9;
}

/* 归档时间线夜间模式 */
body.dark-mode .archive-timeline {
    background: #242424;
}

body.dark-mode .timeline-year {
    border-left-color: #3a3a3a;
}

body.dark-mode .timeline-year::before {
    background: #3a3a3a;
    border-color: #242424;
}

body.dark-mode .timeline-year.active::before {
    background: #c9d1d9;
}

body.dark-mode .year-header {
    background: #1a1a1a;
}

body.dark-mode .year-header:hover {
    background: #2d2d2d;
}

body.dark-mode .year-title h3,
body.dark-mode .month-name,
body.dark-mode .post-title {
    color: #c9d1d9;
}

body.dark-mode .year-icon,
body.dark-mode .expand-icon,
body.dark-mode .year-count,
body.dark-mode .month-count,
body.dark-mode .post-date,
body.dark-mode .post-comments {
    color: #8b949e;
}

body.dark-mode .month-header {
    border-bottom-color: #3a3a3a;
}

body.dark-mode .month-count {
    background: #0d0d0d;
}

/* 标签云夜间模式 */
body.dark-mode .tag-cloud-section {
    background: #242424;
}

body.dark-mode .tag-item {
    background: #1a1a1a;
    color: #c9d1d9;
}

body.dark-mode .tag-count {
    background: #0d0d0d;
    color: #8b949e;
}

body.dark-mode .no-tags {
    color: #8b949e;
}

body.dark-mode .post-item {
    background: #1a1a1a;
}

body.dark-mode .post-item:hover {
    background: #2d2d2d;
}

body.dark-mode .post-title:hover {
    color: #fff;
    text-decoration: underline;
}

/* iPad Pro 和大平板适配 */
@media (max-width: 1366px) and (min-width: 769px) {
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2em;
    }
    
    .stat-card {
        padding: 1.3em 1.5em;
    }
    
    .stat-icon {
        font-size: 2.4em;
    }
    
    .stat-value {
        font-size: 1.9em;
    }
    
    .stat-label {
        font-size: 0.9em;
    }
    
    .contribution-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.9em;
    }
    
    .detail-item {
        padding: 0.95em 1.1em;
    }
    
    .detail-label {
        font-size: 0.82em;
    }
    
    .detail-value {
        font-size: 1.2em;
    }
}

@media (max-width: 768px) {
    .statistics-page {
        padding: 1.5em 1em;
    }
    
    .page-header {
        margin-bottom: 1.5em;
        padding-bottom: 1em;
    }
    
    .page-title {
        font-size: 1.8em;
    }
    
    .page-description {
        font-size: 0.95em;
    }
    
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 1em;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 1.3em 1em;
        gap: 0.8em;
    }
    
    .stat-icon {
        font-size: 2.2em;
    }
    
    .stat-icon svg {
        width: 1.2em;
        height: 1.2em;
    }
    
    .stat-value {
        font-size: 1.8em;
    }
    
    .stat-label {
        font-size: 0.85em;
    }
    
    .contribution-section {
        padding: 1.5em;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1em;
        margin-bottom: 1.5em;
    }
    
    .section-header h2 {
        font-size: 1.3em;
    }
    
    .contribution-stats {
        font-size: 0.85em;
    }
    
    .graph-wrapper {
        padding: 0.8em 0 0.5em 0.5em;
    }

    .contribution-months {
        grid-auto-columns: 14px;
        gap: 3px;
        margin-bottom: 6px;
        min-height: 16px;
    }

    .month-label {
        font-size: 10px;
        line-height: 16px;
    }

    .contribution-calendar {
        grid-template-rows: repeat(7, 14px);
        grid-auto-columns: 14px;
        gap: 3px;
    }

    .contribution-day {
        width: 14px;
        height: 14px;
    }
    
    .contribution-legend {
        font-size: 0.8em;
        justify-content: flex-end;
        gap: 0.4em;
    }
    
    .legend-colors {
        gap: 3px;
    }
    
    .legend-box {
        width: 14px;
        height: 14px;
    }
    
    .contribution-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8em;
        margin-top: 1.2em;
        padding-top: 1.2em;
    }
    
    .detail-item {
        padding: 0.9em 1em;
    }
    
    .detail-label {
        font-size: 0.8em;
    }
    
    .detail-value {
        font-size: 1.15em;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .statistics-page {
        padding: 1em 0.8em;
    }
    
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6em;
    }
    
    .stat-card {
        padding: 1em 0.8em;
        gap: 0.5em;
    }
    
    .stat-icon {
        font-size: 1.8em;
    }
    
    .stat-icon svg {
        width: 1.1em;
        height: 1.1em;
    }
    
    .stat-value {
        font-size: 1.4em;
    }
    
    .stat-label {
        font-size: 0.75em;
    }
    
    .contribution-section {
        padding: 1.2em;
    }
    
    .page-title {
        font-size: 1.6em;
    }
    
    .section-header h2 {
        font-size: 1.2em;
    }

    .graph-wrapper {
        padding-left: 0.5em;
    }

    .contribution-months {
        grid-auto-columns: 12px;
        gap: 2px;
        margin-bottom: 5px;
        min-height: 14px;
    }

    .month-label {
        font-size: 9px;
        line-height: 14px;
    }

    .contribution-calendar {
        grid-template-rows: repeat(7, 12px);
        grid-auto-columns: 12px;
        gap: 2px;
    }

    .contribution-day {
        width: 12px;
        height: 12px;
    }
    
    .legend-colors {
        gap: 2px;
    }
    
    .legend-box {
        width: 12px;
        height: 12px;
    }
    
    .contribution-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6em;
        margin-top: 1em;
        padding-top: 1em;
    }
    
    .detail-item {
        padding: 0.8em 0.9em;
    }
    
    .detail-label {
        font-size: 0.75em;
    }
    
    .detail-value {
        font-size: 1.05em;
    }
    
    .archive-timeline {
        padding: 1.2em;
    }
    
    .timeline-year {
        padding-left: 1.5em;
    }
    
    .year-header {
        padding: 0.6em 0.8em;
        flex-wrap: wrap;
    }
    
    .year-title {
        gap: 0.6em;
        flex-wrap: wrap;
    }
    
    .year-title h3 {
        font-size: 1.1em;
    }
    
    .year-count {
        font-size: 0.8em;
    }
    
    .post-item {
        flex-wrap: wrap;
        gap: 0.5em;
    }
    
    .post-date {
        min-width: 40px;
    }
    
    .post-title {
        flex-basis: 100%;
        white-space: normal;
        line-height: 1.4;
    }
    
    .tag-cloud-section {
        padding: 1.2em;
    }
    
    .tag-cloud {
        gap: 0.6em;
    }
    
    .tag-item {
        font-size: 0.85em;
        padding: 0.4em 0.8em;
        border-radius: 3px;
    }
    
    .tag-count {
        font-size: 0.8em;
        min-width: 18px;
        height: 18px;
        border-radius: 2px;
    }
}

