/* css/style.css - Trello Style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f4f5f7;
    color: #172b4d;
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

div {
    box-sizing: border-box;
}

a {
    color: #0052cc;
}

.message-link:hover {
    color: #0065ff;
    text-decoration: underline;
}

a:visited {
    color: #5d92e1; /* Фиолетовый для посещенных ссылок */
    border-bottom-color: rgba(124, 58, 237, 0.3);
}

/* Страницы входа - Trello style */
.page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #0052cc 0%, #0065ff 100%);
}

.login-container {
    background: #ffffff;
    padding: 40px 32px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 380px;
    transition: transform 0.2s;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 28px;
    color: #172b4d;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.login-container h1 span {
    color: #0052cc;
}

.login-container input {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: #fafbfc;
    border: 2px solid #dfe1e6;
    border-radius: 4px;
    color: #172b4d;
    font-size: 14px;
    transition: all 0.2s;
}

.login-container input:focus {
    outline: none;
    border-color: #0052cc;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.login-container button {
    width: 100%;
    padding: 10px;
    background: #0052cc;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.login-container button:hover {
    background: #0065ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
}

.link {
    text-align: center;
    margin-top: 16px;
    color: #0052cc;
    cursor: pointer;
    font-size: 13px;
    transition: color 0.2s;
}

.link:hover {
    color: #0065ff;
    text-decoration: underline;
}

/* Основное приложение - Trello layout */
#app {
    display: flex;
    height: 100vh;
    background: #f4f5f7;
}

/* Боковая панель - Trello style */
.sidebar {
    width: 240px;
    background: #ffffff;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #dfe1e6;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #dfe1e6;
    margin-bottom: 16px;
}

.user-info span {
    font-weight: 600;
    color: #172b4d;
    font-size: 14px;
}

.user-info button {
    padding: 4px 12px;
    background: #ebecf0;
    color: #172b4d;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}

.user-info button:hover {
    background: #dfe1e6;
}

.channels, .users {
    flex: 1;
    overflow-y: auto;
    padding: 0 4px;
}

.channels h3, .users h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: #6b778c;
    letter-spacing: 0.6px;
    margin: 12px 0 6px 8px;
    font-weight: 600;
}

.channel-item, .user-item {
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    color: #172b4d;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-item:hover, .user-item:hover {
    background: #ebecf0;
}

.channel-item.active {
    background: #0052cc;
    color: white;
    font-weight: 500;
}

.channel-item.active:hover {
    background: #0065ff;
}

.user-item .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.user-item .status-dot.online {
    background: #36b37e;
}

.user-item .status-dot.offline {
    background: #97a0af;
}

/* Основная область - Trello style */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f4f5f7;
}

/* ========== ПОИСК ========== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #ffffff;
    border-bottom: 1px solid #dfe1e6;
    min-height: 56px;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

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

.search-input {
    padding: 6px 32px 6px 36px;
    background: #f0f2f5;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 13px;
    color: #172b4d;
    transition: all 0.3s;
    width: 180px;
}

.search-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #0052cc;
    width: 220px;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

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

.search-icon {
    position: absolute;
    left: 10px;
    font-size: 14px;
    color: #6b778c;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #6b778c;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
}

.search-clear:hover {
    color: #172b4d;
}

/* РЕЗУЛЬТАТЫ ПОИСКА - ИСПРАВЛЕННЫЙ БЛОК */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    width: 500px;
    max-height: 400px;
    overflow: hidden;
    z-index: 999;
    border: 1px solid #dfe1e6;
    display: none;
}

.search-results.visible {
    display: block !important;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #dfe1e6;
    font-weight: 600;
    color: #172b4d;
}

.search-results-header button {
    background: none;
    border: none;
    color: #6b778c;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
}

.search-results-header button:hover {
    color: #172b4d;
}

#searchResultsList {
    padding: 8px 0;
    overflow-y: auto;
    max-height: 350px;
}

.search-result-item {
    display: flex;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f2f5;
}

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

.search-result-item .search-avatar {
    flex-shrink: 0;
}

