/* Leaderboard Page Styles */

.leaderboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    color: #e0e0e0;
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.leaderboard-title {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, #4a9eff 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.leaderboard-subtitle {
    font-size: 16px;
    color: #888;
    font-weight: 400;
}

/* Stats Cards */
.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.8) 0%, rgba(35, 35, 50, 0.8) 100%);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 15px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 25px rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.4);
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #4a9eff;
}

/* Leaderboard Table */
.leaderboard-table-container {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.8) 0%, rgba(35, 35, 50, 0.8) 100%);
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.table-header {
    display: grid;
    grid-template-columns: 80px 1fr 150px 150px 150px 120px;
    gap: 15px;
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15) 0%, rgba(102, 126, 234, 0.15) 100%);
    border-bottom: 2px solid rgba(74, 158, 255, 0.3);
    font-weight: 700;
    font-size: 14px;
    color: #4a9eff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-list {
    max-height: 600px;
    overflow-y: auto;
}

/* Leaderboard Entry */
.leaderboard-entry,
.leaderboard-row {
    display: grid !important;
    grid-template-columns: 80px 1fr 150px 150px 150px 120px !important;
    gap: 15px !important;
    padding: 20px 25px !important;
    border-bottom: 1px solid rgba(61, 61, 61, 0.5) !important;
    transition: all 0.3s ease !important;
    align-items: center !important;
}

.leaderboard-entry:hover {
    background: rgba(74, 158, 255, 0.08);
}

.leaderboard-entry.current-user {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15) 0%, rgba(102, 126, 234, 0.15) 100%);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-left: 4px solid #4a9eff;
}

.leaderboard-entry.current-user:hover {
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.2) 0%, rgba(102, 126, 234, 0.2) 100%);
}

/* Rank Column */
.rank-badge {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 20px !important;
}

.rank-badge.top-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4) !important;
}

.rank-badge.top-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4) !important;
}

.rank-badge.top-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e89a5d 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4) !important;
}

.rank-badge.regular {
    background: rgba(45, 45, 45, 0.8) !important;
    color: #888 !important;
    border: 1px solid rgba(61, 61, 61, 0.5) !important;
}

/* Backward compatibility for old class names */
.rank-badge.rank-gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4) !important;
}

.rank-badge.rank-silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(192, 192, 192, 0.4) !important;
}

.rank-badge.rank-bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #e89a5d 100%) !important;
    color: #1a1a1a !important;
    box-shadow: 0 4px 15px rgba(205, 127, 50, 0.4) !important;
}

/* Username Column */
.username-col {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.user-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #4a9eff 0%, #667eea 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: white !important;
}

.username-text {
    font-weight: 600 !important;
    font-size: 15px !important;
    color: #e0e0e0 !important;
}

.current-user .username-text {
    color: #4a9eff;
}

/* Data Columns */
.col-rank,
.col-username,
.col-problems,
.col-submissions,
.col-acceptance,
.col-points {
    display: flex !important;
    align-items: center !important;
}

.problems-count,
.submissions-count,
.acceptance-rate,
.points-count,
.problems-text,
.submissions-text,
.acceptance-text,
.points-text {
    font-weight: 600 !important;
    font-size: 15px !important;
    color: #e0e0e0 !important;
}

.points-count,
.points-text {
    color: #4a9eff !important;
    font-weight: 700 !important;
    font-size: 16px !important;
}

.acceptance-rate,
.acceptance-text {
    color: #2ed573 !important;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: #888;
    font-size: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(74, 158, 255, 0.2);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-text {
    font-size: 20px;
    font-weight: 700;
    color: #e0e0e0;
    margin-bottom: 10px;
}

.empty-subtext {
    font-size: 14px;
    color: #888;
}

/* Scrollbar Styling */
.leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(45, 45, 45, 0.5);
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(74, 158, 255, 0.3);
    border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 158, 255, 0.5);
}

/* Responsive Design */

