/* XP Leaderboard Styles - UI/UX Pro Max (Glassmorphism Dark) */

/* 1. Glassmorphism Container */
.leaderboard-container {
    width: 100%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 30px;
    /* Dark navy transparent base */
    background: rgba(13, 23, 42, 0.7);
    /* Glass blur effect */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

/* Decoration Background Glow */
.leaderboard-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(60, 139, 198, 0.05), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.leaderboard-container>* {
    position: relative;
    z-index: 1;
}

/* 2. Header & Title */
.leaderboard-card-header {
    background: transparent;
    border: none;
    padding: 0 0 30px 0;
    text-align: center;
}

.leaderboard-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    /* Gradient Text */
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.leaderboard-title i {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.3));
}

.leaderboard-subtitle {
    font-size: 1rem;
    color: #94a3b8;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* 2.5 Current User Stats Card */
.current-user-stats {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.current-user-stats-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-rank-badge {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.user-username {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f1f5f9;
}

.user-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-level-badge {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.user-tier-badge {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

.current-user-stats-body {
    display: flex;
    gap: 50px;
    padding-right: 20px;
}

.user-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.user-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-stat-value i {
    color: #f97316;
    font-size: 1.2rem;
}

.user-stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 600;
}


/* 3. Table Structure & Interactive Rows */
.leaderboard-table-wrapper {
    background: transparent;
    border-radius: 16px;
    overflow: visible;
    /* Allow hover scaling to show */
}

.leaderboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    /* Gap between rows */
}

.leaderboard-table thead th {
    background: transparent;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 15px 20px;
    border: none;
}

.leaderboard-row {
    /* Row Card Style */
    background: rgba(30, 41, 59, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.leaderboard-row td {
    border: none;
    padding: 20px;
    vertical-align: middle;
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.leaderboard-row td:first-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.02);
}

.leaderboard-row td:last-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
}

/* Hover Interaction */
.leaderboard-row:hover {
    transform: scale(1.01) translateY(-2px);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 10;
    cursor: pointer;
    border-color: rgba(255, 255, 255, 0.1);
}

/* 4. Column Specific Styles */

/* Rank Column */
.col-rank {
    width: 80px;
    text-align: center;
}

.rank-badge {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Premium Ranks - Metallic Gradients */
.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #b8860b 100%);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    color: #000;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    animation: pulse-gold 2s infinite;
}

.rank-2 {
    background: linear-gradient(135deg, #e0e0e0 0%, #9ca3af 100%);
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.2);
    color: #000;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.2);
    color: #fff;
}

@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    }
}

/* User Column */
.col-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #94a3b8;
    border: 2px solid rgba(255, 255, 255, 0.05);
    font-size: 1.2rem;
}

.username {
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.02em;
}

.leaderboard-row:hover .username {
    color: #38bdf8;
    /* Highlight interactive color */
    transition: color 0.2s ease;
}

/* Level Column */
.col-level {
    text-align: left;
}

.level-badge {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 8px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.level-name {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* XP Column */
.col-xp {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-weight: 700;
    color: #fff;
    font-size: 1.1rem;
    text-align: right;
    padding-right: 40px;
}

/* Streak Column */
.col-streak {
    text-align: center;
    width: 100px;
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.5);
    padding: 6px 12px;
    border-radius: 20px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
}

.streak-active {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.1);
}

/* Pagination - Glass Style */
.leaderboard-pagination {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
}

.pagination-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-btn:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

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

.page-info {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

/* 5. Mobile Responsiveness */
@media (max-width: 768px) {
    .leaderboard-container {
        padding: 15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .leaderboard-title {
        font-size: 1.8rem;
    }

    .leaderboard-table-wrapper {
        overflow-x: auto;
    }

    .leaderboard-table {
        min-width: 600px;
        /* Force scrolling instead of squishing */
    }

    /* Sticky first column for scrolling */
    .leaderboard-row td:first-child,
    .leaderboard-table thead th:first-child {
        position: sticky;
        left: 0;
        background: inherit;
        /* Matches row background */
        z-index: 2;
    }

    .col-xp {
        padding-right: 20px;
        /* Reduce padding on mobile */
        font-size: 1rem;
    }

    .leaderboard-row:hover td:first-child {
        background: #1e293b;
        /* Fallback for sticky opacity issue */
    }

    /* Mobile User Stats Card */
    .current-user-stats {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        padding: 20px;
    }

    .current-user-stats-header {
        flex-direction: column;
        gap: 15px;
    }

    .user-details {
        align-items: center;
        text-align: center;
    }

    .current-user-stats-body {
        width: 100%;
        justify-content: space-around;
        padding-right: 0;
        gap: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
}