/* Slash prompts, library, folder bar and chat metadata dialogs. */

.modal.modal-wide { width: min(920px, 100%); }

.btn.small { padding: 4px 9px; border-radius: 7px; font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center; padding: 1px 7px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-soft); color: var(--text-soft);
  font-size: 11px; line-height: 1.6; white-space: nowrap;
}
.badge.info { color: var(--accent); border-color: var(--accent); }

/* ---------- slash prompt popup ---------- */

.slash-host { position: relative; }

.slash-popup {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 40;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 300px; overflow-y: auto; padding: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
}
.slash-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 7px 9px; border: none; border-radius: 8px;
  background: none; color: var(--text); text-align: left;
}
.slash-item:hover, .slash-item[aria-selected="true"] { background: var(--hover); }
.slash-command {
  flex: 0 0 auto; color: var(--accent);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
}
.slash-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-soft); font-size: 13px;
}
.slash-loading, .slash-empty {
  padding: 8px 9px; color: var(--text-soft); font-size: 13px;
}

/* ---------- library ---------- */

.library { min-width: 0; }

.library-tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding-bottom: 10px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.library-tab {
  flex: 0 0 auto; padding: 7px 12px;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text-soft);
  font-size: 13.5px; font-weight: 500;
}
.library-tab:hover { background: var(--hover); color: var(--text); }
.library-tab.active {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}

.library-panel { min-width: 0; }

.library-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.library-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }

.library-list { display: flex; flex-direction: column; gap: 8px; }

.library-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg-soft);
}
.library-main { flex: 1; min-width: 0; }
.library-title {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
.library-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.library-desc {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  margin-top: 3px; overflow: hidden;
  color: var(--text-soft); font-size: 13px; overflow-wrap: anywhere;
}
.library-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.library-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: 6px; flex: 0 0 auto;
}

.library-form { display: flex; flex-direction: column; }
.library-form .field { margin-bottom: 12px; }
.library-textarea {
  min-height: 150px; resize: vertical;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
}
.library-params {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.library-params .field { margin-bottom: 0; }

.input-prefix {
  display: flex; align-items: center; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--bg-elevated);
}
.input-prefix:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-prefix > span {
  padding: 0 9px; color: var(--text-soft);
  font-family: var(--mono); font-size: 13px;
}
.input-prefix input {
  border: none; border-radius: 0; box-shadow: none; background: transparent;
}
.input-prefix input:focus { box-shadow: none; }

.library-version { margin-top: 6px; }
.library-version summary {
  cursor: pointer; color: var(--text-soft); font-size: 12.5px;
}
.library-pre {
  margin: 6px 0 0; padding: 8px 10px;
  max-height: 220px; overflow: auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-elevated);
  font-family: var(--mono); font-size: 12.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.library-add { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.library-add select { flex: 1; min-width: 0; }

/* ---------- chips ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-soft);
  font-size: 12.5px; line-height: 1.4; white-space: nowrap;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.active {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.chip.small { padding: 2px 7px; font-size: 11.5px; }

.chip-wrap { position: relative; display: inline-flex; align-items: center; }
.chip-more {
  display: grid; place-items: center; width: 20px; height: 20px;
  margin-left: -2px; border: none; border-radius: 50%;
  background: transparent; color: var(--text-soft);
  font-size: 13px; line-height: 1;
}
.chip-more:hover { background: var(--hover); color: var(--text); }

/* ---------- folder bar ---------- */

.folder-bar { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.folder-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.folder-sep { padding: 0 1px; color: var(--text-soft); font-size: 12px; }
.folder-add { padding: 2px 8px; font-size: 14px; }

.folder-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40;
  display: flex; flex-direction: column; min-width: 120px; padding: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 9px; box-shadow: var(--shadow-lg);
}
.folder-menu button {
  width: 100%; padding: 6px 8px; border: none; border-radius: 6px;
  background: none; text-align: left; font-size: 13px;
}
.folder-menu button:hover { background: var(--hover); }
.folder-menu button.danger { color: var(--danger); }

.tag-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- dialogs ---------- */

.radio-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 7px; font-size: 14px;
}
.radio-row:hover { background: var(--hover); }
.radio-row input { accent-color: var(--accent); }
.folder-children { margin-left: 18px; }
.dialog-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow-y: auto;
}

.share-link { display: flex; align-items: center; gap: 8px; }
.share-link .input {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 12.5px;
}
.share-url { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 800px) {
  .library-row { flex-direction: column; }
  .library-actions { justify-content: flex-start; }
  .library-params { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  .slash-popup, .folder-menu { box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5); }
}

/* Google sign-in on the auth card */
.auth-google { margin-top: 16px; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 13px; margin: 4px 0 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border, rgba(127,127,127,.3)); }
.google-btn { width: 100%; justify-content: center; }

/* Forced password change */
.pwgate-form { display: flex; flex-direction: column; gap: 12px; min-width: min(360px, 80vw); }
.pwgate-form .field input { width: 100%; }
