/* =====================================================
   PIPS LEADERBOARD ENHANCEMENTS
   Additional styles for Pips-specific leaderboard features
   ===================================================== */

/* Leaderboard Modal Specific Styles */
#leaderboardModal .settings-modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

#leaderboardModal .leaderboard-container {
    padding: 0;
}

/* Leaderboard Button - Uses default styling from index.html */

/* Difficulty Tabs */
.difficulty-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--header-bg, #f8f9fa);
    border-radius: 8px;
    flex-wrap: wrap;
}

.difficulty-tab {
    flex: 1;
    min-width: 80px;
    padding: 0.625rem 1rem;
    border: 2px solid transparent;
    background: white;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.difficulty-tab:hover {
    background: var(--hover-bg, #f5f5f5);
    color: var(--text-color, #1a1a1a);
}

.difficulty-tab.active {
    background: var(--primary-color, #2196f3);
    color: white;
    border-color: var(--primary-dark, #1976d2);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.3);
}

/* Difficulty Column */
.leaderboard-score-header .difficulty-col,
.leaderboard-row .difficulty-col {
    text-align: center;
}

/* Update grid for 3-column layout (no difficulty column) */
.pips-leaderboard .leaderboard-score-header.pips-header,
.pips-leaderboard .leaderboard-row.pips-row {
    grid-template-columns: 60px 1fr 120px;
}

.pips-leaderboard .user-score-details.pips-user-details {
    grid-template-columns: 60px 1fr 120px;
}

/* Difficulty Badges */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.difficulty-easy {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.difficulty-medium {
    background: #fff9e6;
    color: #f57c00;
    border: 1px solid #ffa726;
}

.difficulty-hard {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.difficulty-unknown {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ccc;
}

/* User Difficulty Display */
.user-difficulty {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .difficulty-tabs {
        gap: 0.375rem;
        padding: 0.375rem;
    }

    .difficulty-tab {
        min-width: 60px;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .pips-leaderboard .leaderboard-score-header.pips-header,
    .pips-leaderboard .leaderboard-row.pips-row {
        grid-template-columns: 40px 1fr 80px;
        gap: 0.375rem;
        padding: 0.625rem;
    }

    .pips-leaderboard .user-score-details.pips-user-details {
        grid-template-columns: 40px 1fr 80px;
        gap: 0.375rem;
    }

    .difficulty-badge {
        padding: 0.1875rem 0.5rem;
        font-size: 0.625rem;
    }

    .leaderboard-score-header .difficulty-col {
        font-size: 0.625rem;
    }
}

@media (max-width: 600px) {
    /* Stack difficulty tabs on very small screens */
    .difficulty-tabs {
        flex-direction: row;
        justify-content: space-between;
    }

    .difficulty-tab {
        flex: 1;
        font-size: 0.7rem;
        padding: 0.4rem 0.5rem;
    }

    /* Hide difficulty icon emoji on tiny screens to save space */
    .difficulty-badge {
        font-size: 0.6rem;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .difficulty-tabs {
        background: var(--header-bg, #2a2a2a);
    }

    .difficulty-tab {
        background: var(--row-bg, #252525);
        color: var(--text-secondary, #999);
    }

    .difficulty-tab:hover {
        background: var(--hover-bg, #2a2a2a);
        color: var(--text-color, #e0e0e0);
    }

    .difficulty-easy {
        background: #1a3320;
        color: #81c784;
        border-color: #2e7d32;
    }

    .difficulty-medium {
        background: #332b00;
        color: #ffb74d;
        border-color: #f57c00;
    }

    .difficulty-hard {
        background: #3d1f1f;
        color: #ff8a80;
        border-color: #c62828;
    }

    .difficulty-unknown {
        background: #2a2a2a;
        color: #999;
        border-color: #505050;
    }
}

/* Theme Integration */
[data-theme="dark"] .difficulty-tabs {
    background: var(--header-bg);
}

[data-theme="dark"] .difficulty-tab {
    background: var(--row-bg);
    color: var(--text-secondary);
}

[data-theme="dark"] .difficulty-tab:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

/* =====================================================
   COMPLETION CARD (Anonymous User Sign-In Prompt)
   ===================================================== */

.leaderboard-completion-card {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-card-content {
    background: var(--bg-color, #ffffff);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.completion-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.completion-card-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
}

.completion-card-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary, #666);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.completion-card-close:hover {
    background: var(--hover-bg, #f5f5f5);
    color: var(--text-color, #1a1a1a);
}

.completion-card-body {
    padding: 2rem 1.5rem;
}

.completion-score {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--header-bg, #f8f9fa);
    border-radius: 12px;
}

.completion-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.completion-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color, #2196f3);
}

.completion-message {
    margin-bottom: 1.5rem;
    text-align: center;
}

.completion-message p {
    margin: 0.5rem 0;
    color: var(--text-color, #1a1a1a);
    line-height: 1.5;
}

.completion-signin-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.completion-signin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .completion-card-content {
        background: var(--bg-color, #1a1a1a);
    }

    .completion-score {
        background: var(--header-bg, #2a2a2a);
    }
}

[data-theme="dark"] .completion-card-content {
    background: var(--bg-color);
}

[data-theme="dark"] .completion-score {
    background: var(--header-bg);
}
