/* eidolon-social.css — Social & Peer Chat tab (adapted from MyTwin social surface)
   3-pane layout: peer chats | transcript + composer | contacts drawer.
   Plus: file cards + previews, waveform players, recording UI, video-note
   modal, live-call stage overlay and incoming-call modal.
   Uses the Eidolon STANDARD tokens defined in eidolon.css (:root). */

.social-layout {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}

/* ── Left pane: active peer chats + presence ─────────────────── */
.social-peers-panel {
  width: 250px; min-width: 250px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column; overflow: hidden;
}
.social-peers-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-shrink: 0;
}
.social-pane-title {
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  color: var(--text-hi);
}
.social-self-presence {
  font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.social-self-presence[data-state="online"]  { color: var(--green); }
.social-self-presence[data-state="local"]   { color: var(--amber); }
.social-peer-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.social-peer-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; border-left: 3px solid transparent;
  transition: background .15s;
}
.social-peer-item:hover  { background: rgba(255,255,255,.04); }
.social-peer-item.active { background: var(--panel); border-left-color: var(--amber); }
.social-peer-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--amber-dim); color: var(--text-hi);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase;
}
.social-peer-meta { flex: 1; min-width: 0; }
.social-peer-name {
  font-size: 13.5px; color: var(--text-hi); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.social-peer-last {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.social-presence-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-hi); flex-shrink: 0;
}
.social-presence-dot[data-state="online"]     { background: var(--green); }
.social-presence-dot[data-state="connecting"] { background: var(--amber); }
.social-unread-badge {
  background: var(--amber); color: var(--on-accent);
  font-size: 11px; font-weight: 700; border-radius: 999px;
  padding: 2px 7px; flex-shrink: 0;
}

/* ── Center pane: transcript + composer ──────────────────────── */
.social-chat-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.social-chat-header {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap;
  background: var(--panel);
}
.social-chat-peer {
  font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  color: var(--text-hi); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.social-badge {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-hi); color: var(--text); white-space: nowrap;
}
.social-badge[data-state="connected"] { color: var(--green);  border-color: var(--green); }
.social-badge[data-state="connecting"]{ color: var(--amber);  border-color: var(--amber); }
.social-badge[data-state="failed"]    { color: var(--danger-text); border-color: var(--danger); }
.social-badge[data-state="on"]        { color: var(--green);  border-color: var(--green); }
.social-header-btn {
  background: transparent; border: 1px solid var(--border-hi); color: var(--amber);
  border-radius: var(--radius); width: 34px; height: 30px; padding: 0;
  font-size: 15px; line-height: 1; cursor: pointer; flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.social-header-btn:hover { border-color: var(--amber); background: rgba(232,160,64,.15); }
.social-transcript {
  flex: 1; overflow-y: auto; padding: 18px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.social-transcript.dragover {
  outline: 2px dashed var(--amber); outline-offset: -8px;
  background: rgba(232,160,64,.08);
}
.social-transcript-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: var(--text);
  font-size: 13.5px; text-align: center; padding: 24px; opacity: .8;
}
.social-msg {
  max-width: 70%; padding: 10px 14px; border-radius: 12px;
  font-size: 14px; line-height: 1.55; word-wrap: break-word; white-space: pre-wrap;
}
.social-msg.out {
  align-self: flex-end; background: var(--amber-dim);
  color: var(--text-hi); border-bottom-right-radius: 3px;
}
.social-msg.in {
  align-self: flex-start; background: var(--panel);
  border: 1px solid var(--border); border-bottom-left-radius: 3px;
}
.social-msg.sys {
  align-self: center; background: none; color: var(--muted);
  font-size: 12px; font-style: italic; padding: 3px 10px; max-width: 90%;
}
.social-msg-time {
  display: block; font-size: 10.5px; color: var(--muted);
  margin-top: 4px; text-align: right; font-style: normal;
}
.social-composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 18px 6px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.social-composer textarea {
  flex: 1; background: var(--bg); color: var(--text-hi);
  border: 1px solid var(--border-input); border-radius: var(--radius);
  padding: 10px 14px; font-family: var(--font-mono); font-size: 14px;
  line-height: 1.55; resize: none; outline: none; max-height: 140px;
}
.social-composer textarea:focus { border-color: var(--focus-ring); }
.social-composer button {
  background: var(--amber); color: var(--on-accent); border: none;
  border-radius: var(--radius); padding: 10px 18px; font-family: var(--font-ui);
  font-size: 13.5px; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.social-composer button:disabled { opacity: .4; cursor: default; }
/* Icon buttons in the composer (attach / voice memo / video snippet) —
   quieter than the amber Send button. */
#social-attach-btn, #social-mic-btn, #social-cam-memo-btn {
  background: transparent; border: 1px solid var(--border-input);
  color: var(--text); width: 38px; height: 38px; padding: 0;
  font-size: 16px; line-height: 1; border-radius: var(--radius);
  transition: color .15s, border-color .15s, background .15s;
}
#social-attach-btn:hover, #social-mic-btn:hover, #social-cam-memo-btn:hover {
  color: var(--amber); border-color: var(--amber); background: rgba(232,160,64,.12);
}
#social-mic-btn.recording {
  color: #fff; background: #c43e3e; border-color: transparent;
  animation: social-pulse 1.2s infinite;
}
@keyframes social-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(224,82,82,.55); }
  70%  { box-shadow: 0 0 0 10px rgba(224,82,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,82,82,0); }
}
.social-chat-hint {
  font-size: 11px; color: var(--muted); padding: 2px 18px 8px;
  flex-shrink: 0; font-style: italic;
}
.social-chat-hint.flash { color: var(--amber); font-style: normal; }

