* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Premium Dark Theme Colors */
    --primary-color: #5477E6;
    --primary-gradient: linear-gradient(135deg, #5477E6 0%, #7B61FF 100%);
    --primary-hover: #4663D4;

    --bg-primary: #0D0D0F;
    --bg-secondary: #141419;
    --bg-tertiary: #1A1A20;
    --bg-elevated: #1F1F28;

    --sidebar-bg: #141419;
    --chat-bg: #0D0D0F;
    --header-bg: #141419;
    --input-bg: #1A1A20;
    --modal-bg: #1F1F28;

    --message-out: #2D2D44;
    --message-in: #1A1A20;
    --message-hover: #252530;

    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;

    --border-color: #272730;
    --border-light: #3F3F4E;

    --online-color: #10B981;
    --online-glow: rgba(16, 185, 129, 0.4);

    --hover-color: #1F1F28;
    --active-color: #2D2D44;

    --accent-gold: #D4AF37;
    --accent-purple: #7B61FF;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

    --scrollbar-thumb: #3F3F4E;
    --scrollbar-track: #1A1A20;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hidden {
    display: none !important;
}

/* Экран авторизации */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #0D0D0F 0%, #1a1a2e 50%, #0D0D0F 100%);
    position: relative;
    overflow: hidden;
}

.auth-screen::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 80%, rgba(84, 119, 230, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(123, 97, 255, 0.08) 0%, transparent 50%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.5; }
    50% { transform: scale(1.1) rotate(5deg); opacity: 0.8; }
}

.auth-container {
    background: var(--bg-elevated);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-color) inset;
    text-align: center;
    max-width: 420px;
    width: 90%;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
}

.auth-logo svg {
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 12px rgba(84, 119, 230, 0.4));
}

.auth-logo h1 {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 25px;
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.auth-form input {
    width: 100%;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 119, 230, 0.15);
    background: var(--bg-tertiary);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

.auth-form textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.auth-options {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-switch a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.file-input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 14px;
    transition: color 0.2s;
}

.file-input-label:hover {
    color: var(--primary-hover);
}

.file-name {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.auth-loading p {
    margin-top: 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(84, 119, 230, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(84, 119, 230, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    padding: 12px 24px;
    background: transparent;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(84, 119, 230, 0.1);
    border-color: var(--primary-hover);
}

/* Мессенджер */
.messenger-screen {
    display: flex;
    height: 100vh;
    width: 100%;
    background: var(--bg-primary);
}

/* Боковая панель */
.sidebar {
    width: 20%;
    min-width: 320px;
    max-width: 450px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

@media (min-width: 769px) {
    .sidebar .menu-btn {
        display: none;
    }
}

.profile-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.profile-btn:hover {
    background: var(--hover-color);
    color: var(--primary-color);
}

.logout-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.menu-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border-radius: 22px;
    padding: 8px 15px;
    gap: 10px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
    border-radius: 12px;
    margin: 4px 8px;
}

.chat-item:hover {
    background: var(--hover-color);
}

.chat-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(84, 119, 230, 0.3);
}

.chat-item.active .chat-last-message,
.chat-item.active .chat-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--online-color);
    border: 2px solid var(--sidebar-bg);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--online-glow);
}

.chat-info-main {
    flex: 1;
    min-width: 0;
}

.chat-name-row {

    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.chat-name {
    color: white;
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: 8px;
}

.chat-last-message {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* Окно чата */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    position: relative;
    min-width: 0;
}

.chat-header {
    background: var(--bg-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.chat-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 600;
    font-size: 18px;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chat-avatar {
    width: 42px;
    height: 42px;
    font-size: 18px;
    overflow: hidden;
}

#chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-details {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.chat-details:hover h3 {
    color: var(--primary-color);
}

.chat-details h3 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
    transition: color 0.2s;
}

.chat-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-status.online {
    color: var(--online-color);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 450px;
    background: var(--chat-bg);
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: white;
}

.empty-chat-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-chat p {
    font-size: 16px;
    opacity: 0.7;
}

.message {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    animation: messageIn 0.2s ease;
    box-shadow: var(--shadow-sm);
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.incoming {
    background: var(--message-in);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.outgoing {
    background: var(--primary-gradient);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.message.outgoing .message-content,
.message.outgoing .message-meta {
    color: white;
}

.message.outgoing .message-meta {
    opacity: 0.8;
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.message.outgoing .message-meta {
    color: rgba(0, 0, 0, 0.5);
}

.message-status {
    display: flex;
}

.message-status svg {
    width: 16px;
    height: 16px;
}

.message-status.read {
    color: var(--primary-color);
}

/* Поле ввода сообщения */
.message-input-container {
    background: var(--bg-color);
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--input-bg);
    border-radius: 24px;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.message-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 119, 230, 0.1);
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    outline: none;
    padding: 5px;
}

.attach-btn,
.emoji-btn,
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.attach-btn:hover,
.emoji-btn:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.send-btn {
    color: var(--primary-color);
}

.send-btn:hover {
    background: var(--primary-gradient);
    color: white;
    transform: scale(1.05);
}

/* Панель пользователей */
.users-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.users-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.users-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.2s;
}

.close-btn:hover {
    background: var(--hover-color);
}

.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.user-item:hover {
    background: var(--hover-color);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
    position: relative;
    flex-shrink: 0;
}

.user-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online-color);
    border: 2px solid white;
    border-radius: 50%;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.user-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.user-status.online {
    color: var(--online-color);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--modal-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--hover-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-body input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.modal-body input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 119, 230, 0.15);
}

