/**
 * Sidebar Styles - Channel List and Navigation
 * Dark purple sidebar with channel items and sections
 */

/* ============================================
   Sidebar Header
   ============================================ */

.sidebar-header {
  padding: var(--spacing-lg) var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   Channels List Navigation
   ============================================ */

.channels-list {
  flex: 1;
  padding: var(--spacing-sm) 0;
  overflow-y: auto;
}

/* ============================================
   Channel Item
   ============================================ */

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--spacing-md);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
  gap: var(--spacing-sm);
}

.channel-item:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-white);
}

.channel-item:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: -2px;
}

/* Active/Selected channel */
.channel-item.active {
  background: var(--color-active-channel);
  color: var(--color-white);
}

/* Channel name and hash container */
.channel-item-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

/* Channel hash icon */
.channel-hash {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.channel-item.active .channel-hash {
  color: var(--color-white);
}

/* Channel name text */
.channel-name {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Unread Badge
   ============================================ */

.unread-badge {
  background: var(--color-error-red);
  color: var(--color-white);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.unread-badge:empty {
  display: none;
}

/* ============================================
   Sidebar Sections (Collapsible)
   ============================================ */

.sidebar-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  cursor: pointer;
  transition: background 0.2s ease;
}

.sidebar-section-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-section-header:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: -2px;
}

.sidebar-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* Collapse arrow icon */
.sidebar-section-arrow {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  transition: transform var(--transition-speed) var(--transition-timing);
}

.sidebar-section.collapsed .sidebar-section-arrow {
  transform: rotate(-90deg);
}

/* Section content (collapsible) */
.sidebar-section-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height var(--transition-speed) var(--transition-timing);
}

.sidebar-section.collapsed .sidebar-section-content {
  max-height: 0;
}

/* ============================================
   Sidebar Footer
   ============================================ */

.sidebar-footer {
  padding: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

/* ============================================
   Online Users List
   ============================================ */

.online-users-list {
  padding: var(--spacing-sm) 0;
}

.online-user-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 6px var(--spacing-md);
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s ease;
}

.online-user-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Online user avatar */
.online-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary-purple);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
}

.online-user-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Online status indicator (green dot) */
.online-status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--color-success-green);
  border: 2px solid var(--color-sidebar-dark);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(43, 172, 118, 0.5);
}

.online-user-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Empty States
   ============================================ */

.channels-list-empty,
.online-users-list-empty {
  padding: var(--spacing-lg) var(--spacing-md);
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-style: italic;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Mobile - Optimize for smaller sidebar */
@media (max-width: 767px) {
  .sidebar-header,
  .sidebar-footer,
  .sidebar-section-header {
    padding: var(--spacing-md);
  }

  .channel-item,
  .online-user-item {
    padding: 8px var(--spacing-md);
  }
}

/* ============================================
   Accessibility
   ============================================ */

/* Keyboard navigation */
.channel-item:focus,
.online-user-item:focus,
.sidebar-section-header:focus {
  outline: 2px solid var(--color-white);
  outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .channel-item,
  .online-user-item {
    border: 1px solid transparent;
  }

  .channel-item:hover,
  .channel-item.active,
  .online-user-item:hover {
    border-color: var(--color-white);
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .sidebar-section-arrow,
  .sidebar-section-content {
    transition: none;
  }
}
