/* ================================== */
/* ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ: БАЗА         */
/* ================================== */

/* ========== ОБЩИЙ СТЕКЛЯННЫЙ СТИЛЬ ДЛЯ МОДАЛОК ========== */
.modal-content.user-profile-modal,
.modal-content.profile-modal-custom {
    background: var(--bg-surface);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    color: var(--text);
    box-shadow: var(--shadow-2xl);
    max-width: 420px;
    margin: 0 auto;
    overflow: hidden;
}

body.light-theme .modal-content.user-profile-modal,
body.light-theme .modal-content.profile-modal-custom {
    background: #ffffff;
    backdrop-filter: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text);
}

/* ========== ЗАГОЛОВОК ========== */
.user-profile-modal .modal-header,
.profile-modal-custom .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile-modal .modal-header .modal-title,
.profile-modal-custom .modal-header .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    text-align: center;
}

/* Кнопки в заголовке (ProfileModal) */
.user-profile-modal .modal-header .user-profile-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.user-profile-modal .modal-header .user-profile-action-btn:hover {
    color: var(--primary);
}

/* ========== ТЕЛО МОДАЛКИ ========== */
.user-profile-modal .modal-body,
.profile-modal-custom .modal-body {
    padding: 20px 24px 16px !important;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Контейнер содержимого */
.user-profile-modal .modal-body .user-profile-body,
.user-profile-modal .modal-body .profile-modal-body-content,
.profile-modal-custom .modal-body .user-profile-body {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ========== СТАТУС (последнее посещение) – центрируем ========== */
.user-profile-modal .modal-body .user-profile-lastseen,
.profile-modal-custom .modal-body .user-profile-lastseen {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ========== АВАТАР (поддержка обоих вариантов) ========== */
.user-profile-modal .modal-body .user-profile-avatar-wrapper,
.user-profile-modal .modal-body .profile-avatar-container,
.profile-modal-custom .modal-body .user-profile-avatar-wrapper,
.profile-modal-custom .modal-body .profile-avatar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.user-profile-modal .modal-body .user-profile-avatar,
.user-profile-modal .modal-body .profile-avatar,
.profile-modal-custom .modal-body .user-profile-avatar,
.profile-modal-custom .modal-body .profile-avatar {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50% !important;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: width 0.25s ease, height 0.25s ease, font-size 0.25s ease;
    flex-shrink: 0;
    position: relative;
}

.user-profile-modal .modal-body .user-profile-avatar .avatar-image,
.user-profile-modal .modal-body .profile-avatar .avatar-image,
.profile-modal-custom .modal-body .user-profile-avatar .avatar-image,
.profile-modal-custom .modal-body .profile-avatar .avatar-image {
    width: 100%;
    height: 100%;
    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;
}

/* Кнопка камеры (только в ProfileModal) */
.user-profile-modal .modal-body .profile-avatar .avatar-camera-btn,
.profile-modal-custom .modal-body .profile-avatar .avatar-camera-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-surface);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition);
    z-index: var(--z-base);
}

.user-profile-modal .modal-body .profile-avatar .avatar-camera-btn:hover,
.profile-modal-custom .modal-body .profile-avatar .avatar-camera-btn:hover {
    transform: scale(1.05);
    background: var(--primary-dark);
}

/* ========== НИКНЕЙМ ========== */
.user-profile-modal .modal-body .user-profile-nickname,
.profile-modal-custom .modal-body .user-profile-nickname {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 2px;
    word-break: break-word;
}

/* ========== СТРОКИ ПРОФИЛЯ ========== */
.user-profile-modal .modal-body .user-profile-row,
.user-profile-modal .modal-body .profile-info-field,
.user-profile-modal .modal-body .profile-editable-field,
.profile-modal-custom .modal-body .user-profile-row,
.profile-modal-custom .modal-body .profile-info-field,
.profile-modal-custom .modal-body .profile-editable-field {
    display: flex;
    align-items: center;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--border);
    margin: 0 !important;
}

