/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-icon {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Экран авторизации */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.6s ease;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.auth-header h1 i {
    color: #667eea;
    margin-right: 10px;
}

.auth-header p {
    color: #666;
    font-size: 16px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-radius: 8px;
    background: #f8f9fa;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* Основной интерфейс мессенджера */
.messenger-container {
    display: flex;
    height: 100vh;
    background: white;
}

/* Значок верификации для DELTA OFFICIAL */
.verified-badge {
    color: #1da1f2;
    margin-left: 4px;
    font-size: 14px;
}

.user-item-name.verified {
    display: flex;
    align-items: center;
}

/* Кнопки звонков */
.chat-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.btn-icon {
    background: none;
    border: none;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

/* Кнопки в поле ввода */
.message-input-wrapper .btn-icon {
    color: #667eea;
    font-size: 16px;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.message-input-wrapper .btn-icon:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.05);
}

.image-upload-btn {
    cursor: pointer;
}

/* Боковая панель */
.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    margin-left: 60px; /* Отступ для панели каналов */
    position: relative;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.user-info:hover {
    background: rgba(102, 126, 234, 0.1);
}

.profile-arrow {
    margin-left: auto;
    color: #666;
    transition: transform 0.3s ease;
}

.user-info:hover .profile-arrow {
    transform: rotate(180deg);
}

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

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details span {
    font-weight: 600;
    color: #333;
}

.status {
    font-size: 12px;
    color: #28a745;
}

.status.online::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 6px;
}

/* Глобальный поиск пользователей */
.global-search-box {
    padding: 15px 20px;
    position: relative;
    border-bottom: 1px solid #e9ecef;
}

.global-search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #667eea;
    border-radius: 8px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.global-search-box input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.global-search-box i {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

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

.search-result-item .user-details {
    flex: 1;
}

.search-result-item .username {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.search-result-item .status {
    font-size: 11px;
    color: #666;
}

.search-box {
    padding: 20px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
}

.search-box i {
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

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

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    animation: slideInChat 0.3s ease;
}

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

.user-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.user-item.active {
    background: rgba(102, 126, 234, 0.2);
}

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

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

.user-item-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
}

.user-item-status {
    font-size: 12px;
    color: #666;
}

/* Область чата */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.no-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.no-chat-content {
    text-align: center;
}

.no-chat-content i {
    font-size: 64px;
    color: #e9ecef;
    margin-bottom: 20px;
}

.no-chat-content h2 {
    margin-bottom: 10px;
    color: #333;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

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

.chat-user-details span {
    font-weight: 600;
    color: #333;
}

.chat-user-details small {
    font-size: 12px;
    color: #666;
}

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

.messages-container {
    flex: 1;
    padding: 15px 0px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    margin-bottom: 8px;
    align-items: flex-start;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    font-size: 0;
}

.message.sent {
    align-self: flex-end;
    align-items: flex-end;
    padding: 0;
    margin-right: 15px;
}

.message:not(.sent) {
    align-self: flex-start;
    align-items: flex-start;
    padding: 0;
    margin-left: 30px;
}

.message-content {
    background: #f8f9fa;
    padding: 10px 14px;
    border-radius: 18px;
    border-bottom-right-radius: 6px;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    max-width: fit-content;
    word-break: break-word;
    font-size: 15px;
    display: inline-block;
    margin: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.sent .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-bottom: 3px;
    align-self: flex-start;
    font-weight: 500;
}

.message.sent .message-time {
    align-self: flex-end;
}

.message-input-container {
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    flex-shrink: 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 24px;
    padding: 8px 16px;
    width: 100%;
    max-width: 800px;
}

.message-input-wrapper input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 0;
    font-size: 16px;
    outline: none;
    min-height: 40px;
    color: #333;
}

.message-input-wrapper input::placeholder {
    color: #999;
}

/* Модальное окно выбора типа создания */
.create-choice-modal {
    max-width: 500px;
    width: 90%;
}

.create-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-option {
    display: flex;
    align-items: center;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.create-option:hover {
    border-color: #5865f2;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.15);
}

.create-option .option-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    color: white;
    font-size: 24px;
}

.create-option .option-content h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #2c2f33;
}

.create-option .option-content p {
    margin: 0;
    color: #72767d;
    font-size: 14px;
    line-height: 1.4;
}

/* Модальное окно создания канала */
.channel-modal {
    max-width: 600px;
    width: 90%;
}

.channel-icon-selector {
    margin-bottom: 20px;
}

.channel-icon-selector label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #2c2f33;
}

