/* /assets/css/profile.css */

.profile-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 4rem;
}

/* ═══════════ BANNER ═══════════ */
.profile-banner {
    position: relative;
    height: 180px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, var(--banner), color-mix(in srgb, var(--banner) 50%, #06b6d4));
    overflow: hidden;
}

.profile-banner-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(255,255,255,0.15) 0%, transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(0,0,0,0.2) 0%, transparent 60%);
}

/* ═══════════ HEADER CARD ═══════════ */
.profile-header-card {
    margin-top: -60px;
    position: relative;
    z-index: 2;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-lg);
}

.profile-header-top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    align-items: center;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar-wrapper .user-avatar-xl {
    width: 120px;
    height: 120px;
    font-size: 3rem;
    border: 4px solid var(--bg-primary);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.profile-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.profile-header-info {
    min-width: 0;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.profile-username {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.profile-title-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: #fff;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.5rem 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.profile-socials {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.profile-social {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.profile-social:hover {
    background: rgba(124,58,237,0.15);
    border-color: rgba(124,58,237,0.4);
    color: var(--text-primary);
}

.profile-header-actions {
    display: flex;
    gap: 0.5rem;
    align-self: start;
}

/* ═══════════ STATS GRID ═══════════ */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.profile-stat {
    padding: 1.25rem 1rem;
    text-align: center;
    transition: var(--transition);
}

.profile-stat:hover {
    transform: translateY(-3px);
    border-color: rgba(124,58,237,0.3);
}

.profile-stat-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.profile-stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.profile-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.35rem;
}

/* ═══════════ ACCURACY ═══════════ */
.profile-accuracy {
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
}

.profile-accuracy h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.profile-accuracy-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.acc-row {
    display: grid;
    grid-template-columns: 160px 1fr 100px;
    align-items: center;
    gap: 1rem;
}

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

.acc-bar-wrap {
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 999px;
    overflow: hidden;
}

.acc-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.acc-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
}

.acc-value small {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
}

/* ═══════════ SECTIONS ═══════════ */
.profile-section {
    padding: 1.75rem 2rem;
    margin-top: 1.5rem;
}

.profile-section h2 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.profile-section-header h2 {
    margin: 0;
}

/* ═══════════ ACHIEVEMENTS ═══════════ */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.achievement-card {
    padding: 1rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    text-align: center;
    transition: var(--transition);
    cursor: help;
    position: relative;
    overflow: hidden;
}

.achievement-card:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.06);
}

.achievement-card.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.achievement-card.rarity-common    { border-left: 3px solid #9ca3af; }
.achievement-card.rarity-rare      { border-left: 3px solid #3b82f6; }
.achievement-card.rarity-epic      { border-left: 3px solid #a855f7; }
.achievement-card.rarity-legendary {
    border-left: 3px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.08), transparent);
}

.achievement-icon {
    font-size: 2.25rem;
    margin-bottom: 0.4rem;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

.achievement-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.achievement-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.3;
}

.achievement-date {
    font-size: 0.7rem;
    color: var(--accent-cyan);
    margin-top: 0.35rem;
}

/* ═══════════ FAVORITE MAPS ═══════════ */
.favorite-maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.favorite-map {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.favorite-map::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent);
}

.favorite-map:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 20%, transparent);
}

.favorite-map-icon {
    font-size: 2rem;
}

.favorite-map-title {
    font-weight: 700;
    font-size: 1rem;
}

.favorite-map-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══════════ RECENT GAMES ═══════════ */
.recent-games-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-game-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.recent-game-row:hover {
    background: rgba(255,255,255,0.06);
    transform: translateX(3px);
}

.recent-game-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.recent-game-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.recent-game-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.recent-game-score {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-amber);
}

/* ═══════════ EDIT MODAL ═══════════ */
.profile-edit-modal-content {
    max-width: 640px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
}

