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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #0e1621;
    color: #e4e6eb;
}

.chat-container {
    display: flex;
    height: 100vh;
}

/* Боковая панель со списком чатов */
.sidebar {
    width: 350px;
    background: #17212b;
    border-right: 1px solid #242f3d;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 12px 16px;
    background: #17212b;
    border-bottom: 1px solid #242f3d;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 500;
    color: #e4e6eb;
}

.create-chat-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5288c1;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

.create-chat-button:hover {
    background: #5a95d1;
    transform: rotate(90deg);
}

.create-chat-button:active {
    transform: rotate(90deg) scale(0.95);
}

.search-box {
    padding: 8px 16px;
    background: #17212b;
    border-bottom: 1px solid #242f3d;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    background: #242f3d;
    border: none;
    border-radius: 20px;
    color: #e4e6eb;
    font-size: 14px;
    outline: none;
}

.search-input::placeholder {
    color: #6c757d;
}

.search-clear-button {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.search-clear-button:hover {
    background: #2b5278;
    color: #e4e6eb;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    background: #17212b;
}

.chat-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #242f3d;
}

.chat-item:hover {
    background: #242f3d;
}

.chat-item.active {
    background: #2b5278;
}

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

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

.chat-avatar {
    position: relative;
}

.user-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #17212b;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.user-status.online {
    background: #4caf50;
    color: #4caf50;
}

.user-status.offline {
    background: #6c757d;
    color: #6c757d;
}

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

.chat-name {
    font-size: 15px;
    font-weight: 500;
    color: #e4e6eb;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-preview {
    font-size: 13px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 8px;
}

.chat-time {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.chat-unread {
    background: #5288c1;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Основная область чата */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0e1621;
}

.chat-header {
    padding: 12px 16px;
    background: #17212b;
    border-bottom: 1px solid #242f3d;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-right: 12px;
}

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

.chat-header-name {
    font-size: 16px;
    font-weight: 500;
    color: #e4e6eb;
}

.chat-header-status {
    font-size: 13px;
    color: #6c757d;
    margin-top: 2px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.chat-header-button:hover {
    background: #242f3d;
    color: #e4e6eb;
}

.chat-header-button svg {
    width: 20px;
    height: 20px;
}

.chat-menu-wrapper {
    position: relative;
}

.chat-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #17212b;
    border: 1px solid #242f3d;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px;
    min-width: 200px;
    z-index: 1000;
    animation: slideDown 0.2s;
    display: none;
    flex-direction: column;
}

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

.chat-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    width: 100%;
}

.chat-menu-item:hover {
    background: #242f3d;
}

.chat-menu-item.danger {
    color: #f44336;
}

.chat-menu-item.danger:hover {
    background: #2b1a1a;
}

.chat-menu-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #6c757d;
}

.chat-menu-item:hover svg {
    color: #5288c1;
}

.chat-menu-item.danger:hover svg {
    color: #f44336;
}

.chat-menu-item span {
    flex: 1;
}

.chat-menu-divider {
    height: 1px;
    background: #242f3d;
    margin: 4px 0;
}

/* Стили для отображения ID чата в модальном окне */
.chat-id-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #242f3d;
    border: 1px solid #2b5278;
    border-radius: 8px;
}

.chat-id-display {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #5288c1;
    word-break: break-all;
    user-select: all;
    padding: 4px 0;
}

.copy-id-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #5288c1;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.copy-id-btn:hover {
    background: #5a95d1;
    transform: scale(1.05);
}

.copy-id-btn:active {
    transform: scale(0.95);
}

.copy-id-btn svg {
    width: 16px;
    height: 16px;
}

/* Стили для модального окна подтверждения удаления */
.confirm-message {
    text-align: center;
    padding: 20px 0;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-message p {
    font-size: 16px;
    color: #e4e6eb;
    margin: 8px 0;
    line-height: 1.5;
}

.confirm-warning {
    color: #f44336;
    font-weight: 500;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #d32f2f;
}

.btn-danger:disabled {
    background: #5a2a2a;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Стили для опций в модальных окнах подтверждения */
.confirm-option {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #242f3d;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 8px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #5288c1;
}

.checkbox-label span {
    font-size: 14px;
    color: #e4e6eb;
    font-weight: 500;
}

.option-hint {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
    margin-left: 32px;
    line-height: 1.4;
}

/* Стили для модального окна профиля пользователя */
.user-profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    text-align: center;
}

.user-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 20px;
    overflow: hidden;
    border: 3px solid #5288c1;
}

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

