/* Library page: shared collections, @handle and the AI allowance. */

/* Sharing */
.tree-share {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 2px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
}

.tree-row:hover .tree-share,
.tree-share:focus-visible,
.tree-share.is-shared { opacity: 1; }
.tree-share:hover { color: var(--border); border-color: var(--border); background: #fff; }
.tree-share.is-shared { color: var(--border); background: var(--lime); border-color: var(--border); }

.share-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
}

.share-backdrop[hidden] { display: none; }

.share-modal {
  width: 100%;
  max-width: 460px;
  padding: 22px;
  background: #fff;
  border: 3px solid var(--border);
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--border);
}

.share-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.share-head h3 { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }
.share-desc { font-size: 13px; line-height: 1.5; color: var(--muted); margin-bottom: 14px; }

.share-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.share-check input { width: 16px; height: 16px; accent-color: var(--lime-dark); }
.share-link-row { display: flex; gap: 8px; margin-bottom: 8px; }
.share-link-row .text-input { flex: 1; min-width: 0; margin-bottom: 0; font-size: 13px; }
.share-link-row .btn { width: auto; flex: none; }
.share-meta { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 16px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions .btn { width: auto; }

/* Button styles set display, which would otherwise override the hidden attribute */
.share-modal [hidden] { display: none !important; }

/* @handle */
.handle-row { display: flex; align-items: stretch; margin-bottom: 8px; }
.handle-at {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-weight: 900;
  background: var(--muted-light);
  border: 2px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
}
.handle-row .text-input { flex: 1; min-width: 0; margin-bottom: 0; border-radius: 0 8px 8px 0; }
.handle-status { min-height: 18px; margin-bottom: 8px; font-size: 12px; font-weight: 700; }
.handle-status.ok { color: var(--lime-dark); }
.handle-status.bad { color: var(--error); }
.handle-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.handle-suggestions button {
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.handle-suggestions button:hover { background: var(--lime-light); }
.handle-signout { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; }
/* Handle row: the handle and its buttons on one line, any note underneath */
.profile-details > div.profile-handle-row { align-items: flex-start; }
.profile-handle-value { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.handle-line { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.handle-name { font-weight: 800; overflow-wrap: anywhere; }
.handle-pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px;
  font-family: inherit; font-size: 11px; font-weight: 800; line-height: 1.5; color: var(--border);
  text-decoration: none; background: #fff; border: 1.5px solid var(--border); border-radius: 999px;
  box-shadow: 1.5px 1.5px 0 var(--border); cursor: pointer;
}
.handle-pill:hover:not(:disabled) { background: var(--lime-light); }
.handle-pill:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.handle-note { font-size: 11px; font-weight: 600; color: var(--muted); text-align: right; }

/* AI allowance */
.ai-usage { margin-bottom: 12px; }

.ai-usage-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.ai-usage-meter {
  height: 8px;
  overflow: hidden;
  background: var(--muted-light);
  border: 1.5px solid var(--border);
  border-radius: 4px;
}

.ai-usage-bar {
  width: 0;
  height: 100%;
  background: var(--lime);
  transition: width 0.2s ease;
}

.ai-usage-bar.low { background: var(--error); }
