/* ================================================================================
   Price Ranking Page Styles
   价格排行页面独有样式
   ================================================================================ */

/* ---------- 页面容器 ---------- */
.ranking-container {
    max-width: var(--layout-wide-max-width, 1600px);
    margin: 0 auto;
    padding: 20px;
}

.price-ranking-control-stack {
    display: block;
}

#ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ---------- 玻璃面板 ---------- */
.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

/* ---------- 渐变文字 ---------- */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---------- 徽章样式 ---------- */
.rise-badge {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.fall-badge {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.alert-badge {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ---------- 时间按钮 ---------- */
.time-btn {
    transition: all 0.3s ease;
}

.time-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ---------- Tab 按钮 ---------- */
.tab-btn {
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: rgba(102, 126, 234, 0.2);
    border-bottom: 2px solid #667eea;
}

.tab-btn-icon {
    margin-right: 0.35rem;
}

.time-btn-label-mobile {
    display: none;
}

.price-filter-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: center;
    gap: 0.75rem;
}

.price-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.price-filter-label {
    font-size: 0.75rem;
    color: #94a3b8;
}

.price-filter-input {
    width: 8rem;
    min-height: 42px;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
}

.price-filter-btn {
    min-height: 42px;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.price-filter-btn-primary {
    background: rgba(255, 215, 106, 0.14);
    border-color: rgba(255, 215, 106, 0.28);
    color: #ffd86a;
}

.price-filter-btn-secondary {
    color: #cbd5e1;
}

.price-filter-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
}

/* ---------- 卡牌行 ---------- */
.card-row {
    transition: all 0.3s ease;
}

.card-row:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

/* ---------- 可折叠区域 ---------- */
.expandable-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.expandable-section.expanded {
    max-height: 500px;
}

/* ---------- 趋势颜色 ---------- */
.trend-up {
    color: var(--price-rise-color);
}

.trend-down {
    color: var(--price-fall-color);
}

.trend-stable {
    color: #94a3b8;
}

/* ---------- 排名样式 ---------- */
.rank-1 {
    color: #ffd700;
}

.rank-2 {
    color: #c0c0c0;
}

.rank-3 {
    color: #cd7f32;
}

/* ---------- 卡图缩略图悬浮提示 ---------- */
.card-thumb-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.card-thumb-tooltip.visible {
    opacity: 1;
}

.card-thumb-tooltip img {
    width: 120px;
    height: 168px;
    object-fit: cover;
    border-radius: 6px;
}

.card-thumb-tooltip .loading {
    width: 120px;
    height: 168px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 12px;
}

.card-name-hover {
    cursor: pointer;
}

/* ---------- 管理员按钮 ---------- */
.admin-exclude-btn {
    margin-left: 8px;
    padding: 4px 8px;
    font-size: 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-exclude-btn:hover {
    background: #b91c1c;
}

/* ---------- 下拉菜单项 ---------- */
.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: #e2e8f0;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #4a5568 !important;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .ranking-container {
        max-width: none;
        padding: 0.75rem var(--mobile-page-gutter) 1rem;
    }

    .price-ranking-control-stack {
        position: sticky;
        top: calc(var(--mobile-topbar-offset, 72px) + 0.35rem);
        z-index: 40;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.9rem;
        padding-bottom: 0.15rem;
    }

    .ranking-type-panel {
        order: 1;
    }

    .ranking-time-panel {
        order: 2;
    }

    .ranking-filter-panel {
        order: 3;
    }

    .ranking-time-panel,
    .ranking-type-panel,
    .ranking-filter-panel {
        margin-bottom: 0 !important;
        padding: 0.55rem !important;
        border-radius: 8px;
        background: rgba(11, 17, 28, 0.92);
        border-color: rgba(255, 215, 106, 0.14);
        backdrop-filter: blur(14px);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    }

    .ranking-consecutive-panel {
        display: none;
    }

    .ranking-list-panel {
        margin-bottom: 0 !important;
        padding: 0 !important;
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .ranking-list-title,
    #ranking-title {
        display: none !important;
    }

    #timeButtons,
    .ranking-type-buttons {
        gap: 0.35rem;
        justify-content: flex-start;
    }

    #timeButtons {
        flex-wrap: wrap;
    }

    .time-btn,
    .tab-btn {
        min-height: 36px;
        min-width: 0;
        padding: 0.45rem 0.68rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.04);
        color: #e2e8f0;
        box-shadow: none;
        font-size: 0.8rem;
        font-weight: 700;
        line-height: 1.1;
    }

    .time-btn.active,
    .tab-btn.active {
        background: rgba(255, 215, 106, 0.14);
        border-color: rgba(255, 215, 106, 0.28);
        color: #ffd86a;
        box-shadow: none;
    }

    .tab-btn.active {
        border-bottom-width: 1px;
    }

    .tab-btn-icon,
    .time-btn-label-desktop {
        display: none;
    }

    .time-btn-label-mobile {
        display: inline;
    }

    .time-btn-legacy {
        display: none;
    }

    .price-filter-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.42rem;
    }

    .price-filter-field {
        gap: 0.2rem;
    }

    .price-filter-label {
        font-size: 0.7rem;
        color: #cbd5e1;
    }

    .price-filter-input,
    .price-filter-btn {
        width: 100%;
        min-height: 38px;
        padding: 0.5rem 0.65rem;
        font-size: 0.82rem;
    }

    .price-filter-note {
        display: none;
    }

    #ranking-list {
        display: flex;
        flex-direction: column;
        gap: 0.32rem;
    }

    .price-ranking-mobile-row {
        display: grid;
        grid-template-columns: 1.9rem 2.55rem minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.45rem;
        padding: 0.48rem 0.58rem;
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.04);
    }

    button.price-ranking-mobile-row {
        width: 100%;
        text-align: left;
    }

    .price-ranking-mobile-rank {
        color: #ffd86a;
        font-size: 0.8rem;
        font-weight: 800;
        text-align: center;
    }

    .price-ranking-mobile-thumb {
        width: 2.55rem;
        aspect-ratio: 5 / 7;
        border-radius: 6px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .price-ranking-mobile-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .price-ranking-mobile-main {
        min-width: 0;
    }

    .price-ranking-mobile-name {
        font-size: 0.85rem;
        font-weight: 700;
        line-height: 1.2;
        color: #f8fafc;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .price-ranking-mobile-meta {
        display: flex;
        align-items: center;
        gap: 0.28rem;
        margin-top: 0.1rem;
        min-width: 0;
        font-size: 0.68rem;
        color: #94a3b8;
    }

    .price-ranking-mobile-rarity {
        padding: 0.05rem 0.3rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #cbd5e1;
        font-size: 0.66rem;
        line-height: 1.1;
        flex-shrink: 0;
    }

    .price-ranking-mobile-price {
        text-align: right;
    }

    .price-ranking-mobile-current {
        color: #f8fafc;
        font-size: 0.86rem;
        font-weight: 800;
        line-height: 1.1;
    }

    .price-ranking-mobile-change {
        margin-top: 0.12rem;
        font-size: 0.78rem;
        font-weight: 800;
        line-height: 1.1;
    }

    .price-ranking-mobile-change.rise {
        color: var(--price-rise-color);
    }

    .price-ranking-mobile-change.fall {
        color: var(--price-fall-color);
    }

    .price-ranking-empty-state {
        padding: 2.75rem 1rem;
        color: #94a3b8;
        font-size: 0.9rem;
        text-align: center;
    }

    .card-thumb-tooltip {
        display: none !important;
    }

    .card-row {
        padding: 12px;
    }
    
    .card-row .w-56,
    .card-row .w-28 {
        width: auto;
        min-width: 80px;
    }
}
