/* ============================================================
   discussion-components.css — Cardinal Energy Discussions
   COMPONENT STYLES — all rules scoped under the .disc class.
   Apply class="disc" to any container that renders messages:
     - #tab-discussion (project chat)
     - .disc-thread-stream (thread viewer replies)
     - .disc-thread-parent-msg (thread viewer parent)
   This guarantees styles work everywhere, in any context,
   without specificity fights or hidden-element CSS failures.
   ============================================================ */

/* ── Flash animation (global keyframe) ──────────────────────── */
@keyframes disc-flash {
  0%,100% { background: transparent; }
  15%,85%  { background: rgba(14,165,233,0.15); }
}

/* ── Day divider ─────────────────────────────────────────────── */
.disc .day-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 12px 0 8px;
}
.disc .day-divider .line {
  flex: 1; height: 1px; background: #e2e8f0;
}
.disc .day-divider .label,
.disc .day-divider .lbl {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; font-weight: 500; color: #64748b;
}

/* ── Message row ─────────────────────────────────────────────── */
.disc .msg {
  display: flex; gap: 10px;
  padding: 4px; margin: 0 -4px;
  border-radius: 6px; transition: background 120ms;
  position: relative;
}
.disc .msg:hover { background: rgba(224,242,254,0.2); }
.disc .msg.system-msg {
  align-items: center; color: #64748b;
  font-size: 12px; font-style: italic;
}
.disc .msg.is-reply {
  margin-left: 16px;
  border-left: 2px solid #e2e8f0;
  padding-left: 10px;
}
.disc .msg.flash { animation: disc-flash 2.4s ease; }

/* ── Avatar ──────────────────────────────────────────────────── */
.disc .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
  flex-shrink: 0; margin-top: 2px;
}
.disc .avatar.system-avatar {
  background: #f1f5f9; color: #64748b; font-size: 14px;
}

/* ── Message body ────────────────────────────────────────────── */
.disc .msg-body { flex: 1; min-width: 0; }
.disc .msg-meta { display: flex; align-items: baseline; gap: 8px; }
.disc .msg-meta .name { font-size: 12px; font-weight: 600; color: #0f172a; }
.disc .msg-meta .time { font-size: 10px; color: #64748b; }
.disc .msg-text {
  font-size: 14px; line-height: 1.55; margin-top: 2px;
  color: #0f172a; word-wrap: break-word;
}

/* ── Mention + task chips ────────────────────────────────────── */
.disc .mention-user {
  display: inline-flex; align-items: center;
  padding: 1px 6px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
  background: rgba(14,165,233,0.12); color: #0ea5e9;
  vertical-align: baseline;
}
.disc .mention-user.me {
  background: rgba(14,165,233,0.16); color: #0ea5e9;
  box-shadow: inset 0 0 0 1px rgba(14,165,233,0.3);
}
.disc .mention-task {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: 4px;
  font-size: 11px; font-weight: 500; line-height: 1.4;
  background: rgba(22,163,74,0.18); color: hsl(150,65%,28%);
  border: none; cursor: pointer; font-family: inherit;
  vertical-align: baseline; margin-right: 2px;
  transition: background 120ms;
}
.disc .mention-task:hover { background: rgba(22,163,74,0.28); }
.disc .mention-task .outline {
  font-family: ui-monospace, monospace; font-size: 10px; opacity: 0.7;
}

/* ── Thread / reply footer ───────────────────────────────────── */
.disc .thread-footer {
  margin-top: 6px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 11px; cursor: pointer; font-family: inherit;
  border: 1px solid rgba(14,165,233,0.3);
  background: rgba(14,165,233,0.08); color: #0ea5e9;
  transition: background 120ms;
}
.disc .thread-footer.read {
  background: rgba(241,245,249,0.6);
  border-color: #e2e8f0; color: #64748b;
}
.disc .thread-footer:hover { background: rgba(14,165,233,0.14); }
.disc .thread-footer .when { font-size: 10px; opacity: 0.7; margin-left: 2px; }

/* ── Hover action buttons ────────────────────────────────────── */
.disc .msg-actions {
  position: absolute;
  top: 0; right: 2px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  display: flex; gap: 2px; align-items: center;
  opacity: 0; transition: opacity 0.12s;
  z-index: 10;
  pointer-events: none;
}
.disc .msg:hover .msg-actions {
  opacity: 1;
  pointer-events: auto;
}
.disc .icon-btn {
  width: 26px; height: 26px;
  border: 0; background: transparent;
  border-radius: 4px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #64748b;
  transition: background 120ms, color 120ms;
}
.disc .icon-btn:hover { background: #e0f2fe; color: #0f172a; }
.disc .icon-btn svg { width: 13px; height: 13px; display: block; }
.disc .icon-btn.danger:hover { background: #fee2e2; color: #ef4444; }

/* ── Autocomplete popover ────────────────────────────────────── */
.disc .disc-autocomplete {
  position: absolute; bottom: calc(100% + 4px); left: 12px;
  width: 280px; max-height: 220px; overflow-y: auto;
  background: #ffffff; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); z-index: 200;
}
.disc .disc-ac-head {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
  color: #64748b; padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0; background: rgba(241,245,249,0.5);
}
.disc .disc-ac-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; cursor: pointer; color: #0f172a;
}
.disc .disc-ac-item:hover,
.disc .disc-ac-item.hi { background: rgba(14,165,233,0.08); }
.disc .disc-ac-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(14,165,233,0.15); color: #0ea5e9;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.disc .disc-ac-outline {
  font-family: ui-monospace, monospace; font-size: 10px; color: #64748b; margin-right: 2px;
}
.disc .disc-empty {
  text-align: center; padding: 40px 20px; color: #64748b; font-size: 13px;
}
