/* ============================================
   侧边栏样式
   ============================================ */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  color: #ccc;
  transition: width var(--transition-normal);
  overflow: hidden;
  position: relative;
}

.sidebar-left {
  width: var(--sidebar-width);
  min-width: var(--sidebar-min-width);
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-right {
  width: var(--sidebar-right-width);
  min-width: 60px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border-left: 1px solid var(--border-light);
}

.sidebar.collapsed {
  width: var(--sidebar-min-width);
}

/* 侧边栏标签 */
.sidebar-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
}

.sidebar-right .sidebar-tabs {
  background: var(--bg-surface-hover);
  border-bottom: 1px solid var(--border-light);
}

.sidebar-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  background: transparent;
  color: #999;
  font-size: 10px;
  transition: all var(--transition-fast);
  flex: 1;
  min-width: 0;
}
.sidebar-tab:hover {
  background: var(--bg-sidebar-hover);
  color: #ddd;
}
.sidebar-tab.active {
  background: var(--primary);
  color: white;
}
.sidebar-right .sidebar-tab {
  color: var(--text-muted);
}
.sidebar-right .sidebar-tab:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.sidebar-right .sidebar-tab.active {
  background: var(--primary);
  color: white;
}

.tab-icon {
  font-size: 16px;
  line-height: 1;
}
.tab-text {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 面板 */
.sidebar-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}
.sidebar-panel.active {
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-right .panel-header {
  border-bottom: 1px solid var(--border-light);
}
.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #eee;
}
.sidebar-right .panel-header h3 {
  color: var(--text-primary);
}

.panel-actions {
  display: flex;
  gap: 4px;
}

.panel-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  background: rgba(255,255,255,0.08);
  color: #ccc;
  font-size: 14px;
  transition: all var(--transition-fast);
}
.panel-action-btn:hover {
  background: var(--primary);
  color: white;
}
.sidebar-right .panel-action-btn {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}
.sidebar-right .panel-action-btn:hover {
  background: var(--primary);
  color: white;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.panel-footer {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* 小说选择器 */
.novel-selector {
  display: flex;
  gap: 4px;
}
.novel-select {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #ccc;
  border-radius: var(--border-radius-sm);
  font-size: 12px;
}
.novel-select option {
  background: var(--bg-sidebar);
  color: #ccc;
}
.small-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  background: var(--primary);
  color: white;
  font-size: 14px;
}
.small-btn:hover {
  background: var(--primary-dark);
}

/* 章节列表 */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chapter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
}
.chapter-item:hover {
  background: var(--bg-sidebar-hover);
}
.chapter-item.active {
  background: var(--bg-sidebar-active);
  color: white;
  border-left: 3px solid var(--primary);
}
.chapter-item .chapter-number {
  font-size: 11px;
  color: #888;
  min-width: 24px;
}
.chapter-item .chapter-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chapter-item .chapter-words {
  font-size: 11px;
  color: #666;
}
.chapter-item .chapter-delete {
  opacity: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(214,48,49,0.3);
  color: #ff7675;
  font-size: 11px;
  transition: all var(--transition-fast);
}
.chapter-item:hover .chapter-delete {
  opacity: 1;
}
.chapter-item .chapter-delete:hover {
  background: var(--danger);
  color: white;
}

/* 预设列表 */
.preset-list, .worldbook-list, .outline-list, .faction-list, .map-list, .summary-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
}
.list-item:hover {
  background: var(--bg-sidebar-hover);
}
.list-item .item-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.list-item .item-indicator.disabled {
  background: #666;
}
.list-item .item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item .item-action {
  opacity: 0;
  font-size: 14px;
  color: #888;
  transition: all var(--transition-fast);
}
.list-item:hover .item-action {
  opacity: 1;
}
.list-item .item-action:hover {
  color: var(--primary-light);
}

/* 侧边栏拖拽手柄 */
.sidebar-resize-handle {
  position: absolute;
  top: 0;
  width: 4px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
}
.sidebar-left .sidebar-resize-handle {
  right: 0;
}
.sidebar-right .sidebar-resize-handle {
  left: 0;
}
.sidebar-resize-handle:hover {
  background: var(--primary);
  opacity: 0.5;
}
