/* Контекстное меню для чатов и сообщений */
.tg-context-menu-chat,
.tg-context-menu-message {
    position: absolute;
    z-index: 9999;
    min-width: 180px;
    background: var(--bg-secondary, #23272b);
    border: 1px solid var(--border-color, #444);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
    padding: 6px 0;
    display: none;
    font-size: 15px;
    color: var(--text-primary, #fff);
    animation: fadeInMenu 0.15s;
}
.tg-context-menu-chat.active,
.tg-context-menu-message.active {
    display: block;
}
.tg-context-menu-chat .tg-context-menu-item,
.tg-context-menu-message .tg-context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.tg-context-menu-chat .tg-context-menu-item:hover,
.tg-context-menu-message .tg-context-menu-item:hover {
    background: var(--hover-color, #2a2e33);
}
.tg-context-menu-chat .tg-context-menu-item i,
.tg-context-menu-message .tg-context-menu-item i {
    min-width: 18px;
    text-align: center;
}
@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tg-chat-item.pinned {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-color);
}

.tg-chat-item.pinned:hover {
    background: var(--hover-color);
}

.tg-pinned-chats {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.tg-pinned-chats::before {
    content: 'Закрепы';
    display: block;
    padding: 0 16px 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.tg-all-chats-header {
    padding: 0 16px 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.tg-chat-item.pinned .tg-chat-meta {
    position: relative;
    padding-left: 20px;
}

.tg-chat-item.pinned .tg-chat-meta::before {
    content: '\f08d';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-color);
    font-size: 12px;
}

.tg-user-info-section {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.tg-user-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tg-user-info-item:last-child {
    margin-bottom: 0;
}

.tg-user-info-label {
    color: var(--tg-text-secondary);
    font-size: 14px;
}

.tg-user-info-value {
    color: var(--tg-text-primary);
    font-size: 14px;
}

.tg-user-id {
    cursor: pointer;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    user-select: all;
}

.tg-user-id:hover {
    background: var(--hover-color);
    border-color: var(--accent-color);
}

.tg-user-id.copied {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.tg-user-info-main {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.tg-user-info-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
}

.tg-user-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-user-info-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tg-user-info-username {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tg-user-info-bio {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    max-width: 300px;
    margin: 0 auto;
}

.tg-message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.tg-message-counter {
    position: absolute;
    right: 12px;
    bottom: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.2s ease;
}

.tg-message-form {
    position: relative;
}

.tg-chat-message {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Make sure it takes full width */
}