/* ================================================
   RANKINGS OVERLAY STYLES
   Most Favorited and Most Commented papers
   ================================================ */

/* ================================================
   RANKINGS OVERLAY
   ================================================ */
#rankings-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

#rankings-overlay.show {
    display: flex;
}

/* ================================================
   RANKINGS CARD (Main Container)
   ================================================ */
.rankings-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 1000px;
    width: 95%;
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ================================================
   RANKINGS HEADER
   ================================================ */
.rankings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-gray);
}

.rankings-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rankings-title::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='2'%3E%3Cpath d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.rankings-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s;
    border-radius: var(--radius-sm);
}

.rankings-close-btn:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* ================================================
   RANKINGS BODY (Two Columns)
   ================================================ */
.rankings-body {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* ================================================
   RANKINGS PANELS (Left: Favorited, Right: Commented)
   ================================================ */
.rankings-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rankings-favorited-panel {
    border-right: 1px solid var(--border-light);
}

.rankings-commented-panel {
    background: var(--bg-gray);
}

.rankings-panel-header {
    padding: 16px 20px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rankings-commented-panel .rankings-panel-header {
    background: var(--bg-gray);
}

.rankings-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rankings-panel-title .count-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* ================================================
   RANKINGS LIST
   ================================================ */
.rankings-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rankings-list::-webkit-scrollbar {
    width: 8px;
}

.rankings-list::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 4px;
}

.rankings-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.rankings-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ================================================
   RANKING PAPER CARD (reusing mf-compact styles)
   ================================================ */
.rankings-paper-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: all 0.15s;
}

.rankings-paper-card:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.rankings-paper-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.rankings-paper-rank {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.rankings-paper-rank.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
}

.rankings-paper-rank.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    color: #333;
}

.rankings-paper-rank.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #e6a75f 100%);
    color: white;
}

.rankings-paper-rank.default {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.rankings-paper-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.rankings-paper-badges .badge {
    font-size: 10px;
    padding: 2px 8px;
}

.rankings-paper-count {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rankings-paper-count::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
}

.rankings-favorited-panel .rankings-paper-count::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237C3AED'%3E%3Cpath d='M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.rankings-commented-panel .rankings-paper-count::before {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
}

.rankings-paper-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.rankings-paper-title a {
    color: inherit;
    text-decoration: none;
}

.rankings-paper-title a:hover {
    color: var(--primary);
}

.rankings-paper-author {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.rankings-paper-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.rankings-paper-fav {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    transition: all 0.15s;
}

.rankings-paper-fav:hover,
.rankings-paper-fav.favorited {
    color: var(--primary);
}

.rankings-paper-links {
    display: flex;
    gap: 8px;
}

.rankings-paper-link {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    background: var(--bg-gray);
}

.rankings-paper-link:hover {
    background: var(--primary);
    color: white;
}

.rankings-paper-link.comment-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* ================================================
   LOADING STATE
   ================================================ */
.rankings-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.rankings-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.rankings-loading p {
    font-size: 13px;
    color: var(--text-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================================
   EMPTY STATE
   ================================================ */
.rankings-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.rankings-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.rankings-empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.rankings-empty-state p {
    font-size: 13px;
}

/* ================================================
   RANKINGS BUTTON (In Nav Bar)
   Visibility controlled by .show class (unified styling in styles.css)
   ================================================ */
.nav-btn.rankings-btn {
    display: none;
}

.nav-btn.rankings-btn.show {
    display: flex;
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */
@media (max-width: 768px) {
    .rankings-body {
        flex-direction: column;
    }

    .rankings-favorited-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        max-height: 50%;
    }

    .rankings-commented-panel {
        flex: 1;
    }
}

@media (max-width: 600px) {
    #rankings-overlay {
        padding: 20px 10px;
    }

    .rankings-card {
        height: calc(100vh - 40px);
    }

    .rankings-header {
        padding: 16px;
    }

    .rankings-title {
        font-size: 18px;
    }

    .rankings-panel-header {
        padding: 12px 16px;
    }

    .rankings-list {
        padding: 12px 16px;
    }
}

/* Very small screens (phones) */
@media (max-width: 480px) {
    #rankings-overlay {
        padding: 10px 5px;
    }

    .rankings-card {
        width: 100%;
        height: calc(100vh - 20px);
        border-radius: var(--radius-md);
    }

    .rankings-header {
        padding: 12px;
    }

    .rankings-title {
        font-size: 16px;
        gap: 8px;
    }

    .rankings-title::before {
        width: 20px;
        height: 20px;
    }

    .rankings-close-btn {
        font-size: 24px;
        padding: 2px 6px;
    }

    .rankings-panel-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .rankings-panel-title {
        font-size: 12px;
    }

    .rankings-panel-title .count-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .refresh-btn-small {
        width: 24px;
        height: 24px;
    }

    .refresh-btn-small svg {
        width: 10px;
        height: 10px;
    }

    .rankings-list {
        padding: 10px 12px;
        gap: 8px;
    }

    .rankings-paper-card {
        padding: 10px 12px;
    }

    .rankings-paper-header {
        gap: 6px;
        flex-wrap: wrap;
    }

    .rankings-paper-rank {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    .rankings-paper-badges .badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .rankings-paper-count {
        font-size: 11px;
    }

    .rankings-paper-count::before {
        width: 12px;
        height: 12px;
    }

    .rankings-paper-title {
        font-size: 12px;
    }

    .rankings-paper-author {
        font-size: 10px;
    }

    .rankings-paper-footer {
        padding-top: 6px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .rankings-paper-fav {
        font-size: 1em;
        padding: 2px;
    }

    .rankings-paper-links {
        gap: 6px;
    }

    .rankings-paper-link {
        font-size: 10px;
        padding: 3px 6px;
    }

    .rankings-loading {
        padding: 40px 16px;
    }

    .rankings-loading .loading-spinner {
        width: 28px;
        height: 28px;
    }

    .rankings-loading p {
        font-size: 12px;
    }

    .rankings-empty-state {
        padding: 30px 16px;
    }

    .rankings-empty-state .empty-icon {
        font-size: 40px;
    }

    .rankings-empty-state h3 {
        font-size: 14px;
    }

    .rankings-empty-state p {
        font-size: 12px;
    }

    .nav-btn.rankings-btn {
        min-width: 80px;
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
        gap: 4px;
    }

    .nav-btn.rankings-btn svg {
        width: 14px;
        height: 14px;
    }
}
