/* Стили для списка чатов */

.chat-list-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--background);
}

.chat-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--spacing-lg);
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
    gap: var(--spacing-md);
}

.chat-list-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* Поиск */
.chat-topbar-search {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
}

.chat-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-secondary);
    flex-shrink: 0;
}

.chat-search-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
}

.chat-search-input::placeholder {
    color: var(--text-secondary);
}

.chat-search-clear {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: var(--icon-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.chat-search-clear.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.chat-search-clear:hover {
    background: rgba(255, 255, 255, 0.18);
}

.chat-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 5;
}

.chat-search-dropdown.open {
    display: flex;
}

.search-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--muted-foreground);
}

.search-user-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-radius: var(--radius);
}

.search-user-item:hover {
    background: var(--muted);
}

/* Список чатов */
.chat-list {
    flex: 1;
    overflow-y: auto;
    background: var(--background);
    padding: var(--spacing-sm);
}

.chat-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    min-height: 300px;
    color: var(--muted-foreground);
}

/* Элемент чата */
.chat-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: 1px solid transparent;
    border-radius: var(--radius);
    margin-bottom: var(--spacing-sm);
}

.chat-item:hover {
    background: var(--muted);
}

.chat-item:active {
    background: var(--secondary);
}

.chat-item-blocked {
    background: rgba(255, 80, 80, 0.04);
}

.chat-item-blocked:hover {
    background: rgba(255, 80, 80, 0.06);
}

/* Аватар */
.chat-avatar {
    position: relative;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: var(--secondary);
}

.status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--card);
    background: var(--offline);
}

.status-indicator.online {
    background: var(--online);
    box-shadow: 0 0 8px var(--online);
}

.status-indicator.offline {
    background: var(--offline);
}

/* Информация о чате */
.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 0;
    width: 100%;
}

.chat-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.chat-item-blocked .chat-name {
    color: rgba(255, 80, 80, 0.9);
}

.chat-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--icon-secondary);
    flex-shrink: 0;
}

.chat-meta-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-blocked-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    color: rgba(255, 80, 80, 0.9);
    flex-shrink: 0;
}

.chat-blocked-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.verified-badge {
    display: inline-flex;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
    flex-shrink: 0;
}

.verified-badge::after {
    content: '';
    position: absolute;
    inset: 3px 4px 4px 3px;
    border: 2px solid white;
    border-top: none;
    border-right: none;
    transform: rotate(-45deg);
}

.chat-message {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.chat-item-blocked .chat-message {
    color: rgba(255, 80, 80, 0.55);
}

.chat-time {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-item-blocked .chat-time {
    color: rgba(255, 80, 80, 0.55);
}

/* Бейдж непрочитанных */
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-foreground);
    background: var(--primary);
    border-radius: 10px;
    flex-shrink: 0;
}

/* Контекстное меню чатов */
.chat-context-menu {
    position: fixed;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 10000;
    min-width: 220px;
    max-width: 260px;
}

.chat-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.chat-confirm-dialog {
    width: min(90vw, 360px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-lg);
}

.chat-confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-confirm-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chat-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.chat-context-item {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-context-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chat-context-item:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.99);
}

.chat-context-item.is-danger {
    color: var(--destructive);
}

.chat-context-item.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-context-item.is-danger .chat-context-icon {
    color: var(--destructive);
}

.chat-context-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: currentColor;
}

.chat-context-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-context-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-context-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Красивый фон верхнего блока */
.chat-list-header {
    background: linear-gradient(180deg, var(--card) 0%, rgba(0,0,0,0) 100%);
}

/* Адаптивность */
@media (max-width: 768px) {
    .chat-list-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .chat-item {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .chat-avatar {
        width: 40px;
        height: 40px;
    }
}