.search-result-item .search-content {
    flex: 1;
    min-width: 0;
}

.search-result-item .search-username {
    font-weight: 600;
    color: #0052cc;
    font-size: 13px;
}

.search-result-item .search-text {
    font-size: 13px;
    color: #172b4d;
    word-wrap: break-word;
    word-break: break-word;
}

.search-result-item .search-text .search-highlight {
    background: #fef9c3;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-result-item .search-time {
    font-size: 11px;
    color: #6b778c;
}

.search-result-item .search-channel {
    font-size: 11px;
    color: #6b778c;
    background: #f0f2f5;
    padding: 1px 8px;
    border-radius: 10px;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #6b778c;
    font-size: 14px;
}
.header h2 {
    color: #172b4d;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}
/*
.header h2::before {
    content: '# ';
    color: #6b778c;
    font-weight: 400;
}*/

#typingIndicator {
    font-size: 13px;
    color: #6b778c;
    font-style: italic;
}

/* Сообщения - Trello cards style */
.messages {
    flex: 1;
    padding:0 24px 16px 24px;
    overflow-y: auto;
    background: #f4f5f7;
}

.message {
    margin-bottom: 10px;
    max-width: 80%;
}

.message:hover {
    border-color: #b3bac5;
}

.message.self {
    margin-left: auto;
}

.message .username {
    /*font-weight: 600;
    color: #0052cc;*/
    margin-right: 6px;
    font-size: 12px;
    display: inline-block;
    background: url(https://cdn-icons-png.flaticon.com/128/456/456283.png) no-repeat 6px 5px #f2f2f2;
    background-size: 12px;
    padding: 3px 9px 3px 23px;
    border-radius: 5px;
    border: 1px solid #e5e5e5;
}

.message.self .username {
    color: rgba(255,255,255,0.9);
    color: #333;
    border: 1px solid #c3d1e9;
    background: url(https://cdn-icons-png.flaticon.com/128/456/456283.png) no-repeat 6px 5px #d7e4fb;
    background-size: 12px;
}

.message .time {
    font-size: 11px;
    color: #6b778c;
    margin-left: 6px;
}

.message.self .time {
    /*color: rgba(255,255,255,0.7);*/
    color: black;
}

.message.self .message-content {
    margin-left: auto;
    background: #0052cc;
    border-color: #0052cc;
    color: white;

    background: rgba(101, 149, 246, 0.11);
    border-color: rgba(135, 160, 212, 0.18);

    background: #e4f7ed;
    border-color: rgba(217, 238, 228, 1);

    color: black;
}

.message-content-info {
    display: flex;
    justify-content: space-between;
}



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

/* Индикатор печатания */
#typingIndicator {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Скролл - Trello style */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: #f4f5f7;
}

.messages::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #97a0af;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #dfe1e6;
    border-radius: 4px;
}

/* Input area - Trello style */
.input-area {
    padding: 12px 24px 16px;
    background: #ffffff;
    border-top: 1px solid #dfe1e6;
}

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

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

#messageInput {
    flex: 1;
    padding: 8px 12px;
    background: #fafbfc;
    border: 2px solid #dfe1e6;
    border-radius: 4px;
    color: #172b4d;
    font-size: 14px;
    transition: all 0.2s;
}

.input-group input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    background: #fafbfc;
    border: 2px solid #dfe1e6;
    border-radius: 4px;
    color: #172b4d;
    font-size: 14px;
    transition: all 0.2s;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: #0052cc;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.icon-btn {
    padding: 5px 10px;
    background: #fafbfc;
    border: px solid #dfe1e6;
    border-radius: 4px;
    color: #42526e;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.icon-btn:hover {
    background: #ebecf0;
    border-color: #b3bac5;
}

.input-group button[type="submit"] {
    padding: 8px 20px;
    background: #0052cc;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.input-group button[type="submit"]:hover {
    background: #0065ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.2);
}

.input-group button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Файлы - Trello attachments */
.file-preview {
    padding: 6px 12px;
    background: #fafbfc;
    border: 1px solid #dfe1e6;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #172b4d;
}

