/* Sidebar */
.features-sidebar {
  width: 320px;
  background: var(--surface-color);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.3s ease;
}

#features-sidebar-panel,
#numbers-sidebar-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.sidebar-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
}

.features-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-color);
}

.features-list.drop-guide-inside {
  background-color: rgba(37, 99, 235, 0.05);
}

.feature-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background: var(--surface-color);
}

.feature-item:hover {
  border-color: var(--secondary-accent);
  background-color: var(--hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.feature-item.selected {
  background-color: var(--hover-bg);
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 1px var(--primary-accent);
}

.feature-item.selected:hover {
  background-color: var(--hover-bg);
}

.feature-expand-btn {
  background: transparent;
  border: none;
  padding: 0 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  font-weight: normal;
  transition: color 0.2s;
}

.feature-expand-btn:hover {
  color: var(--primary-accent);
  background: rgba(0,0,0,0.05);
  border-radius: 4px;
}

.sub-features.collapsed {
  display: none;
}

.feature-item.dragging {
  opacity: 0.4;
  border: 1px dashed var(--primary-accent);
}

.drop-guide-before::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--primary-accent);
  border-radius: 2px;
  z-index: 10;
  pointer-events: none;
}

.drop-guide-after::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--primary-accent);
  border-radius: 2px;
  z-index: 10;
  pointer-events: none;
}

.drop-guide-inside {
  background-color: rgba(37, 99, 235, 0.1) !important;
  border-color: var(--primary-accent) !important;
}

.feature-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feature-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.feature-actions button {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.2rem;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.feature-actions button:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.sub-features {
  margin-top: 0.75rem;
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border-color);
}

.sidebar-expand-controls {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--surface-color);
}

.sidebar-expand-controls button {
  flex: 0 0 auto;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.sidebar-expand-controls button:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.feature-item.feature-hover-highlight {
  background-color: var(--hover-bg);
  border-color: var(--secondary-accent);
}

/* Feature Link Styles */
.feature-link-group {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.feature-link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
}

.feature-link-header:hover {
  background-color: var(--hover-bg);
  border-color: var(--secondary-accent);
}

.feature-link-header.selected {
  background-color: var(--hover-bg);
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 1px var(--primary-accent);
}

.feature-link-header.feature-hover-highlight {
  background-color: var(--hover-bg);
  border-color: var(--secondary-accent);
}

.feature-link-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.feature-link-title-info {
  display: flex;
  flex-direction: column;
}

.feature-link-title {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--secondary-accent);
}

.feature-link-stats {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.feature-link-items {
  position: relative;
  margin-left: 0.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--secondary-accent);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-link-items.collapsed {
  display: none;
}

.feature-link-items::before {
  content: '🔗';
  position: absolute;
  top: 50%;
  left: -11px;
  transform: translateY(-50%);
  background: var(--bg-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border: 1px solid var(--secondary-accent);
  color: var(--secondary-accent);
}

.linked-sub-feature {
  margin-bottom: 0 !important;
  position: relative;
}

.feature-link-items > .linked-sub-feature::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 50%;
  width: 1.25rem;
  height: 2px;
  background-color: var(--secondary-accent);
}

/* Numbers sidebar categories */
.numbers-sidebar-category {
  margin-bottom: 0.75rem;
}

.numbers-sidebar-cat-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all 0.2s;
}

.numbers-sidebar-cat-header:hover {
  background: var(--hover-bg);
  border-color: var(--secondary-accent);
}

.numbers-sidebar-cat-arrow {
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.numbers-sidebar-cat-label {
  flex: 1;
}

.numbers-sidebar-cat-items {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}
