/**
 * page-ranking.php 专属样式
 * 贴吧风格两栏布局：左侧主榜单 + 右侧签到栏
 */

/* ============= 容器 ============= */
.rk-page {
    background: #f5f6f8;
    padding: 32px 0 60px;
}
.rk-page-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============= 顶部标题 ============= */
.rk-page-header {
    text-align: center;
    margin-bottom: 28px;
}
.rk-page-title {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 10px;
    background: linear-gradient(135deg, #FF6A00 0%, #FF7E5C 50%, #FF6FA5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: 0.5px;
}
.rk-page-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 15px;
}

/* ============= 两栏布局 ============= */
.rk-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: flex-start;
}

/* ============= 左栏：榜单 ============= */
.rk-main-col {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}

/* ---- Tab ---- */
.rk-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px 0;
    border-bottom: 1px solid #eef0f3;
    background: #fff;
}
.rk-tab {
    position: relative;
    padding: 18px 18px;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.18s ease;
}
.rk-tab:hover {
    color: #374151;
}
.rk-tab.is-active {
    color: #FF6A00;
    font-weight: 600;
}
.rk-tab.is-active::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, #FF6A00 0%, #FF6FA5 100%);
}

/* ---- 列表行 ---- */
.rk-list {
    padding: 4px 0 8px;
}
.rk-row {
    display: grid;
    grid-template-columns: 56px 60px 1fr auto auto;
    align-items: center;
    column-gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #f2f3f5;
    transition: background 0.18s ease;
}
.rk-row:last-child {
    border-bottom: none;
}
.rk-row:hover {
    background: #fafbfc;
}

