/* live-sources.css — the admin "Live sources" modal (Bluesky list manager).
   Chrome (overlay / panel / head / tabs) is reused from settings-modal.css
   (.mn-settings-*); this file styles the master-detail body + the add dialog.
   Layout mirrors manage-users.css so the two admin modals feel like siblings. */

body.ls-open { overflow: hidden; }

/* Header: title on the left, global "Add source" + close on the right. The
   Add button sits above the tabs so it can serve other networks later. */
.ls-head-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Tab icon as an image (e.g. Truth Social's white PNG) — invert in light mode
   so it reads on a pale panel, matching the feed's platform badge. */
.ls-tab-icon { width: 1em; height: 1em; object-fit: contain; vertical-align: -0.12em; }
body[data-mode="light"] .ls-tab-icon { filter: invert(1); }

/* ===== Master-detail body ===== */
.ls-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  gap: 0.9rem;
  padding: 0.9rem;
}
.ls-panel { min-height: min(500px, calc(100vh - 6.5rem)); }

/* Left column */
.ls-sidebar {
  flex: 0 0 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}
.ls-filter {
  border: 1px solid var(--panel-border);
  border-radius: calc(var(--radius-panel) - 2px);
  background: color-mix(in srgb, var(--panel-bg) 72%, transparent);
  padding: 0.5rem 0.6rem;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  touch-action: manipulation;
}
.ls-filter:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent-soft) 35%, transparent);
}
.ls-count {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.55;
  padding: 0 0.15rem;
}

.ls-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-panel);
  padding: 0.3rem;
  background: color-mix(in srgb, var(--panel-bg) 40%, transparent);
}

.ls-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-panel) - 2px);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.ls-item:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.ls-item.is-selected {
  background: color-mix(in srgb, var(--color-accent-soft) 30%, transparent);
  border-color: color-mix(in srgb, var(--color-accent, currentColor) 45%, transparent);
}
.ls-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent-soft) 40%, transparent);
}

/* Avatar — real profile picture, or a hue-tinted initial fallback. */
.ls-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 0.95rem;
  background: color-mix(in srgb, var(--color-text) 10%, transparent);
}
.ls-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ls-avatar-initial {
  background: hsl(var(--mn-uhue, 220) 45% 90%);
  color: hsl(var(--mn-uhue, 220) 62% 32%);
}
body[data-mode="dark"] .ls-avatar-initial {
  background: hsl(var(--mn-uhue, 220) 30% 22%);
  color: hsl(var(--mn-uhue, 220) 70% 74%);
}
.ls-avatar-lg { width: 52px; height: 52px; font-size: 1.4rem; }

.ls-identity { min-width: 0; display: flex; flex-direction: column; flex: 1 1 auto; }
.ls-name-row { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.ls-name {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-header);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: hsl(var(--mn-uhue, 220) 62% 32%);
}
body[data-mode="dark"] .ls-name { color: hsl(var(--mn-uhue, 220) 70% 74%); }
.ls-sub {
  font-size: 0.76rem;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Verified tick — same blue as the feed */
.ls-tick { flex: 0 0 auto; color: #3b9aef; font-size: 0.8em; }

.ls-pending { flex: 0 0 auto; font-size: 0.78rem; color: #d9a441; opacity: 0.9; }

.ls-empty,
.ls-error {
  padding: 1rem 0.5rem;
  opacity: 0.7;
  font-size: 0.9rem;
  text-align: center;
}
.ls-error { color: #d94a4a; }

/* Right column */
.ls-detail {
  flex: 1 1 auto;
  min-width: 0;
  border-left: 1px solid var(--divider);
  padding-left: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ls-detail-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  opacity: 0.5;
  text-align: center;
}
.ls-detail-empty i { font-size: 1.6rem; }

.ls-detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--divider);
}
.ls-detail-identity { min-width: 0; }
.ls-detail-name-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.ls-detail-name {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-header);
  font-weight: 900;
  font-size: 1.2rem;
  color: hsl(var(--mn-uhue, 220) 62% 32%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-mode="dark"] .ls-detail-name { color: hsl(var(--mn-uhue, 220) 70% 74%); }
.ls-detail-name-row .ls-tick { font-size: 0.95rem; }
.ls-detail-handle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  opacity: 0.7;
  color: inherit;
  text-decoration: none;
}
.ls-detail-handle i { font-size: 0.72em; }
.ls-detail-handle:hover { opacity: 1; text-decoration: underline; }

/* Account bio (Bluesky profile description) */
.ls-bio {
  font-size: 0.88rem;
  line-height: 1.45;
  opacity: 0.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-top: -0.3rem;
}

/* Fields (label editor, add dialog) */
.ls-field { display: flex; flex-direction: column; gap: 0.3rem; }
.ls-field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  opacity: 0.7;
}
.ls-field-row { display: flex; gap: 0.4rem; }
.ls-label-input,
.ls-add-handle,
.ls-add-label {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--panel-border);
  border-radius: calc(var(--radius-panel) - 2px);
  background: color-mix(in srgb, var(--panel-bg) 60%, transparent);
  padding: 0.55rem 0.7rem;
  color: inherit;
  font-family: var(--font-body);
  font-size: 1rem;
  touch-action: manipulation;
}
.ls-label-input:focus-visible,
.ls-add-handle:focus-visible,
.ls-add-label:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent-soft) 35%, transparent);
}
.ls-label-save { flex: 0 0 auto; }

