.zib-ranking-widget {
    background: var(--bg-color, #ffffff);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #e5e7eb);
}

.ranking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--header-bg-start, #fdfbfb) 0%, var(--header-bg-end, #ebedee) 100%);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.ranking-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-color, #333);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.title-icon {
    font-size: 14px;
}

.ranking-subtitle {
    font-size: 10px;
    color: var(--text-muted, #666);
}

.ranking-list {
    padding: 6px;
}

.ranking-item {
    display: flex;
    align-items: flex-start;
    padding: 6px 5px;
    border-radius: 5px;
    margin-bottom: 5px;
    background: var(--item-bg, #fafbfc);
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

.ranking-item:hover {
    background: var(--item-hover-bg, #f0f2f5);
    transform: translateX(2px);
}

.ranking-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2.5px;
    border-radius: 5px 0 0 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ranking-item.rank-1::before {
    background: linear-gradient(180deg, #ff6b6b 0%, #ee5a5a 100%);
    opacity: 1;
}

.ranking-item.rank-2::before {
    background: linear-gradient(180deg, #ffa94d 0%, #f59f00 100%);
    opacity: 1;
}

.ranking-item.rank-3::before {
    background: linear-gradient(180deg, #ffd43b 0%, #fab005 100%);
    opacity: 1;
}

.ranking-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: var(--number-bg, #e9ecef);
    color: var(--text-muted, #666);
    font-weight: bold;
    font-size: 11px;
    margin-right: 8px;
    flex-shrink: 0;
    z-index: 1;
}

.ranking-item.rank-1 .ranking-number {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
    box-shadow: 0 1.5px 6px rgba(255, 107, 107, 0.35);
}

.ranking-item.rank-2 .ranking-number {
    background: linear-gradient(135deg, #ffa94d 0%, #f59f00 100%);
    color: white;
    box-shadow: 0 1.5px 6px rgba(255, 169, 77, 0.35);
}

.ranking-item.rank-3 .ranking-number {
    background: linear-gradient(135deg, #ffd43b 0%, #fab005 100%);
    color: #333;
    box-shadow: 0 1.5px 6px rgba(255, 212, 59, 0.35);
}

.ranking-link {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    flex: 1;
    min-width: 0;
    z-index: 1;
}

.ranking-thumb {
    width: 60px;
    height: 34px;
    border-radius: 5px;
    object-fit: cover;
    margin-right: 8px;
    flex-shrink: 0;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
    display: block;
    min-width: 60px;
    min-height: 34px;
    background-color: var(--thumb-bg, #f0f0f0);
}

.ranking-thumb.no-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-post-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-color, #2d3748);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.ranking-item:hover .ranking-post-title {
    color: #667eea;
}

.ranking-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    color: var(--text-muted, #718096);
    flex-wrap: wrap;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.stat-label {
    color: var(--text-muted-light, #a0aec0);
    font-weight: 500;
}

.stat-value {
    color: var(--text-color, #4a5568);
    font-weight: 600;
}

.today .stat-value {
    color: #667eea;
}

.stat-divider {
    color: var(--border-color, #cbd5e0);
}

.ranking-trend-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    flex-shrink: 0;
    margin-left: 6px;
    white-space: nowrap;
    align-self: center;
}

.ranking-trend-badge.trend-up {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.ranking-trend-badge.trend-down {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.ranking-trend-badge.trend-equal {
    background: var(--badge-equal-bg, #e2e8f0);
    color: var(--text-color, #4a5568);
}

.ranking-empty {
    text-align: center;
    padding: 30px 12px;
    color: var(--text-muted, #718096);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.empty-text {
    font-size: 11px;
    margin-bottom: 4px;
    color: var(--text-color, #4a5568);
}

.empty-hint {
    font-size: 9px;
    color: var(--text-muted-light, #a0aec0);
}

.widget .zib-ranking-widget {
    margin-bottom: 0;
}

.widget .ranking-header {
    padding: 8px 10px;
}

.widget .ranking-title {
    font-size: 12px;
}

.widget .ranking-list {
    padding: 5px;
}

.widget .ranking-item {
    padding: 5px 4px;
    margin-bottom: 4px;
}

.widget .ranking-thumb {
    width: 52px;
    height: 29px;
    min-width: 52px;
    min-height: 29px;
}

.widget .ranking-post-title {
    font-size: 9.5px;
}

@media (prefers-color-scheme: dark) {
    .zib-ranking-widget {
        --bg-color: #1f2937;
        --border-color: #374151;
        --header-bg-start: #1f2937;
        --header-bg-end: #111827;
        --text-color: #f9fafb;
        --text-muted: #9ca3af;
        --text-muted-light: #6b7280;
        --item-bg: #374151;
        --item-hover-bg: #4b5563;
        --number-bg: #4b5563;
        --thumb-bg: #374151;
        --badge-equal-bg: #4b5563;
    }

    .zib-ranking-widget {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    .ranking-item.rank-3 .ranking-number {
        color: #f9fafb;
    }
}

[data-theme="dark"] .zib-ranking-widget,
body.dark-theme .zib-ranking-widget,
body.theme-dark .zib-ranking-widget {
    --bg-color: #1f2937;
    --border-color: #374151;
    --header-bg-start: #1f2937;
    --header-bg-end: #111827;
    --text-color: #f9fafb;
    --text-muted: #9ca3af;
    --text-muted-light: #6b7280;
    --item-bg: #374151;
    --item-hover-bg: #4b5563;
    --number-bg: #4b5563;
    --thumb-bg: #374151;
    --badge-equal-bg: #4b5563;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .zib-ranking-widget .ranking-item.rank-3 .ranking-number,
body.dark-theme .zib-ranking-widget .ranking-item.rank-3 .ranking-number,
body.theme-dark .zib-ranking-widget .ranking-item.rank-3 .ranking-number {
    color: #f9fafb;
}