.file-preview button {
    background: #ebecf0;
    color: #172b4d;
    border: none;
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.file-preview button:hover {
    background: #dfe1e6;
}

.file-attachments {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-image-wrapper {
    margin-top: 4px;
}

.file-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #dfe1e6;
    transition: all 0.2s;
}

.file-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.file-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #fafbfc;
    border: 1px solid #dfe1e6;
    border-radius: 4px;
    font-size: 13px;
}

.message.self .file-attachment {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);

    background: rgba(255,255,255,0.12);
    border-color: rgba(171, 169, 169, 0.2);
}

.file-attachment a {
    color: #0052cc;
    text-decoration: none;
    display: inline-flex;
    word-break: break-all;
    align-items: flex-start;
}

.file-attachment img {
    display: inline-block;
    margin: 0 5px 0 0;
}

.message.self .file-attachment a {
    /*color: #ffffff;
    color: #4a4848;*/
    word-break: break-all;
}

.file-attachment a:hover {
    text-decoration: underline;
}

.file-size {
    font-size: 11px;
    color: #6b778c;
    color: black;
}

.message.self .file-size {
    color: rgba(255,255,255,0.7);
    color: black;
}

/* Реакции - Trello style */

.message .reaction {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    background: #fafbfc;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #dfe1e6;
}

.message .reaction:hover {
    background: #ebecf0;
}

.message .reaction.active {
    border-color: #0052cc;
    background: rgba(0, 82, 204, 0.08);
}

.message .reaction .count {
    font-size: 11px;
    color: #6b778c;
}

