/* ===== UserProfileModal стили ===== */
.user-profile-modal {
    width: 380px;
    max-width: 90%;
    padding: 20px 24px 28px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden; /* запрещаем горизонтальную прокрутку */
}

/* Шапка: крестик слева, заголовок по центру, кнопка действия справа */
.user-profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.user-profile-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    width: 32px;
}

.user-profile-close:hover {
    color: var(--text);
}

.user-profile-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex: 1;
}

.user-profile-header-actions {
    width: 32px;
    display: flex;
    justify-content: flex-end;
}

.user-profile-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.user-profile-action-btn:hover {
    color: var(--primary);
}

.user-profile-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-profile-avatar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.user-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: width 0.25s ease, height 0.25s ease, font-size 0.25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-profile-avatar-wrapper.expanded .user-profile-avatar {
    width: 200px;
    height: 200px;
    font-size: 84px;
}

.user-profile-nickname {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 2px;
    word-break: break-word;
}

.user-profile-lastseen {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Общий стиль для строк */
.user-profile-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.user-profile-row-icon {
    width: 32px;
    color: var(--text-secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-row-text {
    flex: 1;
    font-size: 15px;
    color: var(--text);
    word-break: break-word;
}

/* Для строки с телефоном и @ иконка слева, текст справа */
.user-profile-row {
    justify-content: flex-start;
}

/* Переключатель (свитч) */
.user-profile-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.user-profile-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.user-profile-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-elevated);
    transition: 0.3s;
    border-radius: 34px;
}

.user-profile-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .user-profile-slider {
    background-color: var(--primary);
}

input:checked + .user-profile-slider:before {
    transform: translateX(24px);
}

/* Табы и медиа-сетка */
.user-profile-tabs {
    display: flex;
    gap: 12px;
    margin: 12px 0 0;
    border-bottom: 1px solid var(--border);
}

.user-profile-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.user-profile-tab.active {
    color: var(--primary);
}

.user-profile-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.user-profile-tab:hover:not(.active) {
    color: var(--text);
}

.user-profile-tab-content {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Медиа — 3 колонки */
.user-profile-media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.user-profile-media-item {
    aspect-ratio: 1 / 1;
    background: var(--bg-elevated);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-media-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.user-profile-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-media-video {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.user-profile-media-video i {
    font-size: 32px;
    color: var(--primary);
}

.user-profile-media-video span {
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Файлы — 3 колонки (как медиа) */
.user-profile-files-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.user-profile-file-item {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    overflow: hidden;
}

.user-profile-file-item:hover {
    background: var(--bg-surface);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-profile-file-item i {
    font-size: 28px;
    color: var(--primary);
}

.user-profile-file-name {
    font-size: 11px;
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-file-caption {
    font-size: 10px;
    color: var(--text-secondary);
    word-break: break-word;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Голосовые — столбик */
.user-profile-voice-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-voice-item {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

/* Расширенная аватарка (полноэкранный режим) */
.avatar-expanded-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    z-index: 30000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.avatar-expanded-image {
    width: min(80vw, 80vh);
    height: min(80vw, 80vh);
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(min(80vw, 80vh) * 0.3);
    font-weight: 600;
    color: white;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    cursor: pointer;
}

.avatar-expanded-hint {
    margin-top: 24px;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    text-align: center;
    animation: fadeSlideUp 0.3s ease;
}

/* Модалка редактирования контакта */
.contact-edit-modal {
    width: 400px;
    max-width: 90%;
    padding: 20px 24px 24px;
}

.contact-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.contact-edit-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
}

.contact-edit-close:hover {
    color: var(--text);
}

.contact-edit-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex: 1;
}

/* Пустой отступ для баланса (в JSX есть <div style={{width: '32px'}}></div>) */
.contact-edit-header > div:last-child {
    width: 32px;
}

.contact-edit-body {
    margin-bottom: 20px;
}

.contact-edit-field {
    margin-bottom: 16px;
}

.contact-edit-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.contact-edit-field .form-control {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
}

.contact-edit-field .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.contact-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.contact-edit-footer .btn {
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 14px;
}