/* Social V1: Connections (real Hi requests + chats) and the private message thread */

/* ---------- Avatars (server avatar colour + initial) ---------- */
.sc-avatar, .th-av {
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--a1), var(--a2));
  box-shadow: 0 0 16px color-mix(in srgb, var(--a1) 40%, transparent);
  font-family: var(--font-display); font-weight: 800; color: #fff;
}
.sc-avatar { width: 46px; height: 46px; font-size: 19px; }
.th-av { width: 34px; height: 34px; font-size: 14px; box-shadow: none; }

/* ---------- Connections ---------- */
.sc-section { display: flex; flex-direction: column; gap: 10px; }
.sc-head {
  margin: 4px 0 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-light);
}
.sc-head span {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--fg); letter-spacing: 0; font-size: 11px;
}
.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sc-fine { display: flex; gap: 6px; align-items: flex-start; margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.sc-fine svg { flex: none; width: 14px; height: 14px; margin-top: 1px; color: var(--accent-light); }

.sc-request {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px;
  border-radius: 20px;
  background: radial-gradient(90% 80% at 10% 0%, rgba(157, 92, 255, 0.18), transparent 70%), var(--surface);
  border: 1px solid rgba(185, 139, 255, 0.35);
}
.sc-row-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sc-row-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.sc-name { font-size: 16px; font-weight: 800; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-meta { font-size: 13px; color: var(--muted); }
.sc-request-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sc-request-actions .btn { min-height: 46px; }
.sc-request-actions .btn:disabled { opacity: 0.55; box-shadow: none; }
.sc-block-link { align-self: center; padding: 6px 12px; font-size: 13px; font-weight: 700; color: var(--muted); }

.sc-chat {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: left;
}
.sc-chat.unread { border-color: rgba(185, 139, 255, 0.45); box-shadow: 0 0 18px rgba(157, 92, 255, 0.18); }
.sc-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-new {
  flex: none; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent-light);
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.sc-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-chat.unread .sc-preview { color: #e4def0; font-weight: 600; }
.sc-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sc-time { font-size: 11px; color: var(--muted); }
.sc-unread {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 800;
  box-shadow: 0 0 10px var(--glow);
}

/* ---------- Crossed Paths: real Hi actions + badge on the tab ---------- */
.cp-hi-neutral { color: var(--muted); border-color: var(--line); background: var(--surface); box-shadow: none; }
.cp-hi:disabled { opacity: 0.6; }
.tab[data-route="crossed-paths"] { position: relative; }
.tab-dot {
  position: absolute; top: 4px; left: calc(50% + 8px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 0 2px var(--bg), 0 0 8px var(--accent);
}

/* ---------- Thread ---------- */
.th-wrap {
  position: absolute; left: 0; right: 0; top: 0;
  bottom: var(--kb, 0px);                       /* above the on-screen keyboard */
  display: flex; flex-direction: column;
  background: var(--bg);
}
.th-header {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--status-h) + 8px);
  padding-bottom: 10px;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 4, 7, 0.94);
}
.th-avatar-slot { flex: none; display: grid; }
.th-name {
  flex: 1; min-width: 0; margin: 0;
  font-size: 17px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.th-list {
  flex: 1; min-height: 0;
  list-style: none; margin: 0;
  padding: 14px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.th-msg {
  max-width: min(78%, 520px);
  display: flex; flex-direction: column; gap: 3px;
}
.th-msg.mine { align-self: flex-end; align-items: flex-end; }
.th-msg.theirs { align-self: flex-start; align-items: flex-start; }
.th-body {
  margin: 0;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 15px; line-height: 1.4;
  white-space: pre-wrap;                        /* keep line breaks */
  overflow-wrap: anywhere; word-break: break-word;
}
.th-msg.mine .th-body {
  background: radial-gradient(circle at 30% 20%, #a978ff, var(--accent) 70%);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.th-msg.theirs .th-body {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
  border-bottom-left-radius: 6px;
}
.th-time { font-size: 10px; color: var(--muted); padding: 0 4px; }
.th-day {
  align-self: center;
  margin: 8px 0 2px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}
.th-older { align-self: center; }
.th-older button, .th-loading button {
  padding: 6px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--accent-light);
  border: 1px solid var(--line); background: var(--surface);
}
.th-loading, .th-empty { align-self: center; margin: auto 0; padding: 20px; text-align: center; font-size: 14px; color: var(--muted); max-width: 30ch; }
.th-note {
  flex: none; margin: 0;
  padding: 8px max(16px, env(safe-area-inset-left, 0px));
  font-size: 13px; font-weight: 600; color: #ff8fa3;
  border-top: 1px solid var(--line);
}
.th-composer {
  flex: none; position: relative;
  display: flex; align-items: flex-end; gap: 8px;
  padding-top: 10px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: rgba(5, 4, 7, 0.96);
}
.th-composer textarea {
  flex: 1; min-width: 0;
  min-height: 44px; max-height: 132px;
  padding: 11px 14px;
  border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg);
  font: inherit; font-size: 16px; line-height: 1.35;     /* 16px: iOS doesn't zoom the page on focus */
  resize: none; overflow-y: auto;
}
.th-composer textarea:focus { outline: none; border-color: var(--accent); }
.th-composer textarea:disabled { opacity: 0.5; }
.th-send {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 20%, #b98bff, var(--accent) 65%);
  color: #fff; box-shadow: 0 0 16px rgba(157, 92, 255, 0.45);
}
.th-send svg { width: 20px; height: 20px; }
.th-send:disabled { opacity: 0.35; box-shadow: none; }
.th-count { position: absolute; right: 70px; top: -18px; font-size: 11px; font-weight: 700; color: var(--muted); }
.th-count.over { color: #ff8fa3; }

/* My Profile: real connections card */
.pf-connections .pf-real-face { width: 40px; height: 40px; font-size: 16px; margin-left: -8px; border: 2px solid #1a1525; }
.pf-connections .pf-real-face:first-child { margin-left: 0; }
.pf-connections .btn { margin-top: 10px; width: 100%; }
.sf-real-av { width: 40px; height: 40px; font-size: 16px; }
