/* Главная (друзья + личные сообщения). Подключается после style.css
   и использует его переменные, поэтому цвета совпадают с остальным сайтом. */

/* ───── Режимы: home (главная) и server (каналы) ───── */
.app[data-mode="home"] .channel-scroll,
.app[data-mode="home"] #serverName { display: none; }
.app[data-mode="server"] .dm-scroll,
.app[data-mode="server"] .home-nav,
.app[data-mode="server"] #homeHead { display: none; }

/* ───── Колонка серверов ───── */
.rail-logo { cursor: pointer; }
#railHome { position: relative; background: var(--bg-input); color: var(--text); }
#railHome:hover { background: var(--accent); color: #fff; }
.rail-logo.active { border-radius: 12px; }
#railHome.active { background: var(--accent); color: #fff; }
#railHome[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute; right: -4px; bottom: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff;
  border: 3px solid var(--bg-rail); box-sizing: content-box;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

/* ───── Сайдбар на главной ───── */
.home-nav { padding: 12px 8px 0; }
.home-nav-item {
  width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 600;
}
.home-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.home-nav-item.active { background: var(--bg-active); color: var(--text-strong); }

.dm-scroll { flex: 1; overflow-y: auto; padding: 12px 0; }
.dm-row {
  display: flex; align-items: center; gap: 10px;
  margin: 1px 8px; padding: 6px 10px; border-radius: 8px;
  color: var(--muted); cursor: pointer; user-select: none;
}
.dm-row:hover { background: var(--bg-hover); color: var(--text); }
.dm-row.active { background: var(--bg-active); color: var(--text-strong); }
.dm-av { position: relative; width: 32px; height: 32px; flex: none; }
.dm-av .avatar { width: 32px; height: 32px; font-size: 13px; }
.dm-dot {
  position: absolute; right: -3px; bottom: -3px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 3px solid var(--bg-side); box-sizing: border-box;
}
.dm-row:hover .dm-dot { border-color: #2c2d32; }
.dm-row.active .dm-dot { border-color: #34363b; }
.dm-dot.on { background: var(--green); }
.dm-dot.off { background: var(--faint); }
.dm-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.dm-info .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-sub { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

/* ───── Экран «Друзья» ───── */
.home { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 16px 24px 0; }
.home-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.home-tab { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.home-tab:hover { background: var(--bg-hover); color: var(--text); }
.home-tab.active { background: var(--bg-active); color: var(--text-strong); }
.home-search {
  width: 100%; padding: 10px 14px; margin-bottom: 18px;
  border: 0; outline: 2px solid transparent;
  background: #1e1f22; border-radius: 8px;
}
.home-search:focus { outline-color: var(--accent); }
.home-search::placeholder { color: var(--faint); }
.home-label { padding-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.home-list { flex: 1; overflow-y: auto; }
.home-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-top: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.home-row:hover { background: var(--bg-hover); }
.home-row .dm-av, .home-row .dm-av .avatar { width: 38px; height: 38px; font-size: 15px; }
.home-row .dm-dot { border-color: var(--bg-main); }
.home-row:hover .dm-dot { border-color: #303236; }
.home-row .nm { color: var(--text-strong); font-weight: 600; }
.home-msg {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px;
  background: var(--bg-input);
}
.home-msg:hover { background: #4a4d55; }
.home-empty { padding: 28px 8px; color: var(--faint); }

/* На узких экранах колонка серверов остаётся видимой, чтобы можно было
   переключаться между главной и сервером */
@media (max-width: 680px) {
  .app { grid-template-columns: 60px 190px minmax(0, 1fr); }
  .rail { display: flex; }
  .rail-logo { width: 42px; height: 42px; font-size: 17px; }
}

/* ───── Подсказка с пингом на панели «Голос подключён» ───── */
.voice-bar { position: relative; }
.ping-tip {
  display: none; position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 20;
  padding: 10px 12px; border-radius: var(--radius);
  background: #111214; border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  font-size: 13px; color: var(--text);
}
.voice-bar:hover .ping-tip { display: block; }
.ping-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.ping-row b { margin-left: auto; color: var(--text-strong); }
.ping-label { color: var(--muted); }
.ping-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
