/* Clean up conflicting header styles - now handled by style.css */
.profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}



.profile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== LEADERBOARD MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.leaderboard-card {
    width: 90%;
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px var(--shadow-dark);
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 700px;
    overflow: hidden;
    /* Clips corners for children */
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lb-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lb-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.close-lb-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 6px;
}

.close-lb-btn:hover {
    color: var(--text-primary);
}

/* ===== TABS ===== */
.lb-tabs {
    display: flex;
    padding: 4px 16px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

/* Duration Filter Row */
.lb-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.lb-filter-row label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.lb-duration-filter {
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Your Rank Section */
.your-rank-section {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.your-rank-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.your-rank-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 25px;
    text-align: center;
}

.lb-duration-filter:focus {
    outline: none;
    border-color: var(--accent-color);
}


.lb-tab {
    flex: 1;
    padding: 3px;
    min-height: auto;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.lb-tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Countdown Timer in Tabs */
.lb-countdown {
    font-size: 8px;
    font-weight: 500;
    color: var(--accent-color);
    opacity: 0.8;
}

.lb-countdown:empty {
    display: none;
}

.lb-tab:hover:not(.active) {
    background: var(--bg-tertiary);
    opacity: 0.7;
}

/* ===== LB TABLE ===== */
.lb-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lb-table-header {
    display: flex;
    padding: 6px 16px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.lb-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.lb-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    /* Increased vertical padding */
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
    position: relative;
    /* Ensure overflow: visible works well */
}

.lb-row:hover {
    background: var(--bg-tertiary);
}

.lb-row.me {
    background: rgba(96, 165, 250, 0.15);
    /* Highlight color */
    border-left: 4px solid var(--accent-color);
}

/* COLUMNS */
.col-rank {
    width: 30px;
    text-align: center;
    font-weight: 700;
}

.col-name {
    flex: 1;
    padding: 0 10px;
    /* Increased horizontal padding */
    display: flex;
    align-items: center;
    gap: 8px;
    /* Increased gap */
    overflow: visible;
    /* Prevent clipping of avatar frames and text effects */
    white-space: nowrap;
}

.col-wpm {
    width: 50px;
    text-align: center;
    font-weight: 700;
}

.col-acc {
    width: 45px;
    text-align: right;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* MEDALS - Enhanced with shine effects */
.medal-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.medal-icon svg {
    display: block;
}

/* Gold Medal - Trophy Shine Effect */
.gold-medal {
    animation: goldGlow 2s ease-in-out infinite;
    position: relative;
}

/* Narrow shine sweep effect */
.gold-medal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 30%;
    height: 200%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.8),
            transparent);
    transform: skewX(-20deg);
    animation: shineGold 2.5s ease-in-out infinite;
    z-index: 10;
}

@keyframes goldGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.7));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 18px rgba(255, 215, 0, 0.5));
    }
}

@keyframes shineGold {
    0% {
        left: -50%;
    }

    50%,
    100% {
        left: 150%;
    }
}

/* Silver Medal - Shine Effect */
.silver-medal {
    animation: silverGlow 2.5s ease-in-out infinite;
    position: relative;
}

.silver-medal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 30%;
    height: 200%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.7),
            transparent);
    transform: skewX(-20deg);
    animation: shineSilver 3s ease-in-out infinite;
    z-index: 10;
}

@keyframes silverGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 4px rgba(192, 192, 192, 0.6));
    }

    50% {
        filter: drop-shadow(0 0 8px rgba(192, 192, 192, 0.9));
    }
}

@keyframes shineSilver {
    0% {
        left: -50%;
    }

    60%,
    100% {
        left: 150%;
    }
}

/* Bronze Medal - Shine Effect */
.bronze-medal {
    animation: bronzeGlow 2.5s ease-in-out infinite;
    position: relative;
}

.bronze-medal::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 30%;
    height: 200%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.6),
            transparent);
    transform: skewX(-20deg);
    animation: shineBronze 3.5s ease-in-out infinite;
    z-index: 10;
}

@keyframes bronzeGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 4px rgba(205, 127, 50, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 8px rgba(205, 127, 50, 0.8));
    }
}

@keyframes shineBronze {
    0% {
        left: -50%;
    }

    70%,
    100% {
        left: 150%;
    }
}


/* Country flag styling */
.country-flag {
    font-size: 14px;
    margin-right: 4px;
}

/* SVG/PNG flag image styling */
.country-flag-img {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.rank-1 .medal-icon {
    background: transparent;
    box-shadow: none;
}

.rank-2 .medal-icon {
    background: transparent;
    box-shadow: none;
}

.rank-3 .medal-icon {
    background: transparent;
    box-shadow: none;
}


/* AVATAR IN LIST */
.user-avatar-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* STICKY FOOTER ME */
.lb-me {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.lb-loading {
    padding: 30px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}


/* ===== FOOTER ACTION ===== */
.lb-footer-action {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.lb-full-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    background: var(--accent-color);
    color: white;
    /* Always white text on accent background */
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: filter 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lb-full-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}