/* ---------------------------------- */
/* ЛЕВАЯ ПАНЕЛЬ (ЧАТЫ)                */
/* ---------------------------------- */
.chats-panel {
    width: 340px;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-sm);
    transition: width 0.2s ease, background 0.2s;
    will-change: width;
}
.resize-handle {
    width: 6px;
    background: var(--primary);
    cursor: ew-resize;
    position: absolute;
    right: -3px;
    top: 0;
    bottom: 0;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 4px;
}
.chats-panel:hover .resize-handle { opacity: 0.6; }
.panel-header {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    transition: transform 0.2s ease, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.user-avatar:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.btn-icon {
    background: rgba(255,255,255,0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}
.global-search {
    flex: 1;
    margin: 0 8px;
    position: relative;
}
.global-search input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}
.global-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.search-results-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}
.search-results-panel[style*="display: flex"] {
    display: flex !important;
}
.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    padding: 12px 12px 0 12px;
}
.search-tab {
    flex: 1;
    text-align: center;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-radius: 40px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.search-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}
.search-results-list {
    padding: 0 12px 12px 12px;
    max-height: 300px;
    overflow-y: auto;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.search-result-item:hover {
    background: var(--bg-elevated);
    transform: translateX(4px);
}
.chats-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 8px 4px;
}
.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: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
    position: relative;
}
.chat-item:hover {
    background: var(--bg-elevated);
    transform: translateX(4px);
}
.chat-item.active {
    background: var(--bg-elevated);
    border-left: 4px solid var(--primary);
}
.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;
}
.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 {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.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);
}
.mobile-chats-toggle {
    display: none !important;
}