/* ── 数据看板样式 ────────────────────────────────────────────────────── */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f0f4e8;
    color: #333;
    min-height: 100vh;
}

/* ── 顶部导航 ────────────────────────────────────────────────────────── */

.dashboard-header {
    background: linear-gradient(135deg, #4a9e5a 0%, #689551 100%);
    color: white;
    padding: 2vh 4vh;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 1.6vh;
    white-space: nowrap;
    transition: color 0.2s;
}
.back-link:hover {
    color: white;
}

.dashboard-title {
    font-size: 2.4vh;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 1vh;
}

.dashboard-nav {
    display: flex;
    gap: 2vh;
    align-items: center;
}

.dashboard-nav-btn {
    padding: 1vh 2.5vh;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 1.6vh;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.dashboard-nav-btn:hover,
.dashboard-nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.back-link {
    color: white;
    text-decoration: none;
    font-size: 1.6vh;
    padding: 1vh 2vh;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    transition: all 0.2s;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── 主内容区 ────────────────────────────────────────────────────────── */

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3vh;
}

/* ── 筛选栏 ──────────────────────────────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 2vh;
    align-items: center;
    margin-bottom: 3vh;
    padding: 2vh 3vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
}

.filter-label {
    font-size: 1.6vh;
    color: #666;
    font-weight: bold;
}

.filter-select {
    padding: 1vh 2vh;
    border: 2px solid #dde1af;
    border-radius: 8px;
    font-size: 1.6vh;
    font-family: inherit;
    background: white;
    cursor: pointer;
    outline: none;
    min-width: 180px;
}

.filter-select:focus {
    border-color: #689551;
}

/* ── 概览卡片 ────────────────────────────────────────────────────────── */

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2vh;
    margin-bottom: 3vh;
}

.overview-card {
    background: white;
    border-radius: 12px;
    padding: 2.5vh;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
}

.overview-card:hover {
    transform: translateY(-2px);
}

.card-icon {
    font-size: 3.6vh;
    margin-bottom: 1vh;
}

.card-value {
    font-size: 3.2vh;
    font-weight: bold;
    color: #4a9e5a;
    margin-bottom: 0.5vh;
}

.card-label {
    font-size: 1.4vh;
    color: #888;
}

/* ── 图表网格 ────────────────────────────────────────────────────────── */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3vh;
    margin-bottom: 3vh;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 2.5vh;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

.chart-title {
    font-size: 1.8vh;
    font-weight: bold;
    color: #4a5c39;
    margin-bottom: 2vh;
    display: flex;
    align-items: center;
    gap: 0.8vh;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 35vh;
    min-height: 250px;
}

/* ── 排行表格 ────────────────────────────────────────────────────────── */

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    padding: 1.2vh 2vh;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 1.5vh;
}

.ranking-table th {
    background: #f8f9f0;
    color: #4a5c39;
    font-weight: bold;
    position: sticky;
    top: 0;
}

.ranking-table tr:hover td {
    background: #f8f9f0;
}

.ranking-table .rank-num {
    font-weight: bold;
    color: #4a9e5a;
    width: 6vh;
    text-align: center;
}

.ranking-table .rank-1 { color: #e6a817; }
.ranking-table .rank-2 { color: #8c8c8c; }
.ranking-table .rank-3 { color: #cd7f32; }

.progress-bar {
    width: 100%;
    height: 1.6vh;
    background: #eee;
    border-radius: 1vh;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #66b375, #4a9e5a);
    border-radius: 1vh;
    transition: width 0.5s ease;
}

/* ── 标签云 ──────────────────────────────────────────────────────────── */

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2vh;
    padding: 1vh;
}

.tag-item {
    display: inline-block;
    padding: 0.8vh 1.8vh;
    background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
    border: 1px solid #c8e6c9;
    border-radius: 20px;
    font-size: 1.4vh;
    color: #2e7d32;
    transition: all 0.2s;
}

.tag-item:hover {
    background: #c8e6c9;
    transform: scale(1.05);
}

.tag-count {
    font-weight: bold;
    color: #4a9e5a;
    margin-left: 0.5vh;
}

/* ── 滚动完成度进度条 ──────────────────────────────────────────────────── */

.scroll-progress-row {
    display: flex;
    align-items: center;
    gap: 1.5vh;
    padding: 1.2vh 0;
    border-bottom: 1px solid #f0f0f0;
}

.scroll-progress-row:last-child {
    border-bottom: none;
}

.scroll-progress-label {
    flex: 0 0 auto;
    min-width: 10vh;
    font-size: 1.5vh;
    color: #4a5c39;
    font-weight: 500;
    text-align: right;
}

.scroll-progress-track {
    flex: 1;
    height: 2.2vh;
    background: #f0f4e8;
    border-radius: 1.1vh;
    overflow: hidden;
    position: relative;
}

.scroll-progress-bar {
    height: 100%;
    border-radius: 1.1vh;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    min-width: 2%;
}

.scroll-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25));
    border-radius: 1.1vh;
}

.scroll-progress-pct {
    flex: 0 0 auto;
    min-width: 5vh;
    font-size: 1.6vh;
    font-weight: bold;
    text-align: left;
}

/* ── 加载/空状态 ─────────────────────────────────────────────────────── */

.loading-state {
    text-align: center;
    padding: 8vh;
    color: #999;
    font-size: 1.8vh;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8f5e9;
    border-top-color: #4a9e5a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 2vh;
}

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

.empty-state {
    text-align: center;
    padding: 6vh;
    color: #999;
    font-size: 1.6vh;
}

.empty-icon {
    font-size: 5vh;
    margin-bottom: 2vh;
}

/* ── 响应式 ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 1.5vh;
        text-align: center;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

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