/* ===== HEADER & CONTROLS ===== */
.header-row {
    justify-content: space-between;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-left h1 {
    font-size: 20px;
    margin: 0;
    display: flex !important;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn,
.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 6px;
}

.control-btn:hover,
.logout-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.profile-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.profile-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 700;
    font-size: 14px;
}

.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;
    max-height: 700px;
    /* animation: slideUp 0.3s ease; Removed for reliability */
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lb-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lb-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.close-lb-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0 8px;
}

.close-lb-btn:hover {
    color: var(--text-primary);
}

/* ===== TABS ===== */
.lb-tabs {
    display: flex;
    padding: 12px 20px;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* Duration Filter Row */
.lb-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.lb-filter-row label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.lb-duration-filter {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}

.lb-duration-filter:focus {
    outline: none;
    border-color: var(--accent-color);
}


.lb-tab {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    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;
    gap: 2px;
}

.lb-tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Countdown Timer in Tabs */
.lb-countdown {
    font-size: 9px;
    font-weight: 500;
    color: var(--accent-color);
    opacity: 0.8;
}

.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: 10px 20px;
    font-size: 11px;
    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 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.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: 40px;
    text-align: center;
    font-weight: 700;
}

.col-name {
    flex: 1;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
}

.col-wpm {
    width: 60px;
    text-align: center;
    font-weight: 700;
}

.col-acc {
    width: 50px;
    text-align: right;
    color: var(--text-tertiary);
    font-size: 13px;
}

/* MEDALS - Enhanced with shine effects */
.medal-icon {
    width: 28px;
    height: 28px;
    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: 24px;
    height: 24px;
    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: 40px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}