/* ============================================
   Sidebar — боковое меню и правая панель
   ============================================ */

/* Оверлеи */
.sidebar-overlay,
.right-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 21, 37, 0.6);
  z-index: 90;
  display: none;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.sidebar-overlay.open,
.right-sidebar-overlay.open { display: block; }

/* Левое меню */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100%;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-line);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--border-line);
}

.sidebar-user {
  min-width: 0;
  flex: 1;
}
.sidebar-name {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-username {
  font-size: 12px;
  color: var(--accent-silver);
  margin-top: 2px;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-item:hover {
  background: var(--bg-hover);
}
.sidebar-item.active {
  background: var(--bg-active);
  position: relative;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--aion-gradient);
}
.sidebar-item-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-item-danger {
  color: var(--status-error);
}
.sidebar-item-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}
.sidebar-divider {
  height: 1px;
  background: var(--border-line);
  margin: 6px 14px;
}

/* Правая панель (инфо о чате) */
.right-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--right-panel-width);
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-line);
  z-index: 95;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}
.right-sidebar.open { transform: translateX(0); }

.right-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-line);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.right-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-line);
  background: var(--bg-panel);
  flex-shrink: 0;
}
.right-tab {
  flex: 1;
  padding: 12px 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.right-tab:hover { color: var(--text-primary); }
.right-tab.active {
  color: var(--text-primary);
  border-bottom-color: transparent;
  background-image: var(--aion-gradient);
  background-size: 100% 2px;
  background-position: bottom;
  background-repeat: no-repeat;
}

.right-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.right-tab-content.active { display: block; }

/* Инфо-контент */
.right-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 16px;
}

.right-profile .avatar-xl {
  margin-bottom: 14px;
}

.right-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.right-username {
  font-size: 13px;
  color: var(--accent-silver);
  margin-bottom: 10px;
}

.right-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
}
.right-status.online { color: var(--status-online); }
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.right-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  text-align: left;
}

.right-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}
.right-actions .btn {
  width: 100%;
  justify-content: flex-start;
}

/* Список участников */
.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.member-item:hover { background: var(--bg-hover); }
.member-info {
  flex: 1;
  min-width: 0;
}
.member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-status {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.member-role {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--aion-gradient);
  color: var(--text-on-gradient);
  flex-shrink: 0;
}

/* Медиа-сетка */
.media-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  transition: transform 0.15s;
}
.media-item:hover { transform: scale(1.03); }
.media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Список файлов */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.file-item:hover { background: var(--bg-hover); }


/* ============================================
   Sidebar — обновлённый дизайн по макету Pixso
   ============================================ */

.sidebar {
  width: 320px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-line);
  box-shadow: 18px 0 60px rgba(4, 21, 37, 0.8);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 16px;
  gap: 4px;
  overflow-y: auto;
}

/* Профиль */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 14px;
}

.sidebar-profile-avatar {
  width: 64px;
  height: 64px;
  padding: 2px;
  border-radius: 50%;
  background: var(--aion-gradient-ring);
  box-shadow: var(--shadow-glow-strong);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-profile-avatar .avatar {
  width: 58px;
  height: 58px;
  font-size: 24px;
  border: 2px solid var(--bg-panel);
}

.sidebar-profile-info {
  min-width: 0;
  flex: 1;
}

.sidebar-profile-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.sidebar-profile-tag {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--accent-silver);
  margin-top: 3px;
}

/* Кнопка "Новый чат" */
.sidebar-cta {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--aion-gradient);
  color: var(--text-on-gradient);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-glow-strong);
  transition: all 0.15s;
  flex-shrink: 0;
}
.sidebar-cta:hover {
  background: var(--aion-gradient-hover);
  transform: translateY(-1px);
}
.sidebar-cta:active {
  transform: translateY(0);
}
.sidebar-cta .icon {
  width: 16px;
  height: 16px;
}

/* Пункты меню */
.sidebar .sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.sidebar .sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar .sidebar-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar .sidebar-item .icon {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.sidebar .sidebar-item span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--aion-gradient);
  color: var(--text-on-gradient);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar .sidebar-item-danger {
  color: var(--status-error);
}
.sidebar .sidebar-item-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  color: var(--status-error);
}

.sidebar-divider {
  height: 1px;
  background: var(--border-line);
  margin: 6px 0;
  flex-shrink: 0;
}

.sidebar-spacer {
  flex: 1;
  min-height: 8px;
}

.sidebar-footer {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0 0;
  flex-shrink: 0;
}