/* ============================================
   Friends Desktop — две колонки
   ============================================ */

.fr-root {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  background: var(--bg-base, #0e0e11);
  display: none;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
  color: var(--text-primary, #fff);
}

.fr-root.open {
  display: grid;
}

/* ═══════════ Sidebar ═══════════ */
.fr-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface, #16161a);
  border-right: 1px solid var(--border-color, #2a2a32);
  height: 100%;
}

.fr-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color, #2a2a32);
}

.fr-sidebar__head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fr-sidebar__add {
  background: var(--accent, #7c5cff);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s;
}
.fr-sidebar__add:hover { opacity: 0.8; }

/* Статистика */
.fr-stats {
  display: flex;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-color, #2a2a32);
  background: rgba(255,255,255,0.02);
}
.fr-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.fr-stat b { font-size: 18px; color: var(--accent, #7c5cff); }
.fr-stat span { font-size: 11px; color: var(--text-muted, #8e8e99); text-transform: uppercase; letter-spacing: 0.5px; }
.fr-stat--bd b { color: #f59e0b; }

/* Вкладки */
.fr-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color, #2a2a32);
  scrollbar-width: none;
}
.fr-tabs::-webkit-scrollbar { display: none; }
.fr-tab {
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-muted, #8e8e99);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
  transition: color 0.2s;
}
.fr-tab:hover { color: var(--text-primary, #fff); }
.fr-tab.active {
  color: var(--accent, #7c5cff);
  border-bottom-color: var(--accent, #7c5cff);
}
.fr-tab__count {
  background: rgba(124, 92, 255, 0.2);
  color: var(--accent, #7c5cff);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Ярлыки */
.fr-labels {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-color, #2a2a32);
}
.fr-labels::-webkit-scrollbar { display: none; }
.fr-label-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color, #2a2a32);
  color: var(--text-primary, #fff);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.fr-label-chip:hover { background: rgba(255,255,255,0.1); }
.fr-label-chip.active {
  background: var(--chip-color, #7c5cff);
  border-color: var(--chip-color, #7c5cff);
  color: #fff;
}

/* Поиск и сортировка */
.fr-search-wrap {
  position: relative;
  margin: 12px 16px 8px;
}
.fr-search-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted, #8e8e99);
}
.fr-search-wrap input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color, #2a2a32);
  border-radius: 8px;
  color: var(--text-primary, #fff);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.fr-search-wrap input:focus { border-color: var(--accent, #7c5cff); }

.fr-sort {
  padding: 0 16px 12px;
}
.fr-sort select {
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color, #2a2a32);
  border-radius: 8px;
  color: var(--text-primary, #fff);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* Список */
.fr-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.fr-friend {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}
.fr-friend:hover { background: rgba(255,255,255,0.05); }
.fr-friend--pinned::before {
  content: '📌';
  position: absolute;
  top: 4px; left: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.fr-friend__avatar {
  position: relative;
  width: 48px; height: 48px;
  flex-shrink: 0;
}
.fr-friend__avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.fr-friend__online {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 12px; height: 12px;
  background: #22c55e;
  border: 2px solid var(--bg-surface, #16161a);
  border-radius: 50%;
}

.fr-friend__info {
  flex: 1;
  min-width: 0;
}
.fr-friend__name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.fr-friend__name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fr-bd { font-size: 12px; color: #f59e0b; }

.fr-friend__meta {
  font-size: 12px;
  color: var(--text-muted, #8e8e99);
  display: flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fr-online-text { color: #22c55e; font-weight: 500; }
.fr-online-text--off { color: var(--text-muted, #8e8e99); }

.fr-friend__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.fr-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--badge-color, #7c5cff);
  border: 1px solid rgba(124, 92, 255, 0.3);
}

.fr-friend__note {
  font-size: 12px;
  color: var(--text-muted, #8e8e99);
  font-style: italic;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fr-friend__actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.fr-friend:hover .fr-friend__actions { opacity: 1; }

.fr-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color, #2a2a32);
  color: var(--text-primary, #fff);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.fr-btn:hover { background: rgba(255,255,255,0.1); }
.fr-btn--ok { color: #22c55e; }
.fr-btn--ok:hover { background: rgba(34, 197, 94, 0.15); }
.fr-btn--danger { color: #ef4444; }
.fr-btn--danger:hover { background: rgba(239, 68, 68, 0.15); }

/* Пустые состояния */
.fr-empty-list, .fr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted, #8e8e99);
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
}
.fr-empty-list i, .fr-empty i { font-size: 48px; opacity: 0.5; }
.fr-empty-list p, .fr-empty p { margin: 0; font-size: 14px; }

/* ═══════════ Content (Right side) ═══════════ */
.fr-content {
  display: flex;
  flex-direction: column;
  background: var(--bg-base, #0e0e11);
  height: 100%;
  overflow: hidden;
}

/* Скроллбары */
.fr-list::-webkit-scrollbar { width: 6px; }
.fr-list::-webkit-scrollbar-thumb { background: var(--border-color, #2a2a32); border-radius: 3px; }

/* ═══════════ Правая панель (Профиль) ═══════════ */
.fr-profile {
  padding: 32px;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.fr-profile__head {
  display: flex;
  align-items: center;
  gap: 20px;
}
.fr-profile__avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
}
.fr-profile__names h2 {
  margin: 0 0 4px;
  font-size: 24px;
  color: var(--text-primary, #fff);
}
.fr-profile__online {
  font-size: 14px;
  color: #22c55e;
}
.fr-profile__online--off { color: var(--text-muted, #8e8e99); }

.fr-profile__actions {
  display: flex;
  gap: 12px;
}
.fr-profile__btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color, #2a2a32);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary, #fff);
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.fr-profile__btn:hover { background: rgba(255,255,255,0.1); }
.fr-profile__btn--accent { background: var(--accent, #7c5cff); border-color: var(--accent, #7c5cff); }
.fr-profile__btn--danger { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); }
.fr-profile__btn--danger:hover { background: rgba(239, 68, 68, 0.15); }

.fr-profile__section {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color, #2a2a32);
  border-radius: 16px;
  padding: 16px;
}
.fr-profile__section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-muted, #8e8e99);
  letter-spacing: 0.5px;
}

/* Ярлыки в профиле */
.fr-label-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fr-label-picker__item {
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color, #2a2a32);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.fr-label-picker__item.active {
  background: var(--chip-color, #7c5cff);
  border-color: var(--chip-color, #7c5cff);
  color: #fff;
}

/* Общие друзья */
.fr-mutual-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.fr-mutual-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-primary, #fff);
  font-size: 13px;
}
.fr-mutual-item img {
  width: 24px; height: 24px;
  border-radius: 50%;
}

/* ═══════════ Модалка поиска ═══════════ */
.fr-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fr-modal.hidden { display: none; }
.fr-modal__content {
  background: var(--bg-surface, #16161a);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  padding: 24px;
  border: 1px solid var(--border-color, #2a2a32);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.fr-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.fr-modal__head h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary, #fff);
}

/* ═══════════ Контекстное меню ═══════════ */
.fr-context-menu {
  position: fixed;
  background: var(--bg-surface, #16161a);
  border: 1px solid var(--border-color, #2a2a32);
  border-radius: 12px;
  padding: 6px;
  z-index: 2200;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.fr-context-menu.hidden { display: none; }
.fr-context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary, #fff);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
}
.fr-context-menu button:hover { background: rgba(255,255,255,0.1); }