/* ============================================================
   hotrank.css —— 「热搜榜」独立组件样式（深色卡 + 数据源 Tab 版）
   - 看板卡片：深色渐变圆角卡，顶部 百度/微博/抖音 Tab 胶囊切换
   - 三种形态：full 完整版（Top10 可滚动）/ mini 简版（Top3）/
     bar 横条（Top5 单条轮播），卡片箭头循环切换。
   - 排名为纯色大号数字：前两名白色，其余灰色；右侧灰色热度值。
   ============================================================ */

/* ===== 看板卡片外壳：宽度撑满左侧组件区，高度 = 两排网址图标 ===== */
.widget-card[data-widget="hotrank"] {
    width: 100%;
    max-width: 100%;
    --hr-text: rgba(255, 255, 255, 0.92);
    --hr-muted: rgba(255, 255, 255, 0.42);
    --hr-faint: rgba(255, 255, 255, 0.14);
    background: linear-gradient(150deg, #3a4156 0%, #2e3447 55%, #272d3e 100%);
    border: none;
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(20, 26, 44, 0.32);
    padding: 10px 18px 8px;
    height: var(--widget-h);
    margin-bottom: 0;
    color: var(--hr-text);
    overflow: visible;
}
.widget-card[data-widget="hotrank"]:hover {
    border: none;
    box-shadow: 0 16px 34px rgba(20, 26, 44, 0.4);
}

/* 卡片内不显示标题：标题栏透明覆盖在卡片顶部，仅作拖拽区与移除按钮容器 */
.widget-card[data-widget="hotrank"] .widget-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    margin-bottom: 0;
    z-index: 5;
}
.widget-card[data-widget="hotrank"] .widget-title { visibility: hidden; }
.widget-card[data-widget="hotrank"] .widget-remove {
    background: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.85);
}
.widget-card[data-widget="hotrank"] .widget-remove:hover { background: rgba(255, 95, 109, 0.92); color: #fff; }
.widget-card[data-widget="hotrank"] .widget-body {
    overflow: hidden;
}

/* 卡片下方的组件名称（与网站快捷方式名称同款：白字 + 阴影，适配壁纸背景） */
.hotrank-card-name {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--icon-gap);
    height: var(--icon-name-h);
    line-height: var(--icon-name-h);
    text-align: center;
    font-size: var(--icon-name-size, 12px);
    font-weight: 600;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* 三套布局共存于一个卡片，未选中的用 [hidden] 收起；
   state 同样要显式压过 .hotrank-state 的 display:flex（同特异性下后定义会覆盖 [hidden]） */
.hotrank[hidden],
.hotrank-state[hidden] { display: none; }

/* ===== 卡片上的左右切换箭头（探出卡片两侧外缘，hover 显现） ===== */
.hotrank-card-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 6;
}
.hotrank-card-nav .hotrank-nav-arrow {
    pointer-events: auto;
    cursor: pointer;
    width: 30px;
    height: 30px;
    margin: 0 -22px;
    border-radius: 50%;
    line-height: 28px;
    font-size: 22px;
    text-align: center;
    background: rgba(255, 255, 255, 0.92);
    color: #8a92a6;
    box-shadow: 0 4px 12px rgba(20, 26, 44, 0.28);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out), color 0.15s ease;
}
.widget-card[data-widget="hotrank"]:hover .hotrank-card-nav .hotrank-nav-arrow {
    opacity: 1;
    transform: scale(1);
}
.hotrank-card-nav .hotrank-nav-arrow:hover { color: #5b6480; }

/* ===== 简版（中卡片）：宽 2 格、高两排图标 ===== */
.widget-card[data-widget="hotrank"].hotrank-style-mini {
    width: 153px;
    width: var(--widget-w-2, 153px);
    padding: 12px 12px 10px;
    height: var(--widget-h);
}

/* ===== 横条形态：宽 2 格、高 1 个图标 ===== */
.widget-card[data-widget="hotrank"].hotrank-style-bar {
    width: var(--widget-w-2, 153px);
    min-width: 120px;
    max-width: 100%;
    padding: 0 14px;
    height: 56px;
    height: var(--icon-size, 56px);
    min-height: 56px;
    border-radius: 18px;
}
.widget-card[data-widget="hotrank"].hotrank-style-bar .widget-body {
    display: flex;
    align-items: stretch;
}

/* ===== 通用布局 ===== */
.hotrank {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-height: 0;
    user-select: none;
}

/* ===== 完整版：数据源 Tab ===== */
.hotrank-tabs {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.hotrank-tab {
    position: relative;
    cursor: pointer;
    padding: 2px 2px 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.55);
    transition: color 0.15s ease;
    white-space: nowrap;
}
.hotrank-tab:hover { color: rgba(255, 255, 255, 0.9); }
.hotrank-tab.is-active {
    background: none;
    color: #fff;
    font-weight: 700;
}
.hotrank-tab.is-active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -1px;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
}