.user-search-results {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.search-result-item:hover {
    background: var(--hover-color);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Профиль */
.profile-modal-content {
    max-width: 500px;
}

.profile-modal-body {
    padding: 25px;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

.profile-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: white;
    margin-bottom: 15px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.profile-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--hover-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
}

.profile-avatar-upload:hover {
    background: var(--active-color);
}

.profile-avatar-upload svg {
    flex-shrink: 0;
}

.profile-avatar-remove {
    position: absolute;
    bottom: 10px;
    right: calc(50% - 50px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ff4757;
    border: 3px solid var(--modal-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.profile-avatar-remove:hover {
    background: #ff6b7a;
    transform: scale(1.1);
}

.profile-field {
    margin-bottom: 20px;
}

.profile-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-field input,
.profile-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s;
    font-family: inherit;
}

.profile-field input:focus,
.profile-field textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(84, 119, 230, 0.15);
}

.profile-field textarea {
    min-height: 100px;
    resize: vertical;
}

.profile-field input[type="date"] {
    color-scheme: dark;
}

.profile-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Просмотр профиля */
.view-profile-modal-content {
    max-width: 420px;
}

.view-profile-modal-body {
    padding: 30px 25px;
}

.view-profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    text-align: center;
}

.view-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: white;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.view-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.view-profile-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.view-profile-status {
    font-size: 14px;
    color: var(--online-color);
    font-weight: 500;
}

.view-profile-status.offline {
    color: var(--text-secondary);
}

.view-profile-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.view-profile-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.view-profile-item svg {
    color: var(--primary-color);
    flex-shrink: 0;
    margin-top: 2px;
}

.view-profile-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.view-profile-value {
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Настройки беседы */
.chat-settings-modal-content {
    max-width: 500px;
}

.chat-settings-modal-body {
    padding: 25px;
}

.chat-settings-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
    position: relative;
}

.chat-settings-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
    color: white;
    margin-bottom: 15px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.chat-settings-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-settings-avatar-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--hover-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
}

.chat-settings-avatar-upload:hover {
    background: var(--active-color);
}

.chat-settings-avatar-remove {
    position: absolute;
    bottom: 10px;
    right: calc(50% - 50px);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ff4757;
    border: 3px solid var(--modal-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
}

.chat-settings-avatar-remove:hover {
    background: #ff6b7a;
    transform: scale(1.1);
}

.chat-settings-participants {
    margin-top: 20px;
}

.chat-settings-participants-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-settings-participants-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.chat-participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: background 0.2s;
}

.chat-participant-item:hover {
    background: var(--hover-color);
}

.chat-participant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-participant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-participant-info {
    flex: 1;
    min-width: 0;
}

.chat-participant-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.chat-participant-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-participant-status.online {
    color: var(--online-color);
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
    border: 2px solid var(--scrollbar-track);
}

::-webkit-scrollbar-thumb:hover {
    background: #4F4F5F;
}

/* Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .menu-btn {
        display: flex;
    }

    .message {
        max-width: 85%;
    }

    .users-panel {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 30%;
        min-width: 280px;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .sidebar {
        width: 25%;
    }
}

@media (min-width: 1441px) {
    .sidebar {
        width: 20%;
        min-width: 320px;
        max-width: 450px;
    }
}

@media (max-width: 768px) {
    .chat-brand {
        display: none;
    }

    .chat-menu-btn {
        display: flex !important;
    }
}

/* Уведомления */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: notificationIn 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

@keyframes notificationIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Индикатор набора текста */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 15px;
    background: var(--message-in);
    border-radius: 16px;
    width: fit-content;
    box-shadow: var(--shadow-sm);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
    box-shadow: 0 0 8px rgba(84, 119, 230, 0.5);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Панель эмодзи */
.emoji-panel {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 12px;
    display: none;
    z-index: 100;
    width: 340px;
    max-height: 420px;
    overflow: hidden;
    flex-direction: column;
}

.emoji-panel.show {
    display: flex;
    flex-direction: column;
    animation: emojiIn 0.2s ease;
}

@keyframes emojiIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-categories {
    display: flex;
    gap: 4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    overflow-x: auto;
    flex-shrink: 0;
}

.emoji-categories::-webkit-scrollbar {
    height: 4px;
}

.emoji-category {
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.emoji-category:hover {
    background: var(--hover-color);
}

.emoji-category.active {
    background: var(--primary-gradient);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    overflow-y: auto;
    padding: 4px;
    max-height: 320px;
}

.emoji-grid::-webkit-scrollbar {
    width: 6px;
}

.emoji-item {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.emoji-item:hover {
    background: var(--hover-color);
    transform: scale(1.15);
}

/* Загрузка файлов */
.file-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 12px;
    color: var(--text-secondary);
}

.file-preview-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.file-preview-remove:hover {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
}

/* Сообщение с файлом */
.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
}

.message-file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(84, 119, 230, 0.3);
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

/* Модальное окно просмотра изображения */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Скрытый input для файлов */
.file-input {
    display: none;
}

/* Прогресс бар загрузки */
.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    transition: width 0.3s;
}

.upload-progress-container {
    position: relative;
    overflow: hidden;
}
