/* ============================================================
   КНОПКИ
   ============================================================ */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--ease);
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--txt2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg3); color: var(--txt); }

/* ============================================================
   APP CONTAINER
   ============================================================ */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg3);
}

/* ============================================================
   БОКОВАЯ НАВИГАЦИЯ
   ============================================================ */
.sidebar-nav {
  width: var(--nav-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  flex-shrink: 0;
  z-index: 10;
}

.nav-top, .nav-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 0 8px;
}
.nav-top { flex: 1; }

.nav-logo {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.nav-logo-img {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  object-fit: cover;
  display: block;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--txt2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--ease);
  flex-shrink: 0;
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn:hover { background: var(--bg3); color: var(--txt); }
.nav-btn.active { background: var(--accent-light); color: var(--accent); }

.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg2);
}

/* Аватар / меню пользователя */
.user-menu { position: relative; width: 100%; display: flex; justify-content: center; padding: 0 8px; }

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--ease);
  flex-shrink: 0;
}
.nav-avatar:hover { transform: scale(1.08); }

.user-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 8px;
  width: 220px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 100;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
}

.dropdown-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--txt);
}

.dropdown-handle {
  font-size: 12px;
  color: var(--txt3);
  margin-top: 1px;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--txt);
  font-size: 13.5px;
  text-align: left;
  transition: background var(--ease);
}
.dropdown-item:hover { background: var(--bg3); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { flex-shrink: 0; }

/* ============================================================
   ПАНЕЛЬ КОНТЕНТА (sidebar-content)
   ============================================================ */
.content-panel {
  width: var(--panel-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--txt);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  transition: background var(--ease);
}
.search-box svg { color: var(--txt3); flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 13.5px;
  color: var(--txt);
}
.search-input::placeholder { color: var(--txt3); }

.panel-list {
  flex: 1;
  overflow-y: auto;
}

/* Элементы списка */
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--ease);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.list-item:hover { background: var(--bg2); }
.list-item.active { background: var(--accent-light); }

.item-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}
.item-avatar.group { border-radius: var(--r-sm); }

.item-body {
  flex: 1;
  min-width: 0;
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.item-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-time {
  font-size: 11px;
  color: var(--txt3);
  flex-shrink: 0;
  margin-left: 6px;
}

.item-sub {
  font-size: 13px;
  color: var(--txt2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
}

.item-sub-you {
  color: var(--txt3);
  flex-shrink: 0;
}

.item-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}
.item-badge.muted { background: var(--txt3); }

/* ============================================================
   ОБЛАСТЬ ЧАТА
   ============================================================ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
}

/* Пустое состояние */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--txt3);
  user-select: none;
}

.empty-icon svg { stroke: var(--txt3); }

.chat-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--txt2);
}

.chat-empty p {
  font-size: 13.5px;
  color: var(--txt3);
  margin: 0;
}

/* Шапка чата */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header-info { flex: 1; min-width: 0; }

.chat-header-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--txt3);
}

.online-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}


/* ── Chat empty state — logo spin ───────────────────────────── */
.empty-logo {
  margin-bottom: 20px;
}

.empty-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  animation: logo-breathe 3s ease-in-out infinite;
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 40%, transparent));
}

@keyframes logo-breathe {
  0%   { transform: scale(1)    rotate(0deg);   opacity: 1;    }
  25%  { transform: scale(1.06) rotate(4deg);   opacity: 0.95; }
  50%  { transform: scale(1)    rotate(0deg);   opacity: 1;    }
  75%  { transform: scale(1.06) rotate(-4deg);  opacity: 0.95; }
  100% { transform: scale(1)    rotate(0deg);   opacity: 1;    }
}

.empty-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--txt1);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}

.empty-sub {
  font-size: 14px;
  color: var(--txt3);
  margin: 0;
  max-width: 260px;
  text-align: center;
  line-height: 1.5;
}