.profile-edit-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.edit-section {
    display: flex;
    flex-direction: column;
}

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.edit-subtitle {
    font-size: 1.05rem;
    margin: 1rem 0 0.5rem;
    color: var(--accent-cyan);
}

.edit-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

.edit-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-glass);
}

/* ═══════════ TOGGLES ═══════════ */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.toggle-row:hover {
    background: rgba(255,255,255,0.06);
}

.toggle-row input { display: none; }

.toggle-switch-ui {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-switch-ui::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-row input:checked + .toggle-switch-ui {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
}

.toggle-row input:checked + .toggle-switch-ui::before {
    transform: translateX(20px);
}

.toggle-text {
    flex: 1;
}

.toggle-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.toggle-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ═══════════ АДАПТИВ ═══════════ */
@media (max-width: 900px) {
    .profile-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .profile-header-top {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .profile-avatar-wrapper {
        margin: 0 auto;
    }

    .profile-header-actions {
        justify-content: center;
        width: 100%;
    }

    .profile-name-row,
    .profile-meta,
    .profile-socials {
        justify-content: center;
    }

    .acc-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .acc-value {
        text-align: left;
    }
}

@media (max-width: 600px) {
    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-section,
    .profile-accuracy {
        padding: 1.25rem 1rem;
    }

    .profile-header-card {
        padding: 1.25rem;
    }

    .edit-row {
        grid-template-columns: 1fr;
    }

    .recent-game-row {
        grid-template-columns: auto 1fr;
    }

    .recent-game-score {
        grid-column: 1 / -1;
        text-align: right;
    }
}
/* ═══════════ AVATAR EMOJI ═══════════ */
.user-avatar-emoji {
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--border-glass);
    font-size: 0.65em;
    line-height: 1;
}

.profile-avatar-wrapper .user-avatar-xl {
    font-size: 5rem;
}

/* ═══════════ AVATAR PICKER ═══════════ */
.avatar-picker-trigger {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-picker-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 2px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.avatar-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.av-filter {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-glass);
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.av-filter:hover {
    color: var(--text-primary);
    border-color: rgba(124,58,237,0.4);
}

.av-filter.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border-color: transparent;
    color: #fff;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.avatar-card {
    position: relative;
    padding: 1rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.avatar-card:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.06);
    border-color: rgba(124,58,237,0.5);
}

.avatar-card.equipped {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(6,182,212,0.3);
}

.avatar-card.equipped::after {
    content: '✓';
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 20px;
    height: 20px;
    background: var(--accent-cyan);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.avatar-card.locked {
    opacity: 0.85;
}

.avatar-card.locked:hover {
    border-color: var(--accent-amber);
}

.av-emoji {
    font-size: 2.5rem;
    margin-bottom: 0.4rem;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
}

.av-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.av-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.av-status {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.avatar-card.rarity-common    { border-left: 3px solid #9ca3af; }
.avatar-card.rarity-rare      { border-left: 3px solid #3b82f6; }
.avatar-card.rarity-epic      { border-left: 3px solid #a855f7; }
.avatar-card.rarity-legendary {
    border-left: 3px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.06), transparent);
}

/* ═══════════ ACTIVITY FEED ═══════════ */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-md);
    transition: var(--transition);
    position: relative;
}

.activity-item:hover {
    background: rgba(255,255,255,0.06);
}

.activity-item.private-activity {
    background: rgba(245,158,11,0.05);
    border: 1px dashed rgba(245,158,11,0.3);
}

.activity-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.activity-body {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.activity-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.activity-private-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: rgba(245,158,11,0.15);
    color: var(--accent-amber);
    border-radius: 6px;
    font-weight: 600;
    align-self: flex-start;
}

/* Кнопка смены пароля */
.btn-change-password {
    margin-top: 0.5rem;
}
#avatar-picker-modal { z-index: 2100 !important; }
#profile-edit-modal  { z-index: 2000 !important; }