/* Highscores Card Styles */

/* Highscores as a game card in the grid */
.highscores-game-card {
    background: linear-gradient(135deg, var(--color-card-bg, #1f1f23) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 2px solid var(--color-accent, #3b82f6);
    position: relative;
    overflow: hidden;
    cursor: default;
}

.highscores-game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.highscores-game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px -4px rgba(59, 130, 246, 0.4);
}

.highscores-compact-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.highscore-compact-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--color-bg-secondary, #18181b);
    border-radius: 6px;
    border-left: 3px solid var(--color-accent, #3b82f6);
}

.rank-badge {
    font-weight: 700;
    font-size: 0.75rem;
    min-width: 1.75rem;
    text-align: center;
    color: var(--color-accent, #3b82f6);
}

.rank-badge.rank-1 {
    color: #ffd700; /* Gold */
}

.rank-badge.rank-2 {
    color: #c0c0c0; /* Silver */
}

.rank-badge.rank-3 {
    color: #cd7f32; /* Bronze */
}

.score-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.player-name {
    font-weight: 600;
    color: var(--color-text-primary, #f1f3f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.game-name {
    font-size: 0.7rem;
    color: var(--color-text-secondary, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-accent, #3b82f6);
    min-width: 2.5rem;
    text-align: right;
}

.highscore-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border-primary, #26262b);
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary, #9ca3af);
}

/* Original standalone highscores card (for full-width display if needed) */
.highscores-card {
    background: var(--color-card-bg, #1f1f23);
    border: 2px solid var(--color-accent, #3b82f6);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px -4px rgba(59, 130, 246, 0.3);
}

.highscores-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-primary, #26262b);
}

.highscores-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary, #f1f3f5);
}

.highscores-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.highscore-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--color-bg-secondary, #18181b);
    border: 1px solid var(--color-border-secondary, #2d2d31);
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.highscore-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.highscore-rank {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent, #3b82f6);
    min-width: 2.5rem;
    text-align: center;
}

.highscore-entry:nth-child(1) .highscore-rank {
    color: #ffd700; /* Gold */
}

.highscore-entry:nth-child(2) .highscore-rank {
    color: #c0c0c0; /* Silver */
}

.highscore-entry:nth-child(3) .highscore-rank {
    color: #cd7f32; /* Bronze */
}

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

.highscore-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f3f5);
}

.highscore-game {
    font-size: 0.85rem;
    color: var(--color-text-secondary, #9ca3af);
}

.highscore-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent, #3b82f6);
    min-width: 4rem;
    text-align: right;
}

.highscores-empty {
    text-align: center;
    padding: 2rem 1rem;
}

.highscores-empty p {
    color: var(--color-text-secondary, #9ca3af);
    font-size: 1rem;
    margin: 0;
}

/* Highscore modal styles */
.highscore-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

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

.highscore-modal {
    background: var(--color-modal-bg, #1f1f23);
    border: 2px solid var(--color-accent, #3b82f6);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

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

.highscore-modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.highscore-modal-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    color: var(--color-text-primary, #f1f3f5);
}

.highscore-modal-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffd700;
    margin: 0.5rem 0;
}

.highscore-modal-body {
    margin-bottom: 1.5rem;
}

.highscore-modal-body p {
    text-align: center;
    color: var(--color-text-secondary, #9ca3af);
    margin: 0 0 1rem 0;
}

.highscore-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.highscore-input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f3f5);
}

.highscore-input-group input {
    padding: 0.75rem;
    font-size: 1rem;
    background: var(--color-bg-secondary, #18181b);
    border: 1px solid var(--color-border-primary, #26262b);
    border-radius: 8px;
    color: var(--color-text-primary, #f1f3f5);
    outline: none;
    transition: border-color 0.2s ease;
}

.highscore-input-group input:focus {
    border-color: var(--color-accent, #3b82f6);
}

.highscore-modal-footer {
    display: flex;
    gap: 0.75rem;
}

.highscore-modal-footer button {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.highscore-modal-footer button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.highscore-modal-footer .btn-primary {
    background: var(--color-accent, #3b82f6);
    color: white;
}

.highscore-modal-footer .btn-secondary {
    background: var(--color-bg-tertiary, #2d2d31);
    color: var(--color-text-secondary, #9ca3af);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .highscores-card {
        padding: 1rem;
    }

    .highscore-entry {
        padding: 0.5rem;
    }

    .highscore-rank {
        font-size: 1rem;
        min-width: 2rem;
    }

    .highscore-name {
        font-size: 0.9rem;
    }

    .highscore-game {
        font-size: 0.75rem;
    }

    .highscore-score {
        font-size: 1rem;
        min-width: 3rem;
    }

    .highscore-modal {
        padding: 1.5rem;
    }

    .highscore-modal-score {
        font-size: 2rem;
    }
}

/* Highscores Page Styles */
.highscores-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border-primary, #26262b);
}

.page-header h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--color-text-primary, #f1f3f5);
}

.btn-secondary {
    background: var(--color-bg-secondary, #2d2d31);
    color: var(--color-text-primary, #f1f3f5);
    border: 1px solid var(--color-border-primary, #26262b);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.btn-secondary:hover {
    background: var(--color-bg-tertiary, #3d3d41);
}

.top-scores-section {
    background: linear-gradient(135deg, var(--color-card-bg, #1f1f23) 0%, rgba(59, 130, 246, 0.05) 100%);
    border: 2px solid var(--color-accent, #3b82f6);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
}

.top-scores-section h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--color-text-primary, #f1f3f5);
}

.top-scores-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-score-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg-secondary, #18181b);
    border: 1px solid var(--color-border-secondary, #2d2d31);
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.top-score-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.top-rank {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 3rem;
    text-align: center;
}

.top-rank.rank-1 {
    color: #ffd700;
    font-size: 2rem;
}

.top-rank.rank-2 {
    color: #c0c0c0;
    font-size: 1.75rem;
}

.top-rank.rank-3 {
    color: #cd7f32;
    font-size: 1.5rem;
}

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

.top-player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f3f5);
}

.top-game-name {
    font-size: 0.9rem;
    color: var(--color-text-secondary, #9ca3af);
}

.top-score-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-accent, #3b82f6);
    min-width: 5rem;
    text-align: right;
}

.all-games-section {
    margin-bottom: 3rem;
}

.all-games-section h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    color: var(--color-text-primary, #f1f3f5);
}

.games-highscores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.game-highscore-section {
    background: var(--color-card-bg, #1f1f23);
    border: 1px solid var(--color-card-border, #26262b);
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-highscore-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.game-highscore-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-primary, #26262b);
}

.game-icon-large {
    font-size: 2rem;
}

.game-highscore-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-text-primary, #f1f3f5);
}

.game-scores-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.highscore-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--color-bg-secondary, #18181b);
    border-radius: 6px;
}

.highscore-row .rank-badge {
    font-size: 0.85rem;
    min-width: 2rem;
}

.highscore-row .player-name {
    flex: 1;
    font-weight: 600;
    color: var(--color-text-primary, #f1f3f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.highscore-row .score-value {
    font-weight: 700;
    color: var(--color-accent, #3b82f6);
    min-width: 3rem;
    text-align: right;
}

.no-scores {
    text-align: center;
    color: var(--color-text-secondary, #9ca3af);
    font-size: 0.9rem;
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .top-scores-section {
        padding: 1.25rem;
    }

    .top-rank {
        font-size: 1.25rem;
        min-width: 2.5rem;
    }

    .top-rank.rank-1 {
        font-size: 1.5rem;
    }

    .top-rank.rank-2,
    .top-rank.rank-3 {
        font-size: 1.25rem;
    }

    .top-score-value {
        font-size: 1.25rem;
        min-width: 4rem;
    }

    .games-highscores-grid {
        grid-template-columns: 1fr;
    }
}