/* ── Recording strip (live voice-memo timer) ─────────────────── */
.social-rec-strip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-top: 1px solid var(--border);
  background: rgba(196,62,62,.08); flex-shrink: 0;
  font-size: 11px; color: var(--text);
}
.social-rec-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #e05252;
  animation: social-pulse 1.2s infinite; flex-shrink: 0;
}
.social-rec-label { flex: 1; color: var(--text-hi); }
.social-rec-timer { font-family: var(--font-mono); color: var(--text-hi); }
.social-rec-cancel, .social-rec-send {
  font-size: 10px; font-weight: 700; padding: 4px 12px; cursor: pointer;
  border-radius: var(--radius); font-family: var(--font-ui);
}
.social-rec-cancel {
  background: transparent; border: 1px solid var(--border-hi); color: var(--muted);
}
.social-rec-cancel:hover { color: var(--danger-text); border-color: var(--danger); }
.social-rec-send { background: var(--amber); color: var(--on-accent); border: none; }

/* ── File cards + inline previews ────────────────────────────── */
.social-file-msg { padding: 8px 10px; min-width: 230px; max-width: 340px; }
.social-file-msg.failed { opacity: .6; }
.social-file-head { display: flex; gap: 9px; align-items: center; min-width: 0; }
.social-file-icon { font-size: 20px; flex-shrink: 0; }
.social-file-info { flex: 1; min-width: 0; }
.social-file-name {
  font-size: 11px; font-weight: 600; color: var(--text-hi);
  word-break: break-all; line-height: 1.3;
}
.social-file-status { font-size: 9px; color: var(--muted); margin-top: 2px; }
.social-file-progress {
  height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.08); margin-top: 8px;
}
.social-file-bar {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--amber); transition: width .15s linear;
}
.social-file-img {
  display: block; max-width: 280px; max-height: 220px;
  border-radius: 8px; cursor: zoom-in;
}
.social-file-video {
  display: block; max-width: 300px; max-height: 240px;
  border-radius: 8px; background: #000;
}
.social-file-videonote {
  display: block; width: 200px; height: 200px; border-radius: 50%;
  object-fit: cover; background: #000; border: 2px solid var(--amber-dim);
}
.social-file-download {
  display: inline-block; margin-top: 8px; padding: 5px 12px;
  border: 1px solid var(--amber); color: var(--amber); border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 10px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.social-file-download:hover { background: rgba(232,160,64,.12); }

/* ── Custom waveform audio player (voice memos + audio files) ── */
.social-audio-player {
  display: flex; align-items: center; gap: 8px; min-width: 250px;
}
.social-audio-btn {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--amber); color: var(--on-accent); border: none;
  font-size: 10px; line-height: 1; cursor: pointer;
}
.social-audio-btn:hover { filter: brightness(1.1); }
.social-audio-wave { flex: 1; width: 130px; height: 28px; cursor: pointer; }
.social-audio-time {
  font-size: 9px; color: var(--muted); font-family: var(--font-mono);
  white-space: nowrap; flex-shrink: 0;
}
.social-audio-speed {
  flex-shrink: 0; background: transparent; border: 1px solid var(--border-hi);
  color: var(--muted); border-radius: 999px; padding: 2px 8px;
  font-size: 9px; font-weight: 700; cursor: pointer; font-family: var(--font-ui);
}
.social-audio-speed:hover { color: var(--amber); border-color: var(--amber); }