/* ===== 条目列表 ===== */
.hotrank-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 隐藏滚动条但保留滚轮/触控板滚动 */
.hotrank-list { scrollbar-width: none; -ms-overflow-style: none; }
.hotrank-list::-webkit-scrollbar { width: 0; height: 0; display: none; }

.hotrank-row {
    display: flex;
    align-items: baseline;
    gap: 9px;
    height: 19px;
    padding: 0 4px;
    border-radius: 7px;
    text-decoration: none;
    color: var(--hr-text);
    transition: background 0.12s ease;
}
.hotrank-row:hover { background: rgba(255, 255, 255, 0.07); }

/* 排名：纯色大号数字，前两名白色，其余灰色 */
.hotrank-rank {
    flex: none;
    min-width: 13px;
    font-size: 13px;
    font-weight: 800;
    line-height: 19px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-style: normal;
}
.hotrank-row.is-top .hotrank-rank { color: #fff; }
.hotrank-word {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 19px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hotrank-row.is-top .hotrank-word { color: #fff; }

/* 热度：右对齐灰色数字 */
.hotrank-hot {
    flex: none;
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    line-height: 19px;
    color: #a2aabd;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ===== 加载 / 失败状态 ===== */
.hotrank-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px 4px;
    padding: 0 8px;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.55);
    text-align: center;
}
.hotrank-retry {
    color: #8ab4ff;
    cursor: pointer;
}
.hotrank-retry:hover { text-decoration: underline; }

/* ===== 简版 ===== */
.hotrank-mini-head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 2px 7px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--hr-text);
    letter-spacing: 0.3px;
}
.hotrank-mini-list { overflow: hidden; }
.hotrank-mini-list .hotrank-row {
    height: 32px;
    gap: 7px;
    padding: 0 2px;
    align-items: center;
}
.hotrank-mini-list .hotrank-rank { min-width: 15px; font-size: 14px; line-height: 1; }
.hotrank-mini-list .hotrank-word {
    font-size: 12px;
    line-height: 1.35;
    font-weight: 500;
}
.hotrank-mini-list .hotrank-hot { display: none; }
.hotrank-mini .hotrank-state { font-size: 11px; }

/* ===== 横条：单条轮播 ===== */
.hotrank-bar {
    flex-direction: row;
    align-items: center;
}
.hotrank-bar-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--hr-text);
}
.hotrank-bar-item .hotrank-rank { min-width: 15px; font-size: 15px; line-height: 1; }
.hotrank-bar-item .hotrank-word {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}
.hotrank-bar-flip { animation: hotrankBarFlip 0.45s var(--ease-out); }
@keyframes hotrankBarFlip {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 小屏适配：卡片随网格收缩，收敛行高避免溢出 ===== */
@media (max-width: 420px) {
    .widget-card[data-widget="hotrank"]:not(.hotrank-style-bar) {
        height: 150px;
        padding: 10px 12px;
    }
    .hotrank-row { height: 18px; }
    .hotrank-mini-list .hotrank-row { height: 28px; }
}
