/* =========================================================
 * NiaoZun Shop —— 全球订单榜样式
 * 主色：logo 红 #ff4d4f
 * 原生 CSS（不使用嵌套语法，直接浏览器加载生效）
 * 支持深浅色自适应：body[data-theme=dark] / .theme-dark / .dark-mode / prefers-color-scheme
 * ======================================================= */

.hipin-map .stats {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 18px 18px 10px 18px;
    font-size: 12px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.06),
        0 6px 16px rgba(16, 24, 40, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 500px;
    max-height: 500px;
    overflow-y: auto;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 77, 79, 0.45) rgba(0, 0, 0, 0.05);
}
.hipin-map .stats::-webkit-scrollbar {
    width: 6px;
}
.hipin-map .stats::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
}
.hipin-map .stats::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff7875 0%, #ff4d4f 100%);
    border-radius: 999px;
}

/* ------------------- 表格表头 ------------------- */
.hipin-map .country-stats-title {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 12px 8px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid transparent;
    background-image: linear-gradient(90deg,
        rgba(255, 77, 79, 0) 0%,
        rgba(255, 77, 79, 0.75) 30%,
        rgba(255, 77, 79, 0.75) 70%,
        rgba(255, 77, 79, 0) 100%);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 2px;
}
.hipin-map .country-stats-title > span {
    font-weight: 700;
    color: #262626;
    letter-spacing: 0.2px;
}
.hipin-map .country-stats-title .cs-title-rank {
    justify-self: center;
    color: #8c8c8c;
    font-weight: 800;
    font-size: 13px;
}
.hipin-map .country-stats-title .cs-title-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 4px;
    gap: 8px;
}
.hipin-map .country-stats-title .cs-title-main-country { flex: 1; color: #595959; }
.hipin-map .country-stats-title .cs-title-main-value   { text-align: right; color: #ff4d4f; }
.hipin-map .country-stats-title .cs-title-change {
    color: #8c8c8c;
    padding: 0 4px;
    text-align: right;
}

/* ------------------- 每行排名卡片 ------------------- */
.hipin-map .country-stats {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 10px 8px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    background: transparent;
    transition: all 0.25s ease;
    cursor: default;
    position: relative;
}
.hipin-map .country-stats:nth-child(even) {
    background: rgba(255, 77, 79, 0.035);
}
.hipin-map .country-stats:hover {
    background: rgba(255, 77, 79, 0.06);
    border-left-color: #ff4d4f;
    border-color: rgba(255, 77, 79, 0.25);
    transform: translateX(2px);
    box-shadow:
        0 2px 4px rgba(16, 24, 40, 0.06),
        0 10px 20px rgba(255, 77, 79, 0.12);
}

/* --- 前 3 名金银铜行专属浅底色 --- */
.hipin-map .country-stats.rank-gold   { background: linear-gradient(90deg, rgba(255, 210, 103, 0.16) 0%, transparent 70%); }
.hipin-map .country-stats.rank-silver { background: linear-gradient(90deg, rgba(180, 190, 203, 0.18) 0%, transparent 70%); }
.hipin-map .country-stats.rank-bronze { background: linear-gradient(90deg, rgba(234, 142, 104, 0.18) 0%, transparent 70%); }
.hipin-map .country-stats.rank-gold:hover   { background: linear-gradient(90deg, rgba(255, 210, 103, 0.28) 0%, rgba(255, 77, 79, 0.06) 100%); }
.hipin-map .country-stats.rank-silver:hover { background: linear-gradient(90deg, rgba(180, 190, 203, 0.30) 0%, rgba(255, 77, 79, 0.06) 100%); }
.hipin-map .country-stats.rank-bronze:hover { background: linear-gradient(90deg, rgba(234, 142, 104, 0.30) 0%, rgba(255, 77, 79, 0.06) 100%); }

/* ------------------- 排名序号徽章 ------------------- */
.hipin-map .country-rank {
    justify-self: center;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-weight: 800;
    font-size: 12px;
    color: #ffffff;
    border-radius: 50%;
    background: #bfbfbf;
    letter-spacing: -0.2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.hipin-map .country-rank.rank-gold {
    background: linear-gradient(145deg, #ffe08a 0%, #ffb020 55%, #e68a00 100%);
    color: #3d2600;
    box-shadow: 0 2px 8px rgba(230, 138, 0, 0.45);
}
.hipin-map .country-rank.rank-silver {
    background: linear-gradient(145deg, #ffffff 0%, #c8ced6 55%, #8b94a0 100%);
    color: #2f3640;
    box-shadow: 0 2px 8px rgba(139, 148, 160, 0.40);
}
.hipin-map .country-rank.rank-bronze {
    background: linear-gradient(145deg, #ffd3b8 0%, #ea8e68 55%, #c06a46 100%);
    color: #3d1a0a;
    box-shadow: 0 2px 8px rgba(192, 106, 70, 0.40);
}

/* ------------------- 国家 + 数字 + 进度条（主列） ------------------- */
.hipin-map .country-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.hipin-map .country-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.hipin-map .country-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    color: #262626;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.hipin-map .active-users {
    font-size: 13px;
    font-weight: 800;
    color: #ff4d4f;
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* 进度条 */
.hipin-map .country-row-2 { width: 100%; display: block; }
.hipin-map .country-bar-track {
    display: block;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    overflow: hidden;
    box-sizing: border-box;
}
.hipin-map .country-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff9b96 0%, #ff4d4f 60%, #d32029 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}

/* ------------------- 涨跌幅胶囊 ------------------- */
.hipin-map .change {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    line-height: 1.5;
}
.hipin-map .change-up {
    color: #d70015;
    background: rgba(255, 77, 79, 0.10);
    border: 1px solid rgba(255, 77, 79, 0.35);
}
.hipin-map .change-down {
    color: #1a7f37;
    background: rgba(26, 127, 55, 0.08);
    border: 1px solid rgba(26, 127, 55, 0.30);
}

/* 防止空字符串显示成奇怪样式（空内容用「-」占位） */
.hipin-map .change:empty::before { content: '-'; color: #8c8c8c; }

/* ====================== 深浅色自适应（Dark Mode） ====================== */
/* —— Case 1：用户切换按钮：<html data-theme="dark"> —— */
html[data-theme="dark"] .hipin-map .stats,
body[data-theme="dark"] .hipin-map .stats,
/* —— Case 2：<body class="theme-dark dark-mode"> —— */
body.theme-dark .hipin-map .stats,
body.dark-mode .hipin-map .stats {
    background: #1f1f23;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 6px 18px rgba(0, 0, 0, 0.45);
    scrollbar-color: rgba(255, 77, 79, 0.55) rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .hipin-map .stats::-webkit-scrollbar-track,
body.theme-dark .hipin-map .stats::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .hipin-map .country-stats-title > span,
body.theme-dark .hipin-map .country-stats-title > span { color: #fafafa; }
html[data-theme="dark"] .hipin-map .country-stats-title .cs-title-rank,
body.theme-dark .hipin-map .country-stats-title .cs-title-rank { color: #bfbfbf; }
html[data-theme="dark"] .hipin-map .country-stats-title .cs-title-main-country,
body.theme-dark .hipin-map .country-stats-title .cs-title-main-country { color: #d9d9d9; }
html[data-theme="dark"] .hipin-map .country-stats-title .cs-title-change,
body.theme-dark .hipin-map .country-stats-title .cs-title-change { color: #bfbfbf; }

html[data-theme="dark"] .hipin-map .country-stats:nth-child(even),
body.theme-dark .hipin-map .country-stats:nth-child(even) {
    background: rgba(255, 77, 79, 0.055);
}
html[data-theme="dark"] .hipin-map .country-stats:hover,
body.theme-dark .hipin-map .country-stats:hover {
    background: rgba(255, 77, 79, 0.10);
    border-color: rgba(255, 77, 79, 0.40);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.35),
        0 10px 22px rgba(255, 77, 79, 0.22);
}

html[data-theme="dark"] .hipin-map .country-stats.rank-gold,
body.theme-dark .hipin-map .country-stats.rank-gold   { background: linear-gradient(90deg, rgba(255, 210, 103, 0.16) 0%, transparent 70%); }
html[data-theme="dark"] .hipin-map .country-stats.rank-silver,
body.theme-dark .hipin-map .country-stats.rank-silver { background: linear-gradient(90deg, rgba(180, 190, 203, 0.16) 0%, transparent 70%); }
html[data-theme="dark"] .hipin-map .country-stats.rank-bronze,
body.theme-dark .hipin-map .country-stats.rank-bronze { background: linear-gradient(90deg, rgba(234, 142, 104, 0.16) 0%, transparent 70%); }

html[data-theme="dark"] .hipin-map .country-name,
body.theme-dark .hipin-map .country-name { color: #f5f5f5; }
html[data-theme="dark"] .hipin-map .active-users,
body.theme-dark .hipin-map .active-users { color: #ff6b69; }

html[data-theme="dark"] .hipin-map .country-bar-track,
body.theme-dark .hipin-map .country-bar-track {
    background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .hipin-map .change-up,
body.theme-dark .hipin-map .change-up {
    color: #ff6b69;
    background: rgba(255, 77, 79, 0.18);
    border-color: rgba(255, 77, 79, 0.45);
}
html[data-theme="dark"] .hipin-map .change-down,
body.theme-dark .hipin-map .change-down {
    color: #3fb950;
    background: rgba(63, 185, 80, 0.15);
    border-color: rgba(63, 185, 80, 0.40);
}

/* —— Case 3：系统级 prefers-color-scheme: dark —— */
@media (prefers-color-scheme: dark) {
    .hipin-map .stats {
        background: #1f1f23;
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 6px 18px rgba(0,0,0,.45);
    }
    .hipin-map .country-stats-title > span { color: #fafafa; }
    .hipin-map .country-stats-title .cs-title-rank,
    .hipin-map .country-stats-title .cs-title-main-country,
    .hipin-map .country-stats-title .cs-title-change { color: #bfbfbf; }
    .hipin-map .country-stats:nth-child(even) { background: rgba(255, 77, 79, 0.055); }
    .hipin-map .country-stats:hover { background: rgba(255, 77, 79, 0.10); }
    .hipin-map .country-name { color: #f5f5f5; }
    .hipin-map .active-users { color: #ff6b69; }
    .hipin-map .country-bar-track { background: rgba(255,255,255,0.08); }
    .hipin-map .change-up   { color: #ff6b69; background: rgba(255,77,79,.18); border-color: rgba(255,77,79,.45); }
    .hipin-map .change-down { color: #3fb950; background: rgba(63,185,80,.15); border-color: rgba(63,185,80,.40); }
}

/* ====================== 移动端：MD 以下单列堆叠 ====================== */
@media (max-width: 991.98px) {
    .hipin-map .stats {
        height: auto;
        max-height: none;
        margin-top: 18px;
    }
}