/* ── Image lightbox ──────────────────────────────────────────── */
.social-lightbox {
  position: fixed; inset: 0; z-index: 160; cursor: zoom-out;
  background: rgba(0,0,0,.88);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
}
.social-lightbox img {
  max-width: 92vw; max-height: 86vh; border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.8);
}
.social-lightbox-caption { color: var(--muted); font-size: 10px; }

/* ── Video note modal (60s circular recorder) ────────────────── */
.social-camrec-modal {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
}
.social-camrec-card {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: 14px; padding: 24px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.6);
}
.social-camrec-title {
  font-family: var(--font-ui); font-size: 13px; font-weight: 700;
  color: var(--text-hi);
}
.social-camrec-sub { font-size: 9px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.social-camrec-ring {
  position: relative; width: 260px; height: 260px; border-radius: 50%;
  overflow: hidden; background: #000; border: 3px solid var(--amber-dim);
}
.social-camrec-ring.recording {
  border-color: #e05252; animation: social-pulse 1.2s infinite;
}
.social-camrec-ring video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.social-camrec-ring video.playback { transform: none; }
.social-camrec-count {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #fff; font-family: var(--font-mono);
  font-size: 12px; padding: 2px 10px; border-radius: 999px; display: none;
}
.social-camrec-ring.recording .social-camrec-count { display: block; }
.social-camrec-controls { display: flex; gap: 10px; }
.social-camrec-btn {
  font-family: var(--font-ui); font-size: 11px; font-weight: 700;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
}
.social-camrec-btn.rec  { background: #c43e3e; color: #fff; border: none; }
.social-camrec-btn.rec:hover { background: #e05252; }
.social-camrec-btn.send { background: var(--amber); color: var(--on-accent); border: none; }
.social-camrec-btn.plain {
  background: transparent; border: 1px solid var(--border-hi); color: var(--muted);
}
.social-camrec-btn.plain:hover { color: var(--text-hi); border-color: var(--text-hi); }
.social-camrec-btn[disabled] { opacity: .35; cursor: default; }

/* ── Live call: floating stage overlay ───────────────────────── */
.social-call-overlay {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.social-call-stage {
  position: relative; width: min(960px, 94vw); height: min(640px, 88vh);
  background: #0c0d10; border: 1px solid var(--border-hi); border-radius: 12px;
  overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.7);
}
.social-remote-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #0c0d10;
}
/* Voice mode: no remote viewport — a pulsing identity card instead.
   (visibility:hidden on the <video> keeps remote AUDIO playing.) */
.social-call-stage[data-mode="voice"] .social-remote-video { visibility: hidden; }
.social-call-voice-idcard {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
}
.social-call-stage[data-mode="voice"] .social-call-voice-idcard { display: flex; }
.social-call-big-avatar {
  width: 112px; height: 112px; border-radius: 50%;
  background: var(--amber-dim); color: var(--text-hi);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 40px; font-weight: 700;
  text-transform: uppercase;
  animation: social-ring-pulse 2.2s infinite;
}
.social-call-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
}
.social-call-peer-label {
  font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: #fff;
}
.social-call-status { font-size: 10px; color: var(--amber); }
.social-call-pip {
  position: absolute; right: 16px; bottom: 84px; z-index: 3;
  width: 168px; height: 126px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border-hi); background: #000;
  cursor: grab; touch-action: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.55);
}
.social-call-pip.dragging { cursor: grabbing; opacity: .85; }
.social-call-pip.cam-off video { visibility: hidden; }
.social-call-pip.cam-off::after {
  content: 'camera off'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--muted);
}
.social-call-stage[data-mode="voice"] .social-call-pip { display: none; }
.social-local-video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.social-call-toolbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.social-call-timer {
  position: absolute; left: 16px; bottom: 26px;
  font-family: var(--font-mono); font-size: 11px; color: #fff; opacity: .85;
}
.social-call-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--border-hi); background: rgba(255,255,255,.08);
  color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.social-call-btn:hover { background: rgba(255,255,255,.16); }
