/* ============================================
   LEADERBOARD PAGE STYLES
   ============================================ */

/* Main Container */
.leaderboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 200px);
}

/* Privacy Disclaimer Banner */
.privacy-disclaimer {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--foreground);
}

.privacy-disclaimer svg {
    flex-shrink: 0;
    color: rgba(59, 130, 246, 0.8);
}

/* Page Header */
.leaderboard-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.leaderboard-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.leaderboard-header .subtitle {
    font-size: 1.1rem;
    color: var(--muted-foreground);
}

/* Personal Rank Card */
.personal-rank-card {
    background: linear-gradient(135deg, var(--card), var(--background));
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.5s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rank-card-content {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.rank-badge-large {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    padding: 1.5rem 2rem;
    min-width: 150px;
}

.rank-label {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.rank-number {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.rank-details {
    flex: 1;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.rank-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

.detail-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
}

.percentile-badge {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted-foreground);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted-foreground);
}

.error-state svg {
    margin-bottom: 1rem;
    color: rgba(239, 68, 68, 0.8);
}

.error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.retry-btn {
    margin-top: 1.5rem;
    padding: 0.75rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Leaderboard Controls */
.leaderboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.total-players {
    font-size: 1rem;
    color: var(--muted-foreground);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--foreground);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.refresh-btn svg {
    transition: transform 0.5s;
}

.refresh-btn:hover svg {
    transform: rotate(180deg);
}

/* Desktop Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.leaderboard-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.leaderboard-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table tbody tr {
    transition: background 0.2s;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-weight: 900;
    font-size: 1.25rem;
}

/* Rank-specific styles */
.rank-1 {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
}

.rank-2 {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
    color: #000;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.5);
}

.rank-3 {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
    color: #fff;
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.5);
}

.rank-other {
    background: var(--card);
    color: var(--foreground);
    border: 2px solid var(--border);
}

/* Current User Highlight */
.current-user-row {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1)) !important;
    border-left: 4px solid var(--primary);
    font-weight: 600;
}

/* Mobile Cards */
.mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.leaderboard-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.leaderboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.leaderboard-card.current-user {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border: 2px solid var(--primary);
}

.card-rank {
    flex-shrink: 0;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-id {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--foreground);
}

.card-score-label {
    font-size: 0.85rem;
    color: var(--muted-foreground);
}

.card-score {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted-foreground);
}

.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--foreground);
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.cta-btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Progress Column */
.progress-col {
    width: 25%;
    font-family: 'Exo 2', sans-serif;
    color: var(--primary);
    font-weight: 600;
}

.desktop-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.desktop-progress-wrapper .progress-bar-bg {
    flex: 1;
    height: 8px;
    /* Ensure height is consistent */
    background: var(--card);
    /* Updated background */
    border-radius: 4px;
    border: 1px solid var(--border);
    overflow: hidden;
    /* Ensure rounded corners for child */
}



/* Mobile Progress Bar */
.card-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.25rem 0 0.5rem;
}

.progress-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #f59e0b);
    /* Yellow/Gold gradient */
    border-radius: 4px;
    transition: width 1s ease-out;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted-foreground);
    min-width: 45px;
    text-align: right;
}

.score-percentage {
    font-size: 0.6em;
    color: var(--accent-gold);
    font-weight: 400;
    margin-left: 0.5rem;
}

/* Responsive Design */
.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .leaderboard-header h1 {
        font-size: 2rem;
    }

    .rank-card-content {
        flex-direction: column;
        text-align: center;
    }

    .rank-details {
        justify-content: center;
    }

    .rank-badge-large {
        width: 100%;
    }

    .leaderboard-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .refresh-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .leaderboard-container {
        padding: 1rem 0.5rem;
    }

    .personal-rank-card {
        padding: 1.5rem 1rem;
    }

    .rank-number {
        font-size: 2.5rem;
    }

    .detail-value {
        font-size: 1.25rem;
    }
}

/* Upload Prompt Banner */
.upload-prompt {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(234, 88, 12, 0.15));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: slideIn 0.5s ease-out;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.prompt-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.prompt-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.prompt-text {
    flex: 1;
    min-width: 250px;
}

.prompt-text h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: -0.01em;
}

.prompt-text p {
    margin: 0;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.prompt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.prompt-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -1px rgba(0, 0, 0, 0.2);
}

@media (max-width: 640px) {
    .prompt-content {
        flex-direction: column;
        text-align: center;
        gap: 1.25rem;
    }

    .prompt-text {
        width: 100%;
    }

    .prompt-btn {
        width: 100%;
    }
}