.message.self .reaction {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.message.self .reaction .count {
    color: rgba(255,255,255,0.7);
}

.reaction-add button {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.reaction-add button:hover {
    background: #ebecf0;
    color: #0052cc;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 180px;
        padding: 12px 8px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .login-container {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .header h2 {
        font-size: 16px;
    }
    
    .input-group input[type="text"] {
        font-size: 13px;
        padding: 6px 10px;
    }
}

/* Уведомления на каналах */
.notification-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #0052cc;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.channel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    color: #172b4d;
    font-size: 14px;
}

.channel-item:hover {
    background: #ebecf0;
}

.channel-item.active {
    background: #0052cc;
    color: white;
    font-weight: 500;
}

.channel-item.active:hover {
    background: #0065ff;
}


/* Аватарки */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-user {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-avatar {
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    animation: fadeIn 0.25s ease-in;
    /*box-shadow: 0 1px 2px rgba(0,0,0,0.08);*/
    border: 1px solid #dfe1e6;
    transition: border-color 0.2s;
    padding: 16px 20px;
    background: #ffffff;
    border-radius: 20px;
}

.message-content-info {
    display: flex;
    justify-content: space-between;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
}

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

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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


/* Аватарки с инициалами - постоянные цвета */
.avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-initials-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar-initials-user {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    text-transform: uppercase;
    margin-right: 8px;
}

/* Обновленные стили для сообщений */
.message {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-avatar {
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message.self .avatar-initials {
    background: #0052cc !important;
}

/* Обновленные стили для списка пользователей */
.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
}

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

/* Обновленные стили для user-info */
.user-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar-user {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Ответы */
.message-actions {
    margin-top: 4px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.reply-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.reply-btn:hover {
    background: #ebecf0;
    color: #0052cc;
}

.replies-count {
    font-size: 12px;
    color: #6b778c;
}

.replies-container {
    margin-left: 80px;
    margin-top: 6px;
    padding-left: 16px;
    border: 1px solid #f7d9c5;
    background: rgba(249, 236, 227, 0.61);
    border-radius: 8px;
    padding: 8px 12px;
    border-left: 4px solid #f7bf99;
    background: rgba(249, 236, 227, 0.61);
    max-width: calc(80% - 80px);
}

.reply {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    align-items: flex-start;
}

.reply .reply-content {
    flex: 1;
    font-size: 13px;
}

.reply .reply-content .username {
    font-weight: 600;
    color: #0052cc;
    margin-right: 4px;
}

.reply .reply-content .time {
    font-size: 11px;
    color: #6b778c;
    margin-left: 4px;
}

/* Индикатор ответа */
#replyIndicator {
    display: none;
    padding: 8px 12px;
    background: #f0f2f5;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#replyIndicator .reply-to {
    font-size: 13px;
    color: #172b4d;
}

#replyIndicator .reply-to strong {
    color: #0052cc;
}

.cancel-reply {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    font-size: 16px;
    padding: 0 8px;
}

.cancel-reply:hover {
    color: #172b4d;
}

/* Стили для ответов - как в Slack */
.message-wrapper {
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f2f5;
    padding-bottom: 8px;
}

.message-wrapper:last-child {
    border-bottom: none;
}

.message {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 4px 0;
}

.message-avatar {
    flex-shrink: 0;
    margin-top: 2px;
}

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

.message-actions {
    margin-top: 4px;
    display: flex;
    gap: 12px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-wrapper:hover .message-actions {
    opacity: 1;
}

.reply-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.reply-btn:hover {
    background: #ebecf0;
    color: #0052cc;
}

.replies-count {
    font-size: 12px;
    color: #6b778c;
    cursor: pointer;
}

.replies-count:hover {
    color: #0052cc;
    text-decoration: underline;
}



/* Отдельный ответ */
.reply {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    align-items: flex-start;
    border-bottom: 1px solid #f0f2f5;
}

.reply:last-child {
    border-bottom: none;
}

.reply-avatar {
    flex-shrink: 0;
}

.reply-content {
    flex: 1;
    font-size: 13px;
}

.reply-content .username {
    font-weight: 600;
    color: #0052cc;
    margin-right: 4px;
}

.reply-content .message-text {
    word-break: break-word;
}

.reply-content .time {
    font-size: 11px;
    color: #6b778c;
    margin-left: 6px;
}

/* Индикатор ответа в поле ввода */
#replyIndicator {
    display: none;
    padding: 10px 14px;
    background: #f0f5ff;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #0052cc;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#replyIndicator .reply-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

#replyIndicator .reply-label {
    font-size: 11px;
    color: #6b778c;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#replyIndicator .reply-original {
    font-size: 13px;
    color: #172b4d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#replyIndicator .reply-original strong {
    color: #0052cc;
}

.cancel-reply {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.cancel-reply:hover {
    color: #e74c3c;
}

/* Кнопка создания канала */
.create-channel-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    background: transparent;
    border: 1px dashed #dfe1e6;
    border-radius: 4px;
    color: #6b778c;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.create-channel-btn:hover {
    background: #f4f5f7;
    border-color: #0052cc;
    color: #0052cc;
}

/* Кнопка удаления */
.delete-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Модальное окно */
#createChannelModal {
    display: none;
}

#createChannelModal.show {
    display: flex !important;
}

/* Модальное окно */
#createChannelModal {
    display: none;
}

#createChannelModal.show {
    display: flex !important;
}

/* Кнопка удаления ответа */
.delete-reply-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.2s;
    margin-left: 4px;
}

.delete-reply-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.reply-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.reply-content .username {
    font-weight: 600;
    color: #0052cc;
    margin-right: 4px;
}

.reply-content .message-text {
    word-break: break-word;
}

.reply-content .time {
    font-size: 11px;
    color: #6b778c;
    margin-left: 4px;
}

/* ========== МОБИЛЬНАЯ КНОПКА МЕНЮ ========== */
.mobile-menu-toggle {
    display: none; 
    z-index: 200;
    background: #0052cc;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: #0065ff;
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Оверлей для мобильного меню */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.user_info {
    font-weight: 600;
    color: #0052cc;
    margin-right: 4px;
}

/* ========== РЕАКЦИИ (ЭМОДЗИ) ========== */

.reactions-container {
    margin-top: 6px;
}

.reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: end;
    margin-top: 6px;
    width: 80%;
}

.message.self .reactions {
    width: 100%
}


.reactions-container.self .reactions {
    width: 100%;
}


.reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px 2px 8px;
    background: #f0f2f5;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    user-select: none;
}

