/* =====================================================
   USER STATS STYLES
   Modal popup displaying user statistics across all games
   ===================================================== */

/* Settings Modal (for user stats) */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.settings-modal.active {
    display: flex;
}

.settings-modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

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

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.close-settings {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings:hover {
    color: #111827;
}

.settings-modal-body {
    padding: 24px;
}

/* Main container */
.user-stats-content {
    color: var(--text-color, #1a1a1a);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Section titles */
.stats-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

/* =====================================================
   ENGAGEMENT SECTION
   ===================================================== */

.stats-engagement {
    margin-bottom: 2rem;
}

.stats-engagement-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-color, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    margin-bottom: 0.5rem;
}

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

/* =====================================================
   GAME STATS SECTION
   ===================================================== */

.stats-games {
    margin-bottom: 2rem;
}

.stats-games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.game-stat-card {
    background: var(--bg-color, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.game-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.game-stat-card.not-played {
    opacity: 0.6;
}

.game-stat-card.not-played:hover {
    transform: none;
    box-shadow: none;
}

.game-stat-header {
    background: var(--header-bg, #f8f9fa);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.game-stat-name {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color, #1a1a1a);
}

.game-stat-subtitle {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-stat-body {
    padding: 1rem;
}

.game-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.game-stat-row:last-child {
    margin-bottom: 0;
}

.game-stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    font-weight: 500;
}

.game-stat-value {
    font-size: 0.875rem;
    color: var(--text-color, #1a1a1a);
    font-weight: 600;
}

.stat-count {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary, #999);
}

.puzzle-link {
    color: var(--primary-color, #007bff);
    text-decoration: none;
    transition: all 0.2s ease;
}

.puzzle-link:hover {
    text-decoration: underline;
    color: var(--primary-hover, #0056b3);
}

.not-played-text {
    text-align: center;
    color: var(--text-secondary, #999);
    font-style: italic;
    margin: 0;
    padding: 1rem 0;
}

/* =====================================================
   COMMUNITY STATS SECTION
   ===================================================== */

.stats-community {
    margin-bottom: 2rem;
}

.stats-community-simple {
    display: flex;
    justify-content: center;
    max-width: 300px;
    margin: 0 auto;
}

/* =====================================================
   LOADING STATE
   ===================================================== */

.user-stats-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.stats-skeleton {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-card {
    height: 120px;
    background: linear-gradient(
        90deg,
        var(--skeleton-bg, #f0f0f0) 25%,
        var(--skeleton-shimmer, #e0e0e0) 50%,
        var(--skeleton-bg, #f0f0f0) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.loading-text {
    font-size: 1rem;
    color: var(--text-secondary, #666);
}

/* =====================================================
   EMPTY STATE
   ===================================================== */

.user-stats-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.user-stats-empty h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    margin: 0 0 0.5rem 0;
}

.user-stats-empty p {
    font-size: 1rem;
    color: var(--text-secondary, #666);
    margin: 0 0 1rem 0;
}

.empty-signup-prompt {
    font-weight: 600;
    color: var(--primary-color, #007bff);
}

/* =====================================================
   ERROR STATE
   ===================================================== */

.user-stats-error {
    text-align: center;
    padding: 4rem 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.user-stats-error h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    margin: 0 0 0.5rem 0;
}

.user-stats-error p {
    font-size: 1rem;
    color: var(--text-secondary, #666);
    margin: 0;
}

/* =====================================================
   SIGNUP PROMPT
   ===================================================== */

.stats-signup-prompt {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: white;
}

.signup-prompt-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.signup-prompt-content p {
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    opacity: 0.9;
}

.signup-prompt-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .stats-games-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-skeleton {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .stats-games-grid {
        grid-template-columns: 1fr;
    }

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

    .stats-section-title {
        font-size: 1.125rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .user-stats-empty,
    .user-stats-error {
        padding: 3rem 1rem;
    }

    .empty-icon,
    .error-icon {
        font-size: 3rem;
    }
}

/* Dark mode support (if theme variables are set) */
@media (prefers-color-scheme: dark) {
    .stat-card,
    .game-stat-card {
        background: var(--bg-color, #1a1a1a);
        border-color: var(--border-color, #333);
    }

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