/* ---------------------------------- */
/* СПИСОК ЧАТОВ                       */
/* ---------------------------------- */

.chats-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    min-height: 0;
    padding: 8px 8px 16px 8px;
    touch-action: pan-y;
}

.empty-chats {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
    position: relative;
    background: transparent;
}

.chat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 60px;
    right: 12px;
    height: 1px;
    background: var(--border);
    opacity: 0.5;
}

.chat-item:hover {
    background: var(--bg-elevated);
    transform: translateX(2px);
}

.chat-item.active {
    background: rgba(76, 154, 255, 0.15);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    background-size: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    position: relative;
    flex-shrink: 0;
}

.chat-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.chat-name-text {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.chat-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
    align-self: flex-start;
    margin-top: 2px;
}

.unread-badge {
    background: var(--primary);
    color: white;
    border-radius: 20px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    line-height: 20px;
    box-shadow: 0 0 4px var(--primary-glow);
    flex-shrink: 0;
}

/* Индикатор печати в списке чатов */
.chat-preview.typing {
    color: var(--primary);
    font-style: italic;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}