/* Tablets and Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
    .leaderboard-container {
        padding: 30px 15px;
    }

    .leaderboard-title {
        font-size: 36px;
    }

    .leaderboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 20px;
    }

    .leaderboard-entry {
        padding: 16px;
        grid-template-columns: 60px 1fr repeat(4, auto);
        gap: 12px;
    }
}

/* Tablets and Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .leaderboard-container {
        padding: 20px 15px;
    }

    .leaderboard-title {
        font-size: 32px;
    }

    .leaderboard-subtitle {
        font-size: 14px;
    }

    .leaderboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-icon {
        font-size: 35px;
    }

    .stat-number {
        font-size: 26px;
    }

    .stat-label {
        font-size: 13px;
    }

    .table-header {
        display: none;
    }

    .leaderboard-entry {
        grid-template-columns: 1fr;
        grid-template-areas:
            "rank"
            "username"
            "stats";
        gap: 15px;
        padding: 20px;
    }

    .rank-badge {
        grid-area: rank;
        justify-self: start;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .username-col {
        grid-area: username;
    }

    .col-problems,
    .col-submissions,
    .col-acceptance,
    .col-points {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid #2d2d2d;
    }

    .col-problems::before {
        content: "Problems Solved:";
        color: #888;
        font-size: 13px;
    }

    .col-submissions::before {
        content: "Total Submissions:";
        color: #888;
        font-size: 13px;
    }

    .col-acceptance::before {
        content: "Acceptance Rate:";
        color: #888;
        font-size: 13px;
    }

    .col-points::before {
        content: "Points:";
        color: #888;
        font-size: 13px;
    }

    .filter-bar {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        width: 100%;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .leaderboard-container {
        padding: 15px 10px;
    }

    .leaderboard-header {
        margin-bottom: 25px;
    }

    .leaderboard-title {
        font-size: 24px;
    }

    .leaderboard-subtitle {
        font-size: 13px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-icon {
        font-size: 30px;
    }

    .stat-number {
        font-size: 22px;
    }

    .stat-label {
        font-size: 12px;
    }

    .leaderboard-entry {
        padding: 15px;
        gap: 12px;
    }

    .rank-badge {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .username-text {
        font-size: 14px;
    }

    .col-problems::before,
    .col-submissions::before,
    .col-acceptance::before,
    .col-points::before {
        font-size: 12px;
    }

    .col-problems,
    .col-submissions,
    .col-acceptance,
    .col-points {
        font-size: 13px;
        padding: 6px 0;
    }

    .empty-state {
        padding: 40px 15px;
    }

    .empty-icon {
        font-size: 50px;
    }

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

    .empty-subtitle {
        font-size: 13px;
    }
}

/* Extra Small Devices (max-width: 360px) */
@media (max-width: 360px) {
    .leaderboard-title {
        font-size: 20px;
    }

    .leaderboard-subtitle {
        font-size: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        font-size: 25px;
    }

    .stat-number {
        font-size: 18px;
    }

    .stat-label {
        font-size: 11px;
    }

    .leaderboard-entry {
        padding: 12px;
    }

    .rank-badge {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .username-text {
        font-size: 13px;
    }

    .col-problems::before,
    .col-submissions::before,
    .col-acceptance::before,
    .col-points::before {
        font-size: 11px;
    }

    .col-problems,
    .col-submissions,
    .col-acceptance,
    .col-points {
        font-size: 12px;
    }
}

/* Highlight animation for "Go to My Rank" feature */
@keyframes highlight-pulse {
    0%, 100% {
        background: linear-gradient(135deg, rgba(74, 158, 255, 0.15) 0%, rgba(102, 126, 234, 0.15) 100%);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        border-left: 4px solid #4a9eff;
    }
    50% {
        background: linear-gradient(135deg, rgba(74, 158, 255, 0.35) 0%, rgba(102, 126, 234, 0.35) 100%);
        box-shadow: 0 0 40px rgba(74, 158, 255, 0.8);
        border-left: 4px solid #4a9eff;
        transform: scale(1.02);
    }
}

/* Button hover effect */
#go-to-my-rank-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
}

/* Pagination Styles */
#pagination-container {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 16px;
    background: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: #3d3d3d;
    border-color: #4a9eff;
    color: #4a9eff;
    transform: translateY(-2px);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #4a9eff 0%, #667eea 100%);
    border-color: #4a9eff;
    color: #fff;
    font-weight: 600;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-dots {
    color: #888;
    padding: 0 8px;
    font-size: 16px;
}

@media (max-width: 768px) {
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        padding: 6px 12px;
        font-size: 13px;
    }
}

