/* ============================================================
   main-additions.css — дополнения к main.css
   Подключать ПОСЛЕ main.css:
   <link rel="stylesheet" href="/css/main-additions.css">
   ============================================================ */

/* ═══════════════════════════════════════════════════════════════
   SEND BUTTON — убираем устаревший emoji ➤
   Заменён на SVG-стрелку в index.html
═══════════════════════════════════════════════════════════════ */
.send-btn {
  width: 38px; height: 38px; border-radius: var(--r-full);
  background: var(--accent); color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  box-shadow: var(--shadow-accent);
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:active:not(:disabled) { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.4; pointer-events: none; }
.send-btn svg { pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   CHAT HEADER — три точки + dropdown
═══════════════════════════════════════════════════════════════ */
.chat-header {
  display: flex; align-items: center; gap: 8px;
  height: var(--header-h); padding: 0 10px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; background: var(--bg-surface);
}

/* Убираем старую кнопку mute — теперь она в dropdown */
#muteBtn { display: none !important; }

.chat-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-dropdown {
  position: fixed;
  z-index: 1000;
  min-width: 230px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  animation: dropdownIn var(--t-base) var(--ease-out);
  transform-origin: top right;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: scale(0.92) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 16px;
  font-size: 14px; color: var(--text-primary);
  text-align: left;
  transition: background var(--t-fast);
  border-radius: 0;
}
.chat-dropdown-item:hover { background: var(--bg-hover); }
.chat-dropdown-item:active { background: var(--bg-active); }
.chat-dropdown-item svg { color: var(--text-secondary); flex-shrink: 0; }
.chat-dropdown-item--danger { color: var(--danger); }
.chat-dropdown-item--danger svg { color: var(--danger); }

.chat-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   AVATAR — унифицированный компонент
   .avatar используется везде: sidebar, chat header, drawer, profile
═══════════════════════════════════════════════════════════════ */
.avatar {
  border-radius: var(--r-full);
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; text-transform: uppercase;
  flex-shrink: 0; user-select: none;
  position: relative; overflow: hidden;
}
.avatar--80 { width: 80px; height: 80px; font-size: 30px; }
.avatar--48 { width: 48px; height: 48px; font-size: 18px; }
.avatar--40 { width: 40px; height: 40px; font-size: 15px; }
.avatar--36 { width: 36px; height: 36px; font-size: 14px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* Цвета аватара по хэшу id */
.avatar[data-color="1"] { background: linear-gradient(135deg,#3390EC,#1A6DBB); }
.avatar[data-color="2"] { background: linear-gradient(135deg,#2DD58A,#1A9E66); }
.avatar[data-color="3"] { background: linear-gradient(135deg,#E8474A,#B83436); }
.avatar[data-color="4"] { background: linear-gradient(135deg,#F5A623,#C07800); }
.avatar[data-color="5"] { background: linear-gradient(135deg,#9B59D0,#7039A8); }
.avatar[data-color="6"] { background: linear-gradient(135deg,#E96B9D,#C04878); }

/* Online dot */
.avatar .online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg-surface);
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE AVATAR — кнопка редактирования
═══════════════════════════════════════════════════════════════ */
.profile-avatar-wrap {
  display: flex; justify-content: center;
  position: relative; width: fit-content; margin: 0 auto;
}

.avatar-edit-btn {
  position: absolute; bottom: 2px; right: 2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: background var(--t-fast), transform var(--t-fast);
  border: 2px solid var(--bg-surface);
}
.avatar-edit-btn:hover { background: var(--accent-hover); transform: scale(1.08); }
.avatar-edit-btn:active { transform: scale(0.95); }

/* ═══════════════════════════════════════════════════════════════
   CHAT LIST — аватары в списке чатов
═══════════════════════════════════════════════════════════════ */
.conv-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 1px 6px;
  border-radius: var(--r-md); cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--accent-dim); }
.conv-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* Унифицированный аватар в списке чатов */
.conv-item .avatar { width: 48px; height: 48px; font-size: 18px; }

/* ═══════════════════════════════════════════════════════════════
   ATTACHMENT PREVIEW — предпросмотр фото/видео до отправки
═══════════════════════════════════════════════════════════════ */
.attach-thumb {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  overflow: hidden; flex-shrink: 0;
  background: var(--bg-overlay);
  display: flex; align-items: center; justify-content: center;
}
.attach-thumb img,
.attach-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.attach-thumb.hidden { display: none; }

/* Показываем иконку файла только если нет превью */
#attachmentPreview .attach-icon { display: none; }
#attachmentPreview:not(:has(.attach-thumb:not(.hidden))) .attach-icon { display: block; }

/* ═══════════════════════════════════════════════════════════════
   DRAWER AVATAR — унифицирован
═══════════════════════════════════════════════════════════════ */
.drawer-avatar {
  /* размер берётся из .avatar--48 */
}

/* ═══════════════════════════════════════════════════════════════
   SPIN ANIMATION (для кнопок загрузки)
═══════════════════════════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}