.user-profile-modal .modal-body .user-profile-row:last-child,
.user-profile-modal .modal-body .profile-info-field:last-child,
.user-profile-modal .modal-body .profile-editable-field:last-child,
.profile-modal-custom .modal-body .user-profile-row:last-child,
.profile-modal-custom .modal-body .profile-info-field:last-child,
.profile-modal-custom .modal-body .profile-editable-field:last-child {
    border-bottom: none;
}

.user-profile-modal .modal-body .user-profile-row-icon,
.user-profile-modal .modal-body .field-icon,
.profile-modal-custom .modal-body .user-profile-row-icon,
.profile-modal-custom .modal-body .field-icon {
    width: 32px;
    color: var(--text-secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-profile-modal .modal-body .user-profile-row-text,
.user-profile-modal .modal-body .field-content,
.profile-modal-custom .modal-body .user-profile-row-text,
.profile-modal-custom .modal-body .field-content {
    flex: 1;
    font-size: 15px;
    color: var(--text);
    word-break: break-word;
    padding-left: 8px;
}

.user-profile-modal .modal-body .field-label,
.profile-modal-custom .modal-body .field-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.user-profile-modal .modal-body .field-value,
.profile-modal-custom .modal-body .field-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.user-profile-modal .modal-body .field-arrow,
.profile-modal-custom .modal-body .field-arrow {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========== О СЕБЕ (текстовая область) ========== */
.user-profile-modal .modal-body .profile-about-section {
    margin-bottom: var(--spacing-xl);
}

.user-profile-modal .modal-body .profile-about-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text);
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.user-profile-modal .modal-body .profile-about-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.user-profile-modal .modal-body .profile-about-counter {
    text-align: right;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.user-profile-modal .modal-body .profile-about-example {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    padding: 8px 12px;
    border-radius: var(--radius-md);
}

/* ========== ПЕРЕКЛЮЧАТЕЛЬ УВЕДОМЛЕНИЙ ========== */
.user-profile-modal .modal-body .user-profile-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.user-profile-modal .modal-body .user-profile-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.user-profile-modal .modal-body .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-modal .modal-body .user-profile-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.user-profile-modal .modal-body input:checked + .user-profile-slider {
    background-color: var(--primary);
}

.user-profile-modal .modal-body input:checked + .user-profile-slider:before {
    transform: translateX(24px);
}

/* ========== КНОПКИ ДЕЙСТВИЙ ========== */
.user-profile-modal .modal-body .user-profile-actions,
.profile-modal-custom .modal-body .user-profile-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.user-profile-modal .modal-body .user-profile-chat-btn,
.profile-modal-custom .modal-body .user-profile-chat-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border: none !important;
    border-radius: var(--radius-full) !important;
    padding: 10px 20px !important;
    color: white !important;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(76, 154, 255, 0.3) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.user-profile-modal .modal-body .user-profile-chat-btn:hover,
.profile-modal-custom .modal-body .user-profile-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(76, 154, 255, 0.4) !important;
}

.user-profile-modal .modal-body .user-profile-chat-btn:active,
.profile-modal-custom .modal-body .user-profile-chat-btn:active {
    transform: translateY(0);
}

.user-profile-modal .modal-body .user-profile-contact-btn,
.profile-modal-custom .modal-body .user-profile-contact-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-secondary) !important;
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.user-profile-modal .modal-body .user-profile-contact-btn:hover,
.profile-modal-custom .modal-body .user-profile-contact-btn:hover {
    background: var(--bg-hover) !important;
    color: var(--primary) !important;
    transform: scale(1.05);
}

.user-profile-modal .modal-body .user-profile-contact-btn:active,
.profile-modal-custom .modal-body .user-profile-contact-btn:active {
    transform: scale(0.95);
}

/* ========== СВЕТЛАЯ ТЕМА ========== */
body.light-theme .user-profile-modal .modal-body .user-profile-chat-btn,
body.light-theme .profile-modal-custom .modal-body .user-profile-chat-btn {
    box-shadow: 0 4px 16px rgba(42, 108, 187, 0.25) !important;
}

body.light-theme .user-profile-modal .modal-body .user-profile-chat-btn:hover,
body.light-theme .profile-modal-custom .modal-body .user-profile-chat-btn:hover {
    box-shadow: 0 8px 24px rgba(42, 108, 187, 0.35) !important;
}

body.light-theme .user-profile-modal .modal-body .user-profile-contact-btn:hover,
body.light-theme .profile-modal-custom .modal-body .user-profile-contact-btn:hover {
    background: rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .user-profile-modal .modal-body .profile-avatar .avatar-camera-btn,
body.light-theme .profile-modal-custom .modal-body .profile-avatar .avatar-camera-btn {
    border-color: #ffffff;
}

body.light-theme .user-profile-modal .modal-body .profile-editable-field:hover,
body.light-theme .profile-modal-custom .modal-body .profile-editable-field:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ========== АДАПТАЦИЯ ========== */
@media (max-width: 768px) {
    .modal-content.user-profile-modal,
    .modal-content.profile-modal-custom {
        max-width: 95%;
        border-radius: var(--radius-xl);
    }
    .user-profile-modal .modal-body,
    .profile-modal-custom .modal-body {
        padding: 16px 20px !important;
    }
    .user-profile-modal .modal-body .user-profile-avatar,
    .user-profile-modal .modal-body .profile-avatar,
    .profile-modal-custom .modal-body .user-profile-avatar,
    .profile-modal-custom .modal-body .profile-avatar {
        width: 80px !important;
        height: 80px !important;
        font-size: 34px;
    }
    .user-profile-modal .modal-body .user-profile-nickname,
    .profile-modal-custom .modal-body .user-profile-nickname {
        font-size: 18px;
    }
    .user-profile-modal .modal-body .user-profile-row,
    .user-profile-modal .modal-body .profile-info-field,
    .user-profile-modal .modal-body .profile-editable-field,
    .profile-modal-custom .modal-body .user-profile-row,
    .profile-modal-custom .modal-body .profile-info-field,
    .profile-modal-custom .modal-body .profile-editable-field {
        padding: 6px 0 !important;
    }
    .user-profile-modal .modal-body .user-profile-row-text,
    .user-profile-modal .modal-body .field-content,
    .profile-modal-custom .modal-body .user-profile-row-text,
    .profile-modal-custom .modal-body .field-content {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .modal-content.user-profile-modal,
    .modal-content.profile-modal-custom {
        max-width: 98%;
        border-radius: var(--radius-lg);
    }
    .user-profile-modal .modal-body,
    .profile-modal-custom .modal-body {
        padding: 12px 16px !important;
    }
}

/* ========== УВАЖЕНИЕ PREFERS-REDUCED-MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    .user-profile-modal .modal-body .user-profile-avatar-wrapper,
    .user-profile-modal .modal-body .user-profile-avatar,
    .user-profile-modal .modal-body .profile-avatar,
    .profile-modal-custom .modal-body .user-profile-avatar,
    .profile-modal-custom .modal-body .profile-avatar,
    .user-profile-modal .modal-body .user-profile-close,
    .user-profile-modal .modal-body .user-profile-action-btn,
    .user-profile-modal .modal-body .user-profile-slider,
    .user-profile-modal .modal-body .user-profile-slider:before,
    .user-profile-modal .modal-body .user-profile-body,
    .profile-modal-custom .modal-body .profile-avatar .avatar-camera-btn,
    .profile-modal-custom .modal-body .profile-editable-field {
        transition: none !important;
    }
    .user-profile-modal .modal-body input:checked + .user-profile-slider:before {
        transform: translateX(24px);
    }
    .user-profile-modal .modal-body .profile-avatar:hover,
    .profile-modal-custom .modal-body .profile-avatar:hover {
        transform: none;
    }
    .user-profile-modal .modal-body .profile-avatar .avatar-camera-btn:hover,
    .profile-modal-custom .modal-body .profile-avatar .avatar-camera-btn:hover {
        transform: none;
    }
}