/* Meta row */
.ls-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.82rem;
  opacity: 0.85;
}
.ls-status { display: inline-flex; align-items: center; gap: 0.4rem; }
.ls-status.is-synced { color: #2e9c63; }
.ls-status.is-pending { color: #c9902f; }
.ls-added { opacity: 0.6; }

/* Actions */
.ls-detail-actions { margin-top: auto; display: flex; }
.ls-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #e0524a;
  border-color: color-mix(in srgb, #e0524a 40%, var(--panel-border));
  background: color-mix(in srgb, var(--panel-bg) 72%, transparent);
}
.ls-remove:hover:not(:disabled) { background: color-mix(in srgb, #e0524a 15%, transparent); }
.ls-remove:disabled { opacity: 0.5; cursor: not-allowed; }
:root[data-theme="dark"] .ls-remove { color: #ff8a82; }

/* ===== Add-source dialog (over the panel) ===== */
.ls-add-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.ls-add-overlay.hidden { display: none !important; }
.ls-add-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-panel);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ls-add-title { font-family: var(--font-header); font-weight: 900; font-size: 1.05rem; }
.ls-add-lookup { flex: 0 0 auto; }
.ls-add-hint { font-size: 0.76rem; opacity: 0.6; }
.ls-add-hint:empty { display: none; }

.ls-add-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-panel);
  padding: 0.7rem 0.8rem;
  background: color-mix(in srgb, var(--panel-bg) 50%, transparent);
}
.ls-add-preview[hidden] { display: none; }
.ls-add-preview-row { display: flex; align-items: center; gap: 0.7rem; }
.ls-add-preview-id { min-width: 0; }
.ls-add-preview-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 0;
}
.ls-add-preview-name > span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: hsl(var(--mn-uhue, 220) 62% 32%);
}
body[data-mode="dark"] .ls-add-preview-name > span { color: hsl(var(--mn-uhue, 220) 70% 74%); }
.ls-add-preview-handle { font-size: 0.82rem; opacity: 0.65; }
.ls-add-preview-bio {
  font-size: 0.84rem;
  line-height: 1.4;
  opacity: 0.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 6.5em;
  overflow-y: auto;
}
.ls-add-note { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; opacity: 0.75; }

.ls-add-error { font-size: 0.85rem; color: #e0524a; line-height: 1.35; }
:root[data-theme="dark"] .ls-add-error { color: #ff8a82; }
.ls-add-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ===== Mobile: stack the master-detail ===== */
@media (max-width: 640px) {
  .ls-sidebar { flex: 0 0 auto; }
  .ls-body { flex-direction: column; }
  .ls-list { max-height: 38vh; }
  .ls-detail {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--divider);
    padding-top: 0.9rem;
  }
  .ls-detail-empty { min-height: 6rem; }
  .ls-head-actions .ls-add-open span { display: none; }
}