.reaction:hover {
    background: #e4e6eb;
    transform: scale(1.05);
}

.reaction.active {
    border-color: #0052cc;
    background: #e8f0fe;
}

.reaction .count {
    font-size: 12px;
    color: #6b778c;
    font-weight: 500;
}

.reaction.active .count {
    color: #0052cc;
}

/* Кнопка реакций */
.reaction-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.reaction-btn:hover {
    background: #ebecf0;
    transform: scale(1.1);
}

/* Попап с эмодзи */
.emoji-picker-popup {
    position: fixed;
    background: #ffffff;
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border: 1px solid #dfe1e6;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.emoji-picker-popup .emoji-option {
    font-size: 28px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: all 0.15s;
}

.emoji-picker-popup .emoji-option:hover {
    background: #f0f2f5;
    transform: scale(1.2);
}

/* Мобильные стили для реакций */
@media (max-width: 768px) {
    .reaction {
        font-size: 13px;
        padding: 1px 8px 1px 6px;
    }
    
    .reaction .count {
        font-size: 11px;
    }
    
    .emoji-picker-popup {
        padding: 6px 8px;
        grid-template-columns: repeat(5, 1fr);
        gap: 2px;
    }
    
    .emoji-picker-popup .emoji-option {
        font-size: 24px;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .emoji-picker-popup {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Анимация для реакций */
@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.reaction.just-added {
    animation: popIn 0.3s ease;
}

/* Стили для превью файлов */
.file-preview {
    padding: 8px 12px;
    background: #fafbfc;
    border: 1px solid #dfe1e6;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #172b4d;
    margin-top: 8px;
}

.file-preview .file-name {
    background: #ebecf0;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.file-preview .file-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    width: 100%;
}

.file-preview .file-thumbnails img {
    max-height: 50px;
    max-width: 70px;
    border-radius: 4px;
    border: 1px solid #dfe1e6;
    object-fit: cover;
}

.message-content .message-text {
    word-break: break-all;
    margin-top: 10px;
}

/* Кнопка закрепления */
.pin-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.pin-btn:hover {
    background: #ebecf0;
    color: #f59e0b;
    transform: scale(1.1);
}

.pin-btn.pinned {
    color: #f59e0b;
}


/* ========== ЗАКРЕПЛЕННЫЕ СООБЩЕНИЯ ========== */

/* ========== ЗАКРЕПЛЕННЫЕ СООБЩЕНИЯ - ЛИПКИЙ БЛОК ========== */

.pinned-messages-section {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 8px 0;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #f59e0b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    backdrop-filter: blur(8px);
    max-height: 200px;
    overflow-y: auto;
}

.pinned-messages-section .pinned-header {
    padding: 6px 16px 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b778c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 11;
    border-radius: 8px 8px 0 0;
}

.pinned-messages-section .pinned-message-wrapper {
    padding: 4px 16px;
    border-bottom: 1px solid #f0f2f5;
}

.pinned-messages-section .pinned-message-wrapper:last-child {
    border-bottom: none;
}

.pinned-messages-section .pinned-message-wrapper .message {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px 0 !important;
}

.pinned-messages-section .pinned-message-wrapper .message-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 13px;
}

.pinned-messages-section .pinned-message-wrapper .message-avatar .avatar,
.pinned-messages-section .pinned-message-wrapper .message-avatar .avatar-initials {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
}

.pinned-messages-section .pinned-message-wrapper .pinned-badge {
    font-size: 12px;
    color: #f59e0b;
}

/* Индикатор, что есть закрепленные */
.pinned-indicator-bar {
    position: sticky;
    top: 0;
    z-index: 9;
    background: #fef3c7;
    padding: 4px 16px;
    font-size: 12px;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
}

.pinned-indicator-bar:hover {
    background: #fde68a;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .pinned-messages-section {
        max-height: 150px;
    }
    
    .pinned-messages-section .pinned-message-wrapper .message-content {
        font-size: 12px;
    }
    
    .pinned-messages-section .pinned-message-wrapper .message-avatar .avatar,
    .pinned-messages-section .pinned-message-wrapper .message-avatar .avatar-initials {
        width: 20px !important;
        height: 20px !important;
        font-size: 9px !important;
    }
}

/* Скрываем скролл у закрепленных */
.pinned-messages-section::-webkit-scrollbar {
    width: 4px;
}

.pinned-messages-section::-webkit-scrollbar-track {
    background: transparent;
}

.pinned-messages-section::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.pinned-messages-section::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========== ЗАКРЕПЛЕННЫЕ СООБЩЕНИЯ ========== */

/* Контейнер для закрепленных - привязан к верху */
.pinned-wrapper {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f4f5f7;
    padding: 0 0 0 0;
    margin: 10px 0 8px 0;
}

/* Шапка закрепленных */
.pinned-header-bar {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-left: 3px solid #f59e0b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    user-select: none;
}

.pinned-header-bar:hover {
    background: #f0f0f0;
}

.pinned-header-bar .pinned-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #172b4d;
}