.social-call-btn.on {
  background: var(--amber); border-color: var(--amber); color: var(--on-accent);
}
.social-call-btn.hangup {
  background: #c43e3e; border-color: #c43e3e; transform: rotate(135deg);
}
.social-call-btn.hangup:hover { background: #e05252; }

/* ── Incoming call ringing modal ─────────────────────────────── */
.social-incoming-modal {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.social-incoming-card {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: 14px; padding: 28px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,.6);
}
.social-incoming-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--amber-dim); color: var(--text-hi);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: 22px; font-weight: 700;
  text-transform: uppercase; margin-bottom: 6px;
  animation: social-ring-pulse 1.4s infinite;
}
@keyframes social-ring-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232,160,64,.45); }
  70%  { box-shadow: 0 0 0 18px rgba(232,160,64,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,160,64,0); }
}
.social-incoming-name {
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  color: var(--text-hi);
}
.social-incoming-kind { font-size: 10px; color: var(--muted); }
.social-incoming-actions { display: flex; gap: 12px; margin-top: 12px; }
.social-incoming-accept, .social-incoming-decline {
  font-family: var(--font-ui); font-size: 11px; font-weight: 700;
  padding: 8px 18px; border-radius: 999px; border: none; cursor: pointer;
}
.social-incoming-accept { background: var(--green); color: #0b0c0e; }
.social-incoming-accept:hover { filter: brightness(1.12); }
.social-incoming-decline { background: #c43e3e; color: #fff; }
.social-incoming-decline:hover { background: #e05252; }

/* ── Right drawer: contacts / requests / connect form ────────── */
.social-drawer {
  width: 270px; min-width: 270px;
  border-left: 1px solid var(--border); background: var(--surface);
  display: flex; flex-direction: column; overflow-y: auto;
}
.social-drawer-section {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.social-drawer-label {
  font-size: 11.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: 10px; font-weight: 700;
}
.social-contact-item, .social-request-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; font-size: 13.5px; color: var(--text-hi); font-weight: 500;
}
.social-contact-item .social-presence-dot { margin-left: auto; }
.social-contact-email {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0;
}
.social-request-item { flex-wrap: wrap; }
.social-request-note {
  width: 100%; font-size: 11.5px; color: var(--muted); font-style: italic;
  padding-left: 2px; margin-top: 2px;
}
.social-request-actions { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
.social-req-btn {
  flex: 1; font-size: 11.5px; font-weight: 700; padding: 6px 10px;
  border-radius: var(--radius); cursor: pointer;
  background: transparent; border: 1px solid var(--border-hi); color: var(--text-hi);
}
.social-req-btn.accept { color: var(--green); border-color: var(--green); background: rgba(78,201,155,.1); }
.social-req-btn.accept:hover { background: rgba(78,201,155,.2); }
.social-req-btn.decline { color: var(--danger-text); border-color: var(--danger); }
.social-req-btn.decline:hover { background: rgba(224,82,82,.15); }
.social-connect-form { display: flex; flex-direction: column; gap: 10px; }
.social-connect-form input, .social-connect-form textarea {
  background: var(--bg); color: var(--text-hi);
  border: 1px solid var(--border-input); border-radius: var(--radius);
  padding: 9px 12px; font-family: var(--font-mono); font-size: 13.5px; outline: none;
}
.social-connect-form input:focus, .social-connect-form textarea:focus {
  border-color: var(--focus-ring);
}
.social-connect-form textarea { resize: vertical; min-height: 52px; }
.social-connect-form button {
  background: var(--amber); border: 1px solid var(--amber); color: var(--on-accent);
  border-radius: var(--radius); padding: 9px 14px; font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: filter .15s, background .15s;
}
.social-connect-form button:hover { filter: brightness(1.1); }
.social-connect-status { font-size: 11.5px; color: var(--muted); min-height: 14px; }
.social-connect-status[data-kind="ok"]  { color: var(--green); font-weight: 600; }
.social-connect-status[data-kind="err"] { color: var(--danger-text); font-weight: 600; }
.social-empty {
  font-size: 12.5px; color: var(--muted); opacity: .85; padding: 10px 2px;
  line-height: 1.5;
}
.social-privacy-note {
  font-size: 11.5px; color: var(--muted); line-height: 1.5; padding: 14px 16px;
  margin-top: auto; font-style: italic; opacity: .9;
}

/* ── Responsive: collapse drawer, then peers, on narrow screens ─ */
@media (max-width: 1000px) { .social-drawer { display: none; } }
@media (max-width: 700px)  {
  .social-peers-panel { width: 170px; min-width: 170px; }
  .social-msg { max-width: 85%; }
  .social-call-pip { width: 110px; height: 82px; bottom: 92px; }
  .social-file-msg { min-width: 180px; }
}