.icon-options {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.icon-option {
    width: 50px;
    height: 50px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #72767d;
    font-size: 18px;
}

.icon-option:hover {
    border-color: #5865f2;
    color: #5865f2;
    background: #f8f9ff;
}

.icon-option.active {
    border-color: #5865f2;
    background: #5865f2;
    color: white;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

/* Профиль модальное окно */
.profile-modal {
    max-width: 400px;
    padding: 0;
    overflow: hidden;
}

/* Вкладки профиля */
.profile-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
}

.profile-tabs .tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.profile-tabs .tab.active {
    border-bottom-color: #667eea;
    color: #667eea;
}

.profile-tabs .tab:hover {
    background-color: #f8f9fa;
}

/* Контент вкладок */
.profile-content {
    max-height: 400px;
    overflow-y: auto;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* Секции друзей */
.friends-section {
    margin-bottom: 20px;
}

.friends-section h4 {
    margin-bottom: 12px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    transition: background-color 0.2s ease;
}

.friend-item:hover {
    background: #e9ecef;
}

.friend-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

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

.friend-info {
    flex: 1;
}

.friend-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.friend-status {
    font-size: 12px;
    color: #666;
}

.friend-actions {
    display: flex;
    gap: 4px;
}

.friend-action-btn {
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: #667eea;
}

.friend-action-btn:hover {
    background: #f0f2ff;
    color: #5a6fd8;
}

.friend-action-btn.btn-danger {
    color: #dc3545;
}

.friend-action-btn.btn-danger:hover {
    background: #fff5f5;
    color: #c82333;
}

.friend-action-btn.accept {
    background: #28a745;
    color: white;
}

.friend-action-btn.accept:hover {
    background: #218838;
}

.friend-action-btn.reject {
    background: #dc3545;
    color: white;
}

.friend-action-btn.reject:hover {
    background: #c82333;
}

/* Настройки */
.settings-section h4 {
    margin-bottom: 12px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.profile-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    margin: 0 auto 15px;
}

.profile-header h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
}

.profile-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.profile-actions {
    padding: 20px;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.profile-action-btn:hover {
    background: #f8f9fa;
}

.profile-action-btn i {
    width: 20px;
    color: #667eea;
}

.profile-action-btn.danger {
    color: #dc3545;
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
}

.profile-action-btn.danger i {
    color: #dc3545;
}

.profile-action-btn.danger:hover {
    background: #f8d7da;
}

.call-modal .call-info,
.incoming-call-modal .call-info {
    margin-bottom: 30px;
}

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

.call-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.call-controls button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 20px;
}

.audio-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 20px;
    color: #00aa00;
    font-size: 14px;
}

.audio-indicator i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Видео контейнер */
.video-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    height: 200px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1001;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 100px;
    height: 75px;
    border-radius: 8px;
    z-index: 1002;
}

#close-video-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    z-index: 1003;
}

/* Адаптивность */
@media (max-width: 768px) {
    .messenger-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 60vh;
    }
    
    .chat-area {
        height: 40vh;
    }
    
    .auth-box {
        padding: 30px 20px;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: fadeIn 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Стили для загрузки изображений */
.image-upload-btn {
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-upload-btn:hover {
    background-color: #3498db;
    color: white;
}

/* Модальное окно загрузки аватарки */
.avatar-upload-modal {
    max-width: 400px;
    width: 90%;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background-color: #f0f0f0;
    color: #333;
}

.avatar-upload-content {
    text-align: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #3498db;
}

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

.avatar-preview-placeholder {
    font-size: 48px;
    color: #999;
}

.upload-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.upload-controls label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Стили для изображений в сообщениях */
.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.05);
}

.message-image.fullscreen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    cursor: zoom-out;
}

/* Индикатор загрузки */
.upload-progress {
    width: 100%;
    height: 4px;
    background-color: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.upload-progress-bar {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease;
}

/* Контекстное меню для сообщений */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 10000;
    min-width: 180px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #333;
}

.context-menu-item:hover {
    background-color: #f8f9fa;
}

         .context-menu-item i {
             width: 16px;
         }

         .context-menu-item#delete-message-btn i {
             color: #dc3545;
         }

         .context-menu-item#add-friend-btn i {
             color: #28a745;
         }

         .context-menu-item#send-message-btn i {
    color: #007bff;
}

/* Панель каналов (как в Discord) */
.channels-panel {
    width: 60px;
    background: #2f3136;
    border-right: 1px solid #202225;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.channels-header {
    padding: 8px 4px;
    border-bottom: 1px solid #202225;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channels-header h3 {
    color: #dcddde;
    font-size: 10px;
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channels-list {
    flex: 1;
    padding: 8px 0;
    overflow-y: hidden;
}

.channel-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 4px auto;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: #72767d;
    background: transparent;
}

.channel-item:hover {
    background: #40444b;
    color: #dcddde;
}

.channel-item.active {
    background: #5865f2;
    color: white;
}

.channel-item i {
    font-size: 16px;
}

.channel-item .channel-name {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: #18191c;
    color: #dcddde;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.channel-item:hover .channel-name {
    opacity: 1;
}

.channel-item .channel-name::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 4px solid #18191c;
}

/* Кнопка создания группы/канала */
.create-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.create-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

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

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

/* Стили для сообщений с поддержкой контекстного меню */
.message {
    position: relative;
}

.message.sent {
    cursor: context-menu;
}

.message.sent:hover {
    background-color: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
}

/* Модальные окна групп */
.group-modal {
    max-width: 600px;
    width: 90%;
}

/* Загрузка аватара группы */
.group-avatar-upload {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
}