.pinned-header-bar .pinned-label .pin-icon {
    color: #f59e0b;
}

.pinned-header-bar .pinned-count {
    font-size: 12px;
    color: #6b778c;
    background: #e5e7eb;
    padding: 1px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.pinned-header-bar .pinned-toggle {
    font-size: 14px;
    color: #6b778c;
    transition: transform 0.3s ease;
    display: inline-block;
}

.pinned-header-bar .pinned-toggle.open {
    transform: rotate(180deg);
}

/* Контейнер с закрепленными сообщениями */
.pinned-messages-container {
    background: rgb(250, 251, 252);
    border: 1px solid rgb(229, 231, 235);
    /* border-style: none solid solid; */
    /* border-color: currentcolor rgb(229, 231, 235) rgb(229, 231, 235); */
    border-image: none;
    border-radius: 0px 0px 8px 8px;
    overflow: hidden;
    max-height: 0px;
    opacity: 0;
    transition: max-height 0.3s, opacity 0.3s;
    border-radius: 10px;
    margin-top: 6px;
}

.pinned-messages-container.open {
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
}

/* Элемент закрепленного сообщения */
.pinned-message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 13px 16px;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: rgb(236, 236, 211);
    cursor: pointer;
    transition: background 0.15s;
    background: rgb(250, 250, 230);
}

.pinned-message-wrapper:hover {
    background: rgba(245, 158, 11, 0.08);
}

.pinned-message-wrapper:last-child {
    border-bottom: none;
}

.pinned-message-wrapper .message {
    flex: 1;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    gap: 6px;
}

.pinned-message-wrapper .message-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    font-size: 13px;
}

.pinned-message-wrapper .message-avatar .avatar,
.pinned-message-wrapper .message-avatar .avatar-initials {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
}

.pinned-message-wrapper .message-actions {
    display: none !important;
}

.pinned-badge {
    font-size: 14px;
    color: #f59e0b;
    flex-shrink: 0;
    padding-top: 4px;
    width: 24px;
    text-align: center;
}

.pinned-info {
    font-size: 11px;
    color: #6b778c;
    margin-top: 2px;
}

