/* ===================================
   pirolab - Leaderboard CSS
   (main.css 필수 로드)
   =================================== */

/* Leaderboard Container */
.leaderboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Hero Section */
.lb-hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
}

.lb-hero-content h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.lb-hero-content p {
    color: var(--text-secondary);
    font-size: 15px;
}

.lb-hero-stats {
    display: flex;
    gap: 24px;
}

/* Grid Layout */
.lb-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

/* ===================================
   Podium (상위 3명)
   =================================== */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    padding: 32px 24px 0;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 180px;
}

.podium-item.is-me .podium-name {
    color: var(--accent-green);
}

.podium-medal {
    font-size: 32px;
    line-height: 1;
}

.podium-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.podium-score {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.podium-bar {
    width: 100%;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.podium-item.first .podium-bar {
    background: linear-gradient(180deg, rgba(253, 203, 110, 0.3) 0%, rgba(253, 203, 110, 0.08) 100%);
    border: 1px solid rgba(253, 203, 110, 0.3);
    border-bottom: none;
}

.podium-item.second .podium-bar {
    background: linear-gradient(180deg, rgba(156, 163, 175, 0.25) 0%, rgba(156, 163, 175, 0.06) 100%);
    border: 1px solid rgba(156, 163, 175, 0.25);
    border-bottom: none;
}

.podium-item.third .podium-bar {
    background: linear-gradient(180deg, rgba(225, 112, 85, 0.25) 0%, rgba(225, 112, 85, 0.06) 100%);
    border: 1px solid rgba(225, 112, 85, 0.25);
    border-bottom: none;
}

.podium-rank {
    font-size: 36px;
    font-weight: 800;
    font-family: var(--font-mono);
    opacity: 0.15;
}

/* ===================================
   Ranking Table
   =================================== */
.lb-table-wrapper {
    overflow-x: auto;
    padding: auto;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
}

.lb-table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

.lb-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lb-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.lb-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.lb-table tbody tr:last-child {
    border-bottom: none;
}

.lb-table tbody tr.is-me {
    background: rgba(0, 184, 148, 0.06);
    border-left: 3px solid var(--accent-green);
}

.lb-table tbody tr.is-me:hover {
    background: rgba(0, 184, 148, 0.1);
}

.lb-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
}

/* Rank Number */
.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-mono);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.rank-number.rank-1 {
    font-size: 20px;
    background: rgba(253, 203, 110, 0.15);
}

.rank-number.rank-2 {
    font-size: 20px;
    background: rgba(156, 163, 175, 0.15);
}

.rank-number.rank-3 {
    font-size: 20px;
    background: rgba(225, 112, 85, 0.15);
}

/* User Cell */
.lb-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lb-user-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.me-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(0, 184, 148, 0.2);
    color: var(--accent-green);
    letter-spacing: 0.3px;
}

.lb-user-slot {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Score */
.lb-score {
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--accent-green);
}

/* Progress in table */
.lb-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Time */
.lb-time {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ===================================
   Sidebar: Categories
   =================================== */
.lb-categories {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.cat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.cat-info {
    flex: 1;
    min-width: 0;
}

.cat-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cat-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===================================
   Sidebar: Recent Activity
   =================================== */
.lb-recent {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.recent-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-item:first-child {
    padding-top: 0;
}

.recent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-user {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-lab {
    font-size: 11px;
    color: var(--text-muted);
}

.recent-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* ===================================
   Responsive
   =================================== */
@media (max-width: 1200px) {
    .lb-grid {
        grid-template-columns: 1fr;
    }
    
    .lb-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .lb-hero {
        flex-direction: column;
        text-align: center;
    }
    
    .lb-hero-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .lb-side {
        grid-template-columns: 1fr;
    }
    
    .podium {
        padding: 24px 16px 0;
    }
    
    .podium-item {
        max-width: 140px;
    }
}

@media (max-width: 768px) {
    .leaderboard-container {
        padding: 16px;
    }
    
    .lb-hero {
        padding: 24px;
    }
    
    .podium {
        gap: 10px;
    }
    
    .podium-medal {
        font-size: 24px;
    }
    
    .podium-name {
        font-size: 12px;
    }
    
    .lb-table-wrapper {
        padding: 0 16px 16px;
    }
    
    .lb-table th,
    .lb-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .rank-number {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .podium-item.first .podium-bar { height: 120px !important; }
    .podium-item.second .podium-bar { height: 90px !important; }
    .podium-item.third .podium-bar { height: 70px !important; }
}