/* Library page: folder sidebar, bookmark list, tab groups, notes. */

/* Folder Sidebar */
.sidebar-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 3px 3px 0 var(--border);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.folder-tree,
.folder-tree ul {
  list-style: none;
}

.folder-tree ul {
  display: none;
  margin-left: 13px;
  padding-left: 6px;
  border-left: 1.5px solid #e2e8f0;
}

.folder-tree li.expanded > ul {
  display: block;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  transition: background 0.1s;
}

.tree-row:hover {
  background: var(--muted-light);
}

.tree-row.active {
  background: var(--lime-light);
  border-color: var(--border);
  box-shadow: 2px 2px 0 var(--border);
}

.tree-toggle {
  flex: 0 0 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.12s;
}

.tree-toggle:hover {
  color: var(--border);
}

.tree-toggle.is-leaf {
  visibility: hidden;
}

li.expanded > .tree-row > .tree-toggle {
  transform: rotate(90deg);
}

.tree-label {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 2px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--border);
  text-align: left;
  cursor: pointer;
}

.tree-label svg {
  flex-shrink: 0;
}

.tree-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  flex-shrink: 0;
  min-width: 22px;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Bookmarks List */
.bookmarks-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bookmark-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 9px;
  padding: 14px 16px;
  box-shadow: 3px 3px 0 var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.08s, box-shadow 0.08s;
}

.bookmark-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--border);
}

.bm-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.bm-favicon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.bm-content {
  flex: 1;
  min-width: 0;
}

.bm-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--border);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.bm-title:hover {
  color: var(--lime-dark);
  text-decoration: underline;
}

.bm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
}

.bm-url {
  color: var(--muted);
  text-decoration: none;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-folder-badge {
  background: #f8fafc;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.tag-badge {
  background: var(--lime-light);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #14532d;
}

.bm-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 6px;
}

/* Tab Groups List */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--card);
  border: 2.5px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 4px 4px 0 var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 12px;
}

.group-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
}

.group-name {
  font-size: 15px;
  font-weight: 800;
}

/* Every board's list is the same height, so the buttons line up across cards */
.group-tabs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 240px;
  flex: none;
  overflow-y: auto;
  align-content: start;
}

.group-tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  text-decoration: none;
  color: var(--border);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.08s;
}

.group-tab-item:hover {
  border-color: var(--border);
  background: #fff;
}

.group-tab-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Empty state */
.empty-state {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--border);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  max-width: 420px;
  margin: 0 auto 16px auto;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  background: var(--border);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
  display: none;
  z-index: 1000;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Moderation (admins only) */
.moderation-card { grid-column: 1 / -1; }
.moderation-card[hidden] { display: none; }
.moderation-list { display: flex; flex-direction: column; gap: 10px; }
.moderation-item { padding: 12px; border: 2px solid var(--border); border-radius: 8px; background: #fff; }
.moderation-item p { flex: none; margin: 4px 0 8px; font-size: 13px; color: var(--black); overflow-wrap: anywhere; }
.moderation-meta { font-size: 12px; font-weight: 700; color: var(--muted); }
.moderation-actions { display: flex; gap: 8px; }
.moderation-actions .btn { width: auto; }

/* Recently Added: day headings */
.date-group {
  margin: 6px 0 -2px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.date-group:first-child { margin-top: 0; }
.bm-added { font-size: 11px; font-weight: 700; color: var(--muted); }

/* Notes */
.bm-note {
  margin: 3px 0 4px;
  font-size: 12px;
  font-style: italic;
  color: #334155;
  padding-left: 8px;
  border-left: 3px solid var(--lime);
  overflow-wrap: anywhere;
}
