/* Statistics Module CSS */

.stats-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    width: 90vw;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1000;
}

.stats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
    background: var(--bg-primary);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stats-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.stats-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.stats-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.stats-content {
    padding: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stats-card {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-card h4 {
    margin: 0 0 1rem 0;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.stats-label {
    color: var(--text-secondary);
}

.stats-value {
    color: var(--text-primary);
    font-weight: 500;
}

.top-list {
    max-height: 300px;
    overflow-y: auto;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.top-item:last-child {
    border-bottom: none;
}

.rank {
    color: var(--text-muted);
    font-weight: bold;
    min-width: 20px;
}

.player-name {
    flex: 1;
    color: var(--text-primary);
}

.player-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.time-chart {
    max-height: 300px;
    overflow-y: auto;
}

.time-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.time-label {
    color: var(--text-secondary);
    min-width: 40px;
    font-size: 0.9rem;
}

.time-bar-container {
    flex: 1;
    background: var(--bg-primary);
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.time-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.time-count {
    color: var(--text-primary);
    min-width: 30px;
    text-align: right;
    font-size: 0.9rem;
}

.word-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.word-item {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: default;
    transition: var(--transition);
    border: 1px solid transparent;
}

.word-item:hover {
    background: var(--accent-primary);
    color: white;
    transform: scale(1.05);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .stats-container {
        width: 95vw;
        max-height: 95vh;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-header {
        padding: 1rem;
    }
    
    .stats-content {
        padding: 1rem;
    }
}

/* Scrollbar styling for stats */
.stats-container::-webkit-scrollbar,
.top-list::-webkit-scrollbar,
.time-chart::-webkit-scrollbar,
.word-cloud::-webkit-scrollbar {
    width: 6px;
}

.stats-container::-webkit-scrollbar-track,
.top-list::-webkit-scrollbar-track,
.time-chart::-webkit-scrollbar-track,
.word-cloud::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.stats-container::-webkit-scrollbar-thumb,
.top-list::-webkit-scrollbar-thumb,
.time-chart::-webkit-scrollbar-thumb,
.word-cloud::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.stats-container::-webkit-scrollbar-thumb:hover,
.top-list::-webkit-scrollbar-thumb:hover,
.time-chart::-webkit-scrollbar-thumb:hover,
.word-cloud::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
