/* css/profile.css */
.profile-page {
    min-height: 100vh;
    background: var(--bg-primary);
}

.profile-banner {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 32px 28px 50px;
}

.profile-container {
    max-width: 850px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: -30px;
}

.profile-avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    border: 3px solid #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-info {
    flex: 1;
}

.display-name {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.username {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.joined-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.edit-profile-btn {
    padding: 8px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    transition: var(--transition);
}

.edit-profile-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

/* Stats section, lower and no hover */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 28px;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 28px;
}

.profile-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 18px;
    text-align: center;
    transition: none;
    box-shadow: var(--shadow-sm);
}

.profile-stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
}

.profile-stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-top: 4px;
}

.level-section {
    margin-top: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.level-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.level-number {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9rem;
}

.xp-progress {
    background: var(--border);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.xp-progress-fill {
    height: 100%;
    background: var(--accent-yellow);
    border-radius: 10px;
    transition: width 0.5s ease;
}

.games-history {
    margin-top: 28px;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 28px;
}

.games-history h2 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.history-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}

.history-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: #e0e0ea;
    overflow: hidden;
    flex-shrink: 0;
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-muted);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-game-name {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-game-detail {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.history-playtime {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.cancel-btn {
    padding: 12px 20px;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.cancel-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .profile-stats {
        grid-template-columns: 1fr 1fr;
    }
}