/* ============================================================
   Astra Origins — Follow system (new design)
   Connections page + reusable follow button + floating toast.
   Loaded globally in master so follow buttons/counts work on every
   profile and survive pane swaps.
   ============================================================ */

/* ── Follow button (shared: profiles + cards) ─────────────── */
.fl-follow {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 116px; height: 34px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.fl-follow .bi { font-size: 13px; }
.fl-follow:hover { filter: brightness(1.06); }

/* States — toggle which label shows */
.fl-follow .fl-follow-on,
.fl-follow .fl-follow-off,
.fl-follow .fl-follow-spin { display: none; }
.fl-follow .fl-follow-default { display: inline-flex; align-items: center; gap: 6px; }

.fl-follow.is-following {
  background: var(--surface); color: var(--ink); border-color: var(--line);
}
.fl-follow.is-following .fl-follow-default { display: none; }
.fl-follow.is-following .fl-follow-on { display: inline-flex; align-items: center; gap: 6px; }
.fl-follow.is-following:hover {
  background: oklch(0.45 0.16 25 / 0.12); color: oklch(0.55 0.2 25); border-color: oklch(0.6 0.18 25 / 0.5);
}
.fl-follow.is-following:hover .fl-follow-on { display: none; }
.fl-follow.is-following:hover .fl-follow-off { display: inline-flex; align-items: center; gap: 6px; }

/* Busy — show only the spinner */
.fl-follow.is-busy { pointer-events: none; opacity: 0.85; }
.fl-follow.is-busy .fl-follow-default,
.fl-follow.is-busy .fl-follow-on,
.fl-follow.is-busy .fl-follow-off { display: none !important; }
.fl-follow.is-busy .fl-follow-spin { display: inline-flex; }

.fl-follow-sm { min-width: 104px; height: 30px; font-size: 9px; padding: 0 12px; }

.fl-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid oklch(1 0 0 / 0.5); border-top-color: #fff; animation: fl-spin 0.7s linear infinite; }
.fl-follow.is-following .fl-spinner { border-color: var(--line); border-top-color: var(--accent); }
@keyframes fl-spin { to { transform: rotate(360deg); } }

/* ── Connections page ─────────────────────────────────────── */
.fl-root { display: block; }

.fl-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 800; color: var(--ink-2); letter-spacing: 0.1em;
  padding: 4px 8px; border-radius: 6px; margin-bottom: 12px;
  text-decoration: none; cursor: pointer;
}
.fl-back:hover { background: var(--surface-2); color: var(--ink); }

.fl-head { display: flex; align-items: center; gap: 14px; padding: 4px 2px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.fl-head-av { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(135deg, oklch(0.5 0.16 265), oklch(0.28 0.08 265)); text-decoration: none; }
.fl-head-av img { width: 100%; height: 100%; object-fit: cover; }
.fl-head-mono { color: #fff; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 700; font-size: 20px; }
.fl-head-main { min-width: 0; }
.fl-head-name { display: block; font-size: 18px; font-weight: 800; color: var(--ink); text-decoration: none; line-height: 1.2; }
.fl-head-name:hover { color: var(--accent); }
.fl-head-handle { font-size: 11px; color: var(--ink-2); margin-top: 2px; }

/* Tabs */
.fl-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
.fl-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px; border-radius: 9px; background: transparent; border: none; cursor: pointer; color: var(--ink-2); font-size: 12px; font-weight: 700; }
.fl-tab .bi { font-size: 14px; }
.fl-tab:hover { background: var(--surface-2); color: var(--ink); }
.fl-tab.is-on { background: var(--ink); color: #fff; }
.fl-tab-ct { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: oklch(0.5 0.01 250 / 0.18); }
.fl-tab.is-on .fl-tab-ct { background: oklch(1 0 0 / 0.22); }

/* Search */
.fl-search { position: relative; margin-bottom: 14px; }
.fl-search .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 14px; }
.fl-search-input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-family: inherit; }
.fl-search-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }

/* List + cards */
.fl-list { display: flex; flex-direction: column; gap: 8px; }
.fl-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.fl-card:hover { border-color: var(--accent-line); }
.fl-card-av { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: linear-gradient(135deg, oklch(0.5 0.16 265), oklch(0.28 0.08 265)); text-decoration: none; }
.fl-card-av img { width: 100%; height: 100%; object-fit: cover; }
.fl-card-mono { color: #fff; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 700; font-size: 16px; }
.fl-card-main { flex: 1; min-width: 0; }
.fl-card-name { display: block; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-card-name:hover { color: var(--accent); }
.fl-card-handle { font-size: 11px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-card-meta { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--ink-3); margin-top: 3px; }
.fl-card-action { flex-shrink: 0; }

/* Loader / empty / end */
.fl-loader { display: grid; place-items: center; padding: 18px 0; }
.fl-loader[hidden] { display: none; }
.fl-loader .fl-spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--accent); }
.fl-empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.fl-empty[hidden] { display: none; }
.fl-empty .bi { font-size: 40px; color: var(--ink-3); opacity: 0.6; }
.fl-empty-h { margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--ink); }
.fl-empty-p { margin-top: 4px; font-size: 11px; }
.fl-end { text-align: center; padding: 16px 0; color: var(--ink-3); font-size: 9px; letter-spacing: 0.18em; font-weight: 800; }
.fl-end[hidden] { display: none; }
.fl-sentinel { height: 1px; }

/* Toast */
.fl-toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 1090; padding: 12px 18px; border-radius: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; background: var(--ink); color: #fff; box-shadow: 0 12px 32px oklch(0 0 0 / 0.2); pointer-events: none; }
.fl-toast[hidden] { display: none; }
.fl-toast.is-error { background: oklch(0.45 0.18 25); }
.fl-toast.is-success { background: oklch(0.5 0.16 145); }

/* Profile-page placement helpers */
.pf-actions .fl-follow { height: 32px; }
.org-actions .fl-follow { height: 34px; }

/* Clickable profile counts */
.pf-stat-link { text-decoration: none; color: inherit; cursor: pointer; display: block; }
.pf-stat-link:hover .pf-stat-n { color: var(--accent); }
.org-meta .fl-count-link { text-decoration: none; color: inherit; cursor: pointer; }
.org-meta .fl-count-link:hover { color: var(--accent); }

@media (max-width: 768px) {
  .fl-head-name { font-size: 16px; }
}