/* Индикатор закрепления в сообщении */
.message-pinned-indicator {
    font-size: 11px;
    color: #f59e0b;
    margin-bottom: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Скролл для контейнера */
.pinned-messages-container::-webkit-scrollbar {
    width: 4px;
}

.pinned-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.pinned-messages-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.pinned-messages-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========== АДАПТИВ ========== */

@media (max-width: 768px) {
    .pinned-header-bar {
        padding: 6px 12px;
    }
    
    .pinned-header-bar .pinned-label {
        font-size: 12px;
    }
    
    .pinned-message-wrapper {
        padding: 4px 12px;
    }
    
    .pinned-message-wrapper .message-content {
        font-size: 12px;
    }
    
    .pinned-messages-container.open {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .pinned-message-wrapper {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pinned-badge {
        width: 100%;
        text-align: left;
        font-size: 12px;
        padding-top: 0;
    }
    
    .pinned-message-wrapper .message-avatar {
        display: none;
    }
}

/* ========== КНОПКА ЗАКРЕПЛЕНИЯ ========== */

.pin-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.pin-btn:hover {
    background: #ebecf0;
    color: #f59e0b;
    transform: scale(1.1);
}

.pin-btn.pinned {
    color: #f59e0b;
}

.pin-btn.pinned:hover {
    background: #fef3c7;
    color: #d97706;
}

.message-wrapper.pinned-message {
    border-left: 3px solid #f59e0b;
    padding-left: 8px;
    background: rgba(245, 158, 11, 0.03);
    border-radius: 4px;
}

/* ========== АДАПТИВ ========== */

@media (max-width: 768px) {
    .pinned-header-bar {
        padding: 6px 12px;
    }
    
    .pinned-header-bar .pinned-label {
        font-size: 12px;
    }
    
    .pinned-message-wrapper {
        padding: 4px 12px;
    }
    
    .pinned-message-wrapper .message-content {
        font-size: 12px;
    }
    
    .pinned-messages-container.open {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .pinned-message-wrapper {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pinned-badge {
        width: 100%;
        text-align: left;
        font-size: 12px;
        padding-top: 0;
    }
    
    .pinned-message-wrapper .message-avatar {
        display: none;
    }
}

/* ========== TOAST ========== */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #172b4d;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== РЕДАКТИРОВАНИЕ ========== */

.edit-btn {
    background: transparent;
    border: none;
    color: #6b778c;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
}

.edit-btn:hover {
    background: #ebecf0;
    color: #0052cc;
    transform: scale(1.1);
}

.edited-badge {
    font-size: 11px;
    color: #6b778c;
    font-style: italic;
    margin-left: 4px;
}

.message.self .edited-badge {
    color: rgba(255, 255, 255, 0.7);
}

.edit-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.edit-input {
    width: 100%;
    padding: 8px 12px;
    background: #ffffff;
    border: 2px solid #0052cc;
    border-radius: 4px;
    color: #172b4d;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 40px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

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

.edit-save-btn {
    padding: 4px 16px;
    background: #0052cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.edit-save-btn:hover {
    background: #0065ff;
    transform: scale(1.02);
}

.edit-cancel-btn {
    padding: 4px 16px;
    background: #ebecf0;
    color: #172b4d;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.edit-cancel-btn:hover {
    background: #dfe1e6;
}

/* ========== АНИМАЦИЯ ПОДСВЕТКИ ========== */

@keyframes highlightFade {
    0% { background: #fef9c3; }
    100% { background: transparent; }
}

.message-wrapper.highlight {
    animation: highlightFade 2s ease-out;
}



/* ========== НЕПРОЧИТАННЫЕ СООБЩЕНИЯ ========== */

.message-wrapper.unread .message-content {
    background: #ebf5ff !important;
    border-left: 3px solid #0052cc !important;
}

.message-wrapper.unread.self .message-content {
    background: #dbeafe !important;
    border-left: 3px solid #0052cc !important;
}

/* Анимация для новых непрочитанных */
.message-wrapper.unread {
    animation: highlightNew 0.5s ease;
}

@keyframes highlightNew {
    0% {
        background: rgba(0, 82, 204, 0.1);
    }
    100% {
        background: transparent;
    }
}

/* Разделитель непрочитанных */
.unread-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    margin: 8px 0;
    color: #0052cc;
    font-size: 12px;
    font-weight: 600;
}

.unread-divider::before,
.unread-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #0052cc;
}

/* Бейдж непрочитанных в канале */
/*
.channel-item .unread-badge {
    background: #0052cc;
    color: white;
    border-radius: 50%;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    animation: pulse 1.5s infinite;
}*/

.unread-badge {
    background: #0052cc;
    color: white;
    border-radius: 50%;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    margin-left: auto;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Индикатор новых сообщений */
.new-messages-indicator {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: #0052cc;
    color: white;
    text-align: center;
    padding: 6px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}

.new-messages-indicator.show {
    opacity: 1;
}

.new-messages-indicator:hover {
    background: #0065ff;
}