.group-avatar-preview {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    margin: 0 auto 15px;
    position: relative;
    overflow: hidden;
}

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

.avatar-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.avatar-upload-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* Кастомный чекбокс */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.checkbox-label:hover {
    background: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.modal-body {
    margin-bottom: 20px;
}

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

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

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

.friends-selector {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.selected-friends {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 40px;
}

.selected-friend {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.selected-friend .remove-friend {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.friends-list-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.friend-selector-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.friend-selector-item:hover {
    background: #f8f9fa;
}

.friend-selector-item.selected {
    background: #e3f2fd;
}

.friend-selector-item input[type="checkbox"] {
    margin: 0;
}

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

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

.friend-selector-item .friend-info {
    flex: 1;
}

.friend-selector-item .friend-name {
    font-weight: 500;
    color: #333;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.btn-danger:hover {
    background: #c82333;
}

/* Информация о группе */
.group-info-modal {
    max-width: 400px;
}

.group-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

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

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

.group-details h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.group-details p {
    margin: 0 0 3px 0;
    color: #666;
    font-size: 14px;
}

.group-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-actions button {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    text-align: left;
}

/* Стили для групповых элементов в списке чатов */
.group-item {
    border-left: 3px solid #667eea;
}

.group-item .user-item-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.group-item .user-item-name {
    font-weight: 600;
}

.group-item .user-item-status {
    color: #667eea;
    font-weight: 500;
}

/* Стили для отправителя в групповых сообщениях */
.message-sender {
    font-size: 12px;
    color: #667eea;
    font-weight: 500;
    margin-bottom: 2px;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Стили для участников группы */
.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
}

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

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

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.member-role {
    font-size: 12px;
    color: #667eea;
    font-weight: 500;
}

/* Стили для приглашения друзей */
.friends-invite-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
}

/* Стили для сообщений с приглашениями в канал */
.channel-invite-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 12px;
    color: white;
    margin: 8px 0;
}

/* Стили для индикатора ответа */
.reply-indicator {
    background: #2f3136;
    border-left: 3px solid #5865f2;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 4px;
    position: relative;
}

/* Тёмная тема */
body.dark-theme {
    background: #0d1117;
    color: #c9d1d9;
}

body.dark-theme .sidebar {
    background: #161b22;
    border-right: 1px solid #30363d;
}

body.dark-theme .chat-container {
    background: #0d1117;
}

body.dark-theme .chat-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    color: #c9d1d9;
}

body.dark-theme .message {
    background: #21262d;
    color: #c9d1d9;
}

body.dark-theme .message.sent {
    background: #238636;
    color: #ffffff;
}

body.dark-theme .message-input-wrapper {
    background: #161b22;
    border: 1px solid #30363d;
}

body.dark-theme .message-input-wrapper input {
    background: #161b22;
    color: #c9d1d9;
}

body.dark-theme .message-input-wrapper input::placeholder {
    color: #8b949e;
}

body.dark-theme .user-item {
    background: #161b22;
    color: #c9d1d9;
}

body.dark-theme .user-item:hover {
    background: #21262d;
}

body.dark-theme .user-item.active {
    background: #238636;
    color: #ffffff;
}

body.dark-theme .channel-item {
    color: #8b949e;
}

body.dark-theme .channel-item:hover {
    background: #21262d;
    color: #c9d1d9;
}

body.dark-theme .channel-item.active {
    background: #238636;
    color: #ffffff;
}

body.dark-theme .modal-content {
    background: #161b22;
    color: #c9d1d9;
}

body.dark-theme .context-menu {
    background: #161b22;
    border: 1px solid #30363d;
    color: #c9d1d9;
}

body.dark-theme .context-menu-item:hover {
    background: #21262d;
}

body.dark-theme .btn-primary {
    background: #238636;
    color: #ffffff;
}

body.dark-theme .btn-primary:hover {
    background: #2ea043;
}

body.dark-theme .btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

body.dark-theme .btn-secondary:hover {
    background: #30363d;
}

body.dark-theme .reply-indicator {
    background: #21262d;
    border-left: 3px solid #238636;
}

body.dark-theme .reply-text {
    color: #c9d1d9;
}

body.dark-theme .cancel-reply-btn {
    color: #8b949e;
}

body.dark-theme .cancel-reply-btn:hover {
    background: #30363d;
    color: #c9d1d9;
}

.reply-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #5865f2;
}

.reply-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 8px;
}

.reply-text {
    color: #dcddde;
    font-size: 12px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cancel-reply-btn {
    background: none;
    border: none;
    color: #72767d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    margin-left: 8px;
}

.cancel-reply-btn:hover {
    background: #40444b;
    color: #dcddde;
}

.invite-text {
    margin-bottom: 10px;
    font-size: 14px;
}

.join-channel-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.join-channel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.friend-invite-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 5px;
}

.friend-invite-item:hover {
    background: #f8f9fa;
}

.friend-invite-item input[type="checkbox"] {
    margin: 0;
}

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

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

.friend-invite-item .friend-info {
    flex: 1;
}

.friend-invite-item .friend-name {
    font-weight: 500;
    color: #333;
}
