/* PRE Web GUI — Sidebar navigation, sessions, channels */

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: 'Calendas Plus', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 4px;
  cursor: pointer;
}

.logo-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 1px;
}

/* Pinned toolbar (search + action buttons, never scrolls) */
.sidebar-toolbar {
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.sidebar-search {
  position: relative;
}

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sidebar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 180, 238, 0.1);
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

.sidebar-section {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-item {
  display: flex;
  align-items: center;
  border-radius: 10px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.session-item:hover {
  background: var(--surface-hover);
}
.session-item.active {
  background: linear-gradient(135deg, var(--primary-bg), rgba(167, 139, 250, 0.06));
  color: var(--primary);
  box-shadow: 0 1px 6px rgba(108, 180, 238, 0.08);
}

.session-item-info {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  font-size: 0.85rem;
  min-width: 0;
}

.session-delete-btn {
  display: none;
  padding: 4px 8px;
  margin-right: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}
.session-item:hover .session-delete-btn {
  display: block;
}
.session-delete-btn:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

.session-item-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.session-rename-input {
  width: 100%;
  padding: 2px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 4px;
  outline: none;
  margin-bottom: 2px;
}

.session-rename-input.topbar-rename {
  font-size: inherit;
  padding: 2px 8px;
  width: auto;
  min-width: 120px;
  max-width: 300px;
}

.session-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Sidebar action buttons */
.sidebar-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 4px;
}
.sidebar-actions .btn {
  flex: 1;
}

/* Project groups */
.project-group {
  margin-bottom: 4px;
}

.project-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  user-select: none;
}
.project-header:hover {
  background: var(--surface-hover);
}

.project-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.project-group.expanded .project-chevron {
  transform: rotate(90deg);
}

.project-icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
  flex-shrink: 0;
}

.project-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-count {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--surface-hover);
  border-radius: 10px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.project-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.project-header:hover .project-actions {
  display: flex;
}
.project-actions button {
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}
.project-actions button:hover {
  color: var(--text);
  background: var(--surface-active);
}
.project-actions .project-delete-btn:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

.project-sessions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.project-group.expanded .project-sessions {
  max-height: 2000px;
}

.project-sessions .session-item {
  padding-left: 12px;
}

.project-rename-input {
  width: 100%;
  padding: 2px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 4px;
  outline: none;
}

/* Drag and drop */
.session-item[draggable="true"] {
  cursor: grab;
}
.session-item.dragging {
  opacity: 0.4;
}
.project-header.drag-over,
.ungrouped-drop.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: var(--primary-bg);
}

.ungrouped-drop {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
  transition: background 0.15s ease, outline 0.15s ease;
  display: none;
}
.ungrouped-drop.visible {
  display: block;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.footer-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.footer-row-top {
  justify-content: space-between;
}
.footer-row-panels {
  justify-content: center;
  gap: 4px;
}

.theme-switcher {
  position: relative;
}

.theme-dropdown-wrapper {
  position: relative;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.75rem;
  white-space: nowrap;
}
.theme-toggle-btn:hover {
  background: var(--surface-active);
  color: var(--text);
  border-color: var(--border-light);
}
.theme-chevron {
  opacity: 0.5;
}

.theme-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 -4px 16px var(--shadow);
  z-index: 100;
}
.theme-dropdown.hidden {
  display: none;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  transition: all 0.15s ease;
  text-align: left;
}
.theme-option:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.theme-option.active {
  background: var(--primary-bg);
  color: var(--primary);
}
.theme-option-icon {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}
.status-dot.connected {
  background: var(--success);
  animation: statusPulse 2s ease-in-out infinite;
}
.status-dot.error {
  background: var(--danger);
}