.user-profile-name {
    font-size: 24px;
    font-weight: 600;
    color: #e4e6eb;
    margin-bottom: 12px;
}

.user-profile-id {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
}

.user-profile-status {
    font-size: 14px;
    color: #6c757d;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

.user-profile-status.online {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.user-profile-status.offline {
    color: #6c757d;
    background: rgba(108, 117, 125, 0.1);
}

.chat-header-avatar:hover {
    opacity: 0.8;
    transform: scale(1.05);
    transition: all 0.2s;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #0e1621;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(120, 119, 198, 0.03) 0%, transparent 50%);
    /* Скрываем скроллбар */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

.messages-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s;
}

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

.message.own {
    flex-direction: row-reverse;
}

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

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.message.own .message-avatar {
    margin: 0 0 0 8px;
}

.message-content {
    max-width: 60%;
    display: flex;
    flex-direction: column;
}

.message.own .message-content {
    align-items: flex-end;
}

.message-bubble {
    background: #182533;
    padding: 8px 12px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
}

.message.own .message-bubble {
    background: #2b5278;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    color: #e4e6eb;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    text-align: right;
}

.message.own .message-time {
    text-align: left;
}


.input-area {
    padding: 8px 16px;
    background: #17212b;
    border-top: 1px solid #242f3d;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.input-wrapper {
    flex: 1;
    background: #242f3d;
    border-radius: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}

.input-icon-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    flex-shrink: 0;
    margin: 4px;
}

.input-icon-button:hover {
    background: #2b5278;
    color: #e4e6eb;
}


.message-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e4e6eb;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    padding: 12px 0;
    line-height: 20px;
    min-height: 44px;
    height: 44px;
    max-height: 200px;
    overflow-y: hidden;
    box-sizing: border-box;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input::placeholder {
    color: #6c757d;
    line-height: 20px;
}

.send-button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #5288c1;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
    margin: 4px 8px 4px 4px;
}

.send-button svg {
    width: 16px;
    height: 16px;
}

.send-button:hover {
    background: #5a95d1;
}

.send-button:disabled {
    background: #3d5a7a;
    cursor: not-allowed;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
    padding: 40px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
}

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

::-webkit-scrollbar-track {
    background: #17212b;
}

::-webkit-scrollbar-thumb {
    background: #242f3d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2b5278;
}

/* Модальное окно */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: #17212b;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #242f3d;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 500;
    color: #e4e6eb;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: #242f3d;
    color: #e4e6eb;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #242f3d;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #e4e6eb;
    margin-bottom: 8px;
}

.chat-type-selector {
    display: flex;
    gap: 8px;
}

.chat-type-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    background: #242f3d;
    border: 1px solid #242f3d;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-type-btn.active {
    background: #5288c1;
    border-color: #5288c1;
    color: white;
}

.chat-type-btn:hover:not(.active) {
    background: #2b5278;
    border-color: #2b5278;
    color: #e4e6eb;
}

.user-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-input-wrapper .form-input {
    flex: 1;
}

.add-user-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #5288c1;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.add-user-btn:hover {
    background: #5a95d1;
}

.add-user-btn:disabled {
    background: #3d5a7a;
    cursor: not-allowed;
    opacity: 0.6;
}

.added-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.added-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #242f3d;
    border-radius: 8px;
    border: 1px solid #2b5278;
}

.added-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

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

.added-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.added-user-name {
    font-size: 14px;
    color: #e4e6eb;
    flex: 1;
}

.remove-user-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.remove-user-btn:hover {
    background: #2b5278;
    color: #e4e6eb;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: #242f3d;
    border: 1px solid #2b5278;
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #5288c1;
}

.users-list {
    max-height: 300px;
    overflow-y: auto;
    background: #242f3d;
    border-radius: 8px;
    padding: 8px;
}

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

.user-item:hover {
    background: #2b5278;
}

.user-item.selected {
    background: #5288c1;
}

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

.user-item-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-item-info {
    flex: 1;
}

.user-item-name {
    font-size: 15px;
    font-weight: 500;
    color: #e4e6eb;
}

.user-item-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.2s;
}

.user-item.selected .user-item-check {
    background: #5288c1;
    border-color: #5288c1;
}