/* 前 3 名底色 */
.rk-row--top1 {
    background: linear-gradient(90deg, #fff7e6 0%, #fffaf0 70%, transparent 100%);
}
.rk-row--top2 {
    background: linear-gradient(90deg, #f1f3f5 0%, #f8f9fa 70%, transparent 100%);
}
.rk-row--top3 {
    background: linear-gradient(90deg, #fdecdc 0%, #fef3e8 70%, transparent 100%);
}
.rk-row--top1:hover { background: linear-gradient(90deg, #fff1d3 0%, #fff7e6 70%, #fafbfc 100%); }
.rk-row--top2:hover { background: linear-gradient(90deg, #e9ecef 0%, #f1f3f5 70%, #fafbfc 100%); }
.rk-row--top3:hover { background: linear-gradient(90deg, #fbe1c7 0%, #fdecdc 70%, #fafbfc 100%); }

/* 当前用户行 */
.rk-self-divider {
    height: 8px;
    background: #f5f6f8;
    border-top: 1px solid #eef0f3;
    border-bottom: 1px solid #eef0f3;
}
.rk-row--self {
    background: #fff8f3;
}
.rk-row--self:hover {
    background: #fff1e6;
}

/* 排名 */
.rk-rank {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #9ca3af;
}
.rk-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.rk-medal--1 { background: linear-gradient(135deg, #FFB86B 0%, #FF8A1A 100%); }
.rk-medal--2 { background: linear-gradient(135deg, #cbd1d8 0%, #98a0ad 100%); }
.rk-medal--3 { background: linear-gradient(135deg, #f7c08a 0%, #d68a4f 100%); }

/* 头像 */
.rk-avatar-link {
    display: block;
    line-height: 0;
}
.rk-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.rk-row--top1 .rk-avatar { box-shadow: 0 0 0 2px #FFB86B, 0 1px 6px rgba(255, 138, 26, 0.3); }
.rk-row--top2 .rk-avatar { box-shadow: 0 0 0 2px #cbd1d8, 0 1px 6px rgba(152, 160, 173, 0.3); }
.rk-row--top3 .rk-avatar { box-shadow: 0 0 0 2px #f7c08a, 0 1px 6px rgba(214, 138, 79, 0.3); }

/* 主信息（用户名 + 等级 + 统计） */
.rk-main {
    min-width: 0;
}
.rk-name-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.rk-name {
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rk-name:hover {
    color: #FF6A00;
}
.rk-level {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 11px;
    background: linear-gradient(135deg, #FF6A00 0%, #FF6FA5 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(255, 106, 0, 0.25);
}
.rk-self-tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 11px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 12px;
    font-weight: 600;
}
.rk-meta {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.4;
}
.rk-dot {
    margin: 0 6px;
    color: #d1d5db;
}

/* 热度值（参考贴吧：仅图标着色，数字用普通深色） */
.rk-heat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 90px;
    justify-content: flex-end;
}
.rk-heat-icon {
    font-size: 17px;
    filter: drop-shadow(0 1px 2px rgba(255, 106, 0, 0.3));
}
.rk-heat-value {
    font-size: 17px;
    font-weight: 700;
    color: #4b5563;
    font-variant-numeric: tabular-nums;
}

/* 关注按钮（参考贴吧：实心填充按钮，圆角胶囊） */
.rk-action {
    position: relative;
    min-width: 76px;
    text-align: right;
    padding-left: 16px;
}
/* 热度与关注按钮之间的细分隔线（贴吧风格） */
.rk-action::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 22px;
    background: #e5e7eb;
}
.rk-follow-btn {
    appearance: none;
    border: none;
    background: linear-gradient(135deg, #FF6A00 0%, #FF6FA5 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(255, 106, 0, 0.22);
}
.rk-follow-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 10px rgba(255, 106, 0, 0.32);
}
.rk-follow-btn:active {
    transform: translateY(1px);
}
.rk-follow-btn .following-text { display: none; }
.rk-follow-btn.following {
    background: #f3f4f6;
    color: #9ca3af;
    box-shadow: none;
}
.rk-follow-btn.following .follow-text { display: none; }
.rk-follow-btn.following .following-text { display: inline; }
.rk-follow-btn.following:hover {
    background: #fee2e2;
    color: #ef4444;
    filter: none;
}
.rk-self-mark,
.rk-not-listed {
    font-size: 13px;
    color: #9ca3af;
}

/* 空状态 */
.rk-empty {
    padding: 60px 24px;
    text-align: center;
    color: #9ca3af;
}

/* ============= 右栏 ============= */
.rk-side-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: sticky;
    top: 88px;
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

/* 立即签到按钮（参考贴吧：大尺寸实心按钮，主题橙色渐变） */
.rk-checkin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 20px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF6A00 0%, #FF7E5C 50%, #FF6FA5 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(255, 106, 0, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.rk-checkin-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 10px 22px rgba(255, 106, 0, 0.36);
    color: #fff;
}
.rk-checkin-btn.is-done {
    background: linear-gradient(135deg, #c7cdd6 0%, #9ca3af 100%);
    box-shadow: 0 4px 10px rgba(156, 163, 175, 0.25);
    cursor: default;
    pointer-events: none;
}
.rk-checkin-btn.is-done:hover {
    transform: none;
    filter: none;
    box-shadow: 0 4px 10px rgba(156, 163, 175, 0.25);
}
.rk-checkin-coin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #FFD66B;
    color: transparent;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

/* 连续签到卡片 */
.rk-streak-card {
    position: relative;
    padding: 20px;
    border-radius: 14px;
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.18), transparent 50%),
        linear-gradient(135deg, #4ea36d 0%, #2f7d4f 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(47, 125, 79, 0.25);
    overflow: hidden;
}
.rk-streak-card::before,
.rk-streak-card::after {
    content: "";
    position: absolute;
    top: -6px;
    width: 10px;
    height: 14px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 0 0 5px 5px;
}
.rk-streak-card::before { left: 24px; }
.rk-streak-card::after  { right: 24px; }
.rk-streak-tagline {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 8px;
}
.rk-streak-headline {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 16px;
}
.rk-streak-num {
    display: inline-block;
    margin: 0 4px;
    font-size: 28px;
    font-weight: 800;
    color: #FFE49A;
}
.rk-streak-prefix,
.rk-streak-suffix {
    opacity: 0.9;
}
.rk-streak-date {
    font-size: 13px;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

/* 签到动态 feed（外层已是白卡，本区块去掉独立背景与阴影，仅做内边距与分隔） */
.rk-feed {
    padding-top: 4px;
}
.rk-feed-title {
    margin: 0 4px 8px;
    padding-top: 12px;
    border-top: 1px solid #f2f3f5;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.3px;
}
.rk-feed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}
.rk-feed-list::-webkit-scrollbar { width: 4px; }
.rk-feed-list::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }
.rk-feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    transition: background 0.18s ease;
    border-radius: 8px;
}
.rk-feed-item:hover {
    background: #fafbfc;
}
.rk-feed-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}
.rk-feed-body {
    flex: 1;
    min-width: 0;
}
.rk-feed-line {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rk-feed-name {
    font-weight: 600;
    color: #1f2937;
    margin-right: 4px;
}
.rk-feed-action {
    color: #9ca3af;
}
.rk-feed-time {
    font-size: 11.5px;
    color: #b0b6bd;
    margin-top: 2px;
}
.rk-feed-points {
    color: #f59e0b;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.rk-feed-empty {
    margin: 0 4px 8px;
    color: #9ca3af;
    font-size: 13px;
}

/* ============= 响应式 ============= */
@media (max-width: 960px) {
    .rk-layout {
        grid-template-columns: 1fr;
    }
    .rk-side-col {
        position: static;
    }
}

@media (max-width: 640px) {
    .rk-page { padding: 16px 0 40px; }
    .rk-page-inner { padding: 0 12px; }
    .rk-page-title { font-size: 24px; }
    .rk-page-subtitle { font-size: 13px; }
    .rk-page-header { margin-bottom: 18px; }

    /* Tab 横向滚动 + 隐藏滚动条 */
    .rk-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px 12px 0;
        flex-wrap: nowrap;
    }
    .rk-tabs::-webkit-scrollbar { display: none; }
    .rk-tab {
        padding: 14px 12px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .rk-tab.is-active::after {
        left: 12px;
        right: 12px;
    }

    /* 行布局：序号 + 头像 + 信息 + 热度 + 关注，共 5 列一行装下 */
    .rk-row {
        display: grid;
        grid-template-columns: 28px 40px 1fr auto auto;
        column-gap: 8px;
        padding: 12px 12px;
    }

    /* 排名/奖牌缩小 */
    .rk-rank { font-size: 15px; }
    .rk-medal {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    /* 头像缩小 */
    .rk-avatar { width: 40px; height: 40px; }

    /* 用户名行不再被等级牌挤换行 */
    .rk-name {
        font-size: 15px;
        max-width: 100%;
    }
    .rk-level {
        height: 18px;
        padding: 0 7px;
        font-size: 11px;
        flex-shrink: 0;
    }
    .rk-name-line {
        gap: 6px;
        margin-bottom: 3px;
        flex-wrap: nowrap;
        overflow: hidden;
    }

    /* 统计行：单行省略，避免换行成两行 */
    .rk-meta {
        font-size: 11.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .rk-meta .rk-dot { margin: 0 4px; }

    /* 热度 + 关注按钮放到右侧一列，纵向排列且紧凑 */
    .rk-heat {
        min-width: auto;
        flex-direction: row;
        align-items: center;
        gap: 3px;
    }
    .rk-heat-icon { font-size: 14px; }
    .rk-heat-value { font-size: 14px; }

    .rk-action {
        min-width: auto;
        padding-left: 8px;
        margin-left: 0;
    }
    .rk-action::before {
        height: 18px;
    }
    .rk-follow-btn {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 14px;
    }
    .rk-self-mark,
    .rk-not-listed {
        font-size: 12px;
    }

    /* 把热度和关注按钮放到同一“右侧”逻辑列里 —— 这里通过把它们都当作 grid 末列处理 */
    .rk-row > .rk-heat {
        justify-content: flex-end;
    }

    /* 顶部三名底色面积更小，避免在窄屏喧宾夺主 */
    .rk-row--top1,
    .rk-row--top2,
    .rk-row--top3 {
        background: linear-gradient(90deg, var(--rk-top-bg, #fff7e6) 0%, transparent 100%);
    }
    .rk-row--top1 { --rk-top-bg: #fff7e6; }
    .rk-row--top2 { --rk-top-bg: #f1f3f5; }
    .rk-row--top3 { --rk-top-bg: #fdecdc; }

    /* 右栏稍微收紧 */
    .rk-side-col { padding: 14px; gap: 12px; }
    .rk-checkin-btn { padding: 14px 16px; font-size: 15px; }
}

@media (max-width: 380px) {
    /* 极窄屏：只显示 posts + followers 两项，省略 replies */
    .rk-meta > span:nth-child(3),
    .rk-meta > span:nth-child(4) {
        display: none;
    }
}


/* ============= Toast 提示 ============= */
.rk-toast {
    position: fixed;
    left: 50%;
    top: 32px;
    transform: translate(-50%, -12px);
    padding: 12px 22px;
    border-radius: 24px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.28s ease;
    z-index: 99999;
    pointer-events: none;
}
.rk-toast--success {
    background: linear-gradient(135deg, #FF6A00 0%, #FF6FA5 100%);
}
.rk-toast--error {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
}
.rk-toast--show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ============= Feed 新条目入场动画 ============= */
@keyframes rk-feed-pop {
    0%   { background: #fff7ed; transform: translateY(-6px); opacity: 0; }
    60%  { background: #fff7ed; transform: translateY(0);   opacity: 1; }
    100% { background: transparent; }
}
.rk-feed-item--new {
    animation: rk-feed-pop 1.6s ease;
}


/* ============= Tab AJAX 切换：列表加载态 ============= */
.rk-list {
    position: relative;
    transition: opacity 0.18s ease;
}
.rk-list--loading {
    opacity: 0.45;
    pointer-events: none;
}
.rk-list--loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 40px;
    width: 28px;
    height: 28px;
    margin-left: -14px;
    border: 3px solid #ffd1b5;
    border-top-color: #FF6A00;
    border-radius: 50%;
    animation: rk-spin 0.7s linear infinite;
}
@keyframes rk-spin {
    to { transform: rotate(360deg); }
}
