/* ── Manage lists page ── */
.lists-page {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lists-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lists-page-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e2e8f0;
}

#lists-back-btn {
  padding: 0.35rem 0.7rem;
  background: transparent;
  border: 1px solid #2d2d3a;
  border-radius: 5px;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#lists-back-btn:hover { color: #e2e8f0; border-color: #6366f1; }

.lists-form,
.lists-edit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lists-form input,
.lists-edit-row input {
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  border: 1px solid #2d2d3a;
  background: #1a1a24;
  color: #e2e8f0;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}
.lists-form input:focus,
.lists-edit-row input:focus { border-color: #6366f1; }

.lists-form input[name=name],
.lists-edit-row input[name=name] { flex: 1; min-width: 120px; }

.lists-form input[name=position],
.lists-edit-row input[name=position] { width: 90px; }

.lists-form button[type=submit],
.lists-edit-row button[type=submit] {
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  border: none;
  background: #6366f1;
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.lists-form button[type=submit]:hover,
.lists-edit-row button[type=submit]:hover { background: #4f52d4; }

.lists-delete-btn {
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  border: 1px solid #2d2d3a;
  background: transparent;
  color: #64748b;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.lists-delete-btn:hover { color: #f87171; border-color: #f87171; }

#lists-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Bookmarks tab ── */
#tab-bookmarks {
  /* full width — main's padding provides the side margins */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.bm-list {
  background: #1a1a24;
  border: 1px solid #2d2d3a;
  border-radius: 8px;
  padding: 0.75rem 1rem 1rem;
}

.bm-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.bm-list-header-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.bm-icon-btn.active {
  color: #6366f1;
  border-color: #6366f1;
}

.bm-list-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.bm-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.bm-icon-btn:hover { color: #e2e8f0; border-color: #2d2d3a; }

/* add-bookmark inline form */
.bm-inline-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.bm-inline-form input {
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  border: 1px solid #2d2d3a;
  background: #0f0f13;
  color: #e2e8f0;
  font-size: 0.875rem;
  outline: none;
  flex: 1;
  min-width: 120px;
  transition: border-color 0.15s;
}
.bm-inline-form input:focus { border-color: #6366f1; }

.bm-inline-form button[type=submit] {
  padding: 0.4rem 0.8rem;
  border-radius: 5px;
  border: none;
  background: #6366f1;
  color: #fff;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.bm-inline-form button[type=submit]:hover { background: #4f52d4; }

.bm-inline-form button[type=button] {
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  border: 1px solid #2d2d3a;
  background: transparent;
  color: #94a3b8;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
}
.bm-inline-form button[type=button]:hover { color: #e2e8f0; }

/* bookmark grid — as many 200 px columns as fit */
.bm-bookmark-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, 250px);
  gap: 0.4rem;
}

.bm-row-wrapper { display: flex; flex-direction: column; }

/* bookmark card */
.bm-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  transition: background 0.1s;
  overflow: hidden;
}
.bm-row:hover { background: #22223a; }

/* favicon sized to 2 lines of text (2 × font-size × line-height) */
.bm-favicon {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border-radius: 3px;
  object-fit: contain;
}
.bm-favicon-placeholder {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  background: #2d2d3a;
  border-radius: 3px;
}

/* whole-card link wrapping favicon + text */
.bm-card-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.bm-card-link:hover .bm-url { color: #6366f1; }

/* two-line text block */
.bm-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.bm-url {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
  transition: color 0.15s;
}

.bm-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

/* drag-and-drop (active only when list is in edit mode) */
.bm-row-wrapper[draggable="true"] { cursor: grab; }
.bm-row-wrapper.bm-dragging { opacity: 0.3; cursor: grabbing; }
.bm-row-wrapper.bm-drag-before { box-shadow: -3px 0 0 #6366f1; border-radius: 6px; }
.bm-row-wrapper.bm-drag-after  { box-shadow:  3px 0 0 #6366f1; border-radius: 6px; }

/* edit / delete buttons — float over card corner on hover */
.bm-row-actions {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: flex;
  gap: 0.1rem;
  opacity: 0;
  background: rgba(15, 15, 19, 0.88);
  border-radius: 4px;
  padding: 0.1rem;
  transition: opacity 0.15s;
}
.bm-list.bm-edit-mode .bm-row:hover .bm-row-actions { opacity: 1; }
