/* ========== 信源榜单页（geo-rankings）——Tab 布局 ========== */

.rank-page {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    padding-top: 12px;
    padding-bottom: 60px;
    box-sizing: border-box;
}

/* ===== 顶部：Tab + 更新时间 ===== */
.rank-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.rank-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 6px;
}

.rank-tab {
    appearance: none;
    border: none;
    background: transparent;
    font-size: 15px;
    color: #444;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank-tab:hover {
    background: #f0f4ec;
    color: #333;
}

.rank-tab.active {
    background: #2f6bff;
    color: #ffffff;
    font-weight: 600;
}

.rank-tab-logo {
    width: 20px;
    height: 20px;
    display: inline-block;
    flex-shrink: 0;
    user-select: none;
}

.rank-updated {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

.rank-updated-icon {
    margin-right: 4px;
}

.rank-stale {
    color: #c0392b;
    font-weight: 600;
}

/* ===== 面板显隐 ===== */
.rank-panel {
    display: none;
}

.rank-panel.active {
    display: block;
}

/* ===== 指标卡 ===== */
.rank-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.rank-metric {
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon img {
    width: 22px;
    height: 22px;
    display: block;
    user-select: none;
}

.rank-metric .metric-label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}

.rank-metric .metric-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
}

/* ===== 双栏：左表格 + 右结构图 ===== */
.rank-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}

.rank-card {
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 20px;
}

.rank-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    margin: 0 0 6px;
}

.rank-card-sub {
    font-size: 12px;
    color: #999;
    margin: 0 0 14px;
}

/* ===== 表格 ===== */
.rank-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 680px;
}

.rank-table th,
.rank-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
    color: #333;
}

.rank-table thead th {
    background: #f7f8f7;
    color: #666;
    font-weight: 600;
    font-size: 13px;
}

.rank-table tbody tr:hover {
    background: #f6f9f2;
}

.rank-table td.rank-source-name {
    font-weight: 600;
}

.rank-table td.rank-share {
    font-weight: 700;
    color: #2f6bff;
}

/* ===== 引用来源结构：横向条形图 ===== */
.rank-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rank-bar-row {
    display: grid;
    grid-template-columns: 18px 96px 1fr 48px;
    align-items: center;
    gap: 8px;
}

.bar-rank {
    font-size: 12px;
    color: #bbb;
    text-align: right;
}

.bar-name {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    height: 8px;
    background: #f0f1f0;
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.4s ease;
}

.bar-value {
    font-size: 12px;
    color: #555;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== 右栏纵向排布：结构图 + 投放参考 ===== */
.rank-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* ===== 本期观察（投放参考）：浅蓝提示卡 ===== */
.rank-obs-card {
    background: #eaf3ff;
    border-radius: 10px;
    padding: 18px 20px;
}

.rank-obs-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
}

.rank-obs-title .fa-lightbulb {
    color: #2f6bff;
    font-size: 16px;
}

.rank-obs-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rank-obs-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}

.rank-obs-list li span {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.rank-obs-list li .fa-circle-check {
    color: #2f6bff;
    font-size: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}
.rank-obs-list li span {
    font-size: 12px;
}

/* ===== 底部说明 ===== */
.rank-note {
    margin-top: 32px;
    font-size: 13px;
    color: #999;
    border-top: 1px solid #ececec;
    padding-top: 16px;
}

.rank-note p {
    margin: 0;
}

.rank-note a {
    color: #8fb36a;
    text-decoration: none;
    font-weight: 600;
}

.rank-note a:hover {
    text-decoration: underline;
}

.rank-error {
    padding: 48px 0;
    text-align: center;
    color: #999;
    font-size: 15px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    /* minmax(0,1fr) 锁死列最小宽度，防止表格/长文本把 grid 撑爆 */
    .rank-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rank-grid > * {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .rank-page {
        padding-left: 14px;
        padding-right: 14px;
        padding-top: 10px;
    }

    /* 顶栏纵向堆叠：Tab 单行横滑 + 更新时间独立一行 */
    .rank-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .rank-updated {
        align-self: flex-start;
        font-size: 13px;
    }

    /* Tab 不换行，横向滑动，隐藏滚动条 */
    .rank-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .rank-tabs::-webkit-scrollbar {
        display: none;
    }

    .rank-tab {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 14px;
    }

    /* 指标卡两列，最后一个奇数卡占满整行 */
    .rank-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rank-metric:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .rank-metric {
        padding: 12px 14px;
        gap: 10px;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
    }

    .metric-icon img {
        width: 19px;
        height: 19px;
    }

    .rank-metric .metric-value {
        font-size: 19px;
    }

    .rank-metric .metric-label {
        font-size: 12px;
        margin-bottom: 2px;
    }

    /* 卡片与表格紧凑化 */
    .rank-card {
        padding: 14px;
    }

    .rank-card-title {
        font-size: 15px;
    }

    .rank-table {
        min-width: 620px;
        font-size: 13px;
    }

    .rank-table th,
    .rank-table td {
        padding: 8px 10px;
    }

    .rank-obs-card {
        padding: 14px 16px;
    }
}
