/* ============================================
   ACHIEVEMENT LEADERBOARDS - STYLES
   Real-time rankings with dark theme
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding-bottom: 40px;
}

.leaderboards-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== HEADER ========== */
.leaderboards-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #1e1e3f 0%, #2d2d54 100%);
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.leaderboards-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-3px);
}

.header-content {
    flex: 1;
}

.header-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #ff4444;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ========== QUICK STATS ========== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #1e1e3f 0%, #252545 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.3);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #1a1a2e;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

/* ========== TABS ========== */
.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.lb-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lb-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.lb-tab.active {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #1a1a2e;
    border-color: transparent;
}

/* ========== LEADERBOARD SECTIONS ========== */
.leaderboard-section {
    background: linear-gradient(135deg, #1e1e3f 0%, #252545 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: #ffd700;
}

.section-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 8px;
}

.filter-controls,
.auto-refresh-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-filter,
.category-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-filter:hover,
.category-select:hover {
    background: rgba(255, 255, 255, 0.1);
}

.auto-refresh-indicator {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.auto-refresh-indicator .spinning {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== LEADERBOARD LIST ========== */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.leaderboard-entry {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateX(5px);
}

.leaderboard-entry.highlight {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.1) 100%);
    border-color: rgba(255, 215, 0, 0.4);
}

.leaderboard-entry.highlight::before {
    content: 'YOU';
    position: absolute;
    top: 10px;
    right: 15px;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: #1a1a2e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}

.rank-badge {
    min-width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 20px rgba(192, 192, 192, 0.4);
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e89c5f 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.4);
}

.rank-other {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-name {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.player-badges {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.player-badges i {
    color: #ffd700;
    margin-right: 5px;
}

.player-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.stat-item i {
    color: #ffd700;
}

.stat-item-value {
    font-weight: 600;
    color: white;
}

/* ========== ACTIVITY FEED ========== */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

.activity-feed::-webkit-scrollbar {
    width: 8px;
}

.activity-feed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.activity-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.activity-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.1);
}

.activity-content {
    flex: 1;
}

.activity-player {
    font-weight: 600;
    color: white;
}

.activity-achievement {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3px;
}

.activity-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* ========== RARE ACHIEVEMENTS GRID ========== */
.rare-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.rare-achievement-card {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1) 0%, rgba(75, 0, 130, 0.1) 100%);
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.rare-achievement-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.5);
}

.rare-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.rare-name {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.rare-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
}

.rare-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.rare-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rare-stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.rare-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #ba55d3;
}

/* ========== PERSONAL STATS ========== */
.personal-stats-section {
    background: linear-gradient(135deg, #1e1e3f 0%, #252545 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
}

.personal-stats-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.personal-stats-section h2 i {
    color: #ffd700;
}

.personal-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.personal-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.stat-header i {
    color: #ffd700;
    font-size: 18px;
}

.stat-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700 0%, #ffa500 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.stat-value-large {
    font-size: 32px;
    font-weight: 700;
    color: white;
}

/* ========== LOADING STATE ========== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.loading-state i {
    font-size: 48px;
    animation: spin 2s linear infinite;
    color: #ffd700;
}

.loading-state p {
    margin-top: 20px;
    font-size: 16px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .leaderboards-header {
        padding: 20px;
    }

    .header-content h1 {
        font-size: 24px;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .leaderboard-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }

    .lb-tab {
        white-space: nowrap;
    }

    .leaderboard-entry {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .player-stats {
        width: 100%;
        justify-content: space-between;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .rare-achievements-grid {
        grid-template-columns: 1fr;
    }
}
