/* --- Base Layout --- */
body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  height: 100vh;
  background: #f9fafb;
  color: #333;
}

.container {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 310px;
  background: #ffffff;
  margin-right:20px;
  border-right: 1px solid #e5e7eb;
  padding: 15px;
  box-sizing: border-box;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.sidebar input {
  width: 100%;
  padding: 8px 10px;
  margin: 12px 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: 0.2s;
}

.sidebar input:focus {
  border-color: #4f46e5;
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

/* --- Tree View List --- */
.sections-list,
.subsections-list {
  list-style: none;
  margin: 0;
  padding-left: 10px;
}

.section-item,
.subsection-item {
  position: relative;
  margin: 4px 0;
  border-radius: 8px;
  padding: 6px 8px 6px 28px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: #f9fafb;
  box-shadow: 0 0 0 transparent;
}

.section-item:hover,
.subsection-item:hover {
  background: #eef2ff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.section-item.active,
.subsection-item.active {
  background: #e0e7ff;
  border-left: 3px solid #4f46e5;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
}

/* --- Connector Lines (Tree) --- */
.subsections-list {
  margin-left: 16px;
  border-left: 1px dashed #d1d5db;
  padding-left: 14px;
  transition: all 0.3s ease;
}

/* --- Toggle Icons --- */
.toggle-btn {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #6b7280;
  transition: transform 0.25s ease;
}

.toggle-btn.open {
  transform: translateY(-50%) rotate(90deg);
  color: #4f46e5;
}

/* --- Delete Button --- */
.delete-btn {
  color: #ef4444;
  font-weight: bold;
  font-size: 16px;
  padding: 0 6px;
  border-radius: 4px;
  transition: 0.2s;
}

.delete-btn:hover {
  background: #ef4444;
  color: white;
}

/* --- Buttons --- */
button {
  cursor: pointer;
  padding: 8px 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  transition: 0.2s;
}

button:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.rename-input {
  width: 85%;
  padding: 4px 6px;
  font-size: 14px;
  border: 1px solid #4f46e5;
  border-radius: 5px;
  outline: none;
  background: #eef2ff;
  color: #111827;
  transition: 0.2s;
}

.rename-input:focus {
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
}

#addSubsectionBtn {
  margin-top: 10px;
  width: 100%;
}

#addSnippetBtn {
  margin: 10px 0;
}

/* --- Snippet List --- */
#snippetsList {
  list-style: none;
  padding: 0;
  margin-top: 10px;
}

#snippetsList li {
  padding: 10px;
  cursor: pointer;
  background: #f3f4f6;
  margin-bottom: 6px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

#snippetsList li:hover {
  background: #e0e7ff;
}

/* --- Code Display --- */
#snippetDisplay pre {
  background: #111827;
  color: #e5e7eb;
  padding: 12px;
  overflow-x: auto;
  border-radius: 6px;
  font-size: 13px;
}

/* --- Scrollbar Styling --- */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: #c7d2fe;
  border-radius: 6px;
}