.user-item.selected .user-item-check::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #5288c1;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5a95d1;
}

.btn-primary:disabled {
    background: #3d5a7a;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: #242f3d;
    color: #e4e6eb;
}

.btn-secondary:hover {
    background: #2b5278;
}

/* Toast уведомления */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #17212b;
    border: 1px solid #242f3d;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-success .toast-icon {
    color: #4caf50;
}

.toast-error .toast-icon {
    color: #f44336;
}

.toast-warning .toast-icon {
    color: #ff9800;
}

.toast-info .toast-icon {
    color: #5288c1;
}

.toast-message {
    flex: 1;
    color: #e4e6eb;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #e4e6eb;
}

.toast-success {
    border-left: 3px solid #4caf50;
}

.toast-error {
    border-left: 3px solid #f44336;
}

.toast-warning {
    border-left: 3px solid #ff9800;
}

.toast-info {
    border-left: 3px solid #5288c1;
}

/* Меню прикрепления файлов */
.attach-button-wrapper {
    position: relative;
    flex-shrink: 0;
}

.attach-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: #17212b;
    border: 1px solid #242f3d;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
    z-index: 1000;
    animation: slideUp 0.2s;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    width: 100%;
}

.attach-menu-item:hover {
    background: #242f3d;
}

.attach-menu-item svg {
    flex-shrink: 0;
    color: #6c757d;
}

.attach-menu-item:hover svg {
    color: #5288c1;
}

.attach-menu-item span {
    flex: 1;
}

/* Стили для файлов в сообщениях */
.message-file {
    margin-bottom: 8px;
}

.message-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.message-image img:hover {
    opacity: 0.9;
}

.message-video video {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    display: block;
}

.message-document {
    display: flex;
    align-items: center;
}

.document-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: #e4e6eb;
    transition: background 0.2s;
    width: 100%;
}

.document-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.document-link svg {
    flex-shrink: 0;
    color: #5288c1;
}

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

.document-name {
    font-size: 14px;
    font-weight: 500;
    color: #e4e6eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-size {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

/* Модальное окно для превью медиа */
.media-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s;
    backdrop-filter: blur(10px);
}

.media-preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.media-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e4e6eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

.media-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.media-preview-close svg {
    width: 20px;
    height: 20px;
}

.media-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

.media-preview-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    animation: zoomIn 0.3s;
}

.media-preview-video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: #000;
    animation: zoomIn 0.3s;
}

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

/* Emoji picker стили */
.emoji-button-wrapper {
    position: relative;
    flex-shrink: 0;
}

#emojiPickerContainer {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    z-index: 1000;
}

#emojiPicker {
    --emoji-size: 1.5rem;
    --num-columns: 8;
    --category-emoji-size: 1.2rem;
    --border-radius: 12px;
    --background: #17212b;
    --border-color: #242f3d;
    --indicator-color: #5288c1;
    --button-hover-background: #242f3d;
    --button-active-background: #2b5278;
    --text-color: #e4e6eb;
    --text-secondary-color: #6c757d;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size: 14px;
    width: 350px;
    max-width: 90vw;
    height: 400px;
    max-height: 50vh;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    #emojiPicker {
        width: 100%;
        max-width: calc(100vw - 32px);
        height: 350px;
    }
}

/* Контекстное меню для сообщений */
.message-context-menu {
    position: fixed;
    background: #17212b;
    border: 1px solid #242f3d;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8px;
    min-width: 160px;
    z-index: 10000;
    display: none;
    flex-direction: column;
    animation: slideDown 0.2s;
}

.message-context-menu.show {
    display: flex;
}

.message-context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    width: 100%;
}

.message-context-menu-item:hover {
    background: #242f3d;
}

.message-context-menu-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #6c757d;
}

.message-context-menu-item:hover svg {
    color: #5288c1;
}

.message-context-menu-item span {
    flex: 1;
}

/* Индикатор ответа на сообщение */
.reply-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #242f3d;
    border-left: 3px solid #5288c1;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #6c757d;
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-author {
    font-weight: 500;
    color: #5288c1;
    margin-bottom: 2px;
}

.reply-preview-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #6c757d;
}

.reply-preview-close {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #6c757d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.reply-preview-close:hover {
    background: #2b5278;
    color: #e4e6eb;
}

.reply-preview-close svg {
    width: 14px;
    height: 14px;
}

