/* SocketChat demo, chat layout. Arvion supplies tokens, cards, badges and the
   rest of the shell; this file only lays out the three-pane chat. */

body { overflow: hidden; }

.chat-app {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr) 322px;
  height: 100vh;
}

.chat-side {
  display: flex;
  flex-direction: column;
  padding: 20px 14px 18px;
  border-right: 1px solid var(--line);
  background: rgba(13, 18, 30, 0.72);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
}
.room-item:hover { background: var(--surface-2); }
.room-item.active { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }
.room-item .hash { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.room-item .count { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.room-item.active .count { color: var(--gold); }

.person {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 6px;
}
.person .avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.person-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-role { font-size: 10.5px; color: var(--muted); }
.person .status { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; flex: none; }
.person .status.typing { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

.chat-center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.chat-head h1 { font-size: 18px; margin: 0; font-family: var(--font-display); }
.chat-head .badge { font-size: 10.5px; }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; max-width: 760px; }
.msg .avatar.sm { width: 34px; height: 34px; font-size: 11px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.msg-name { font-size: 12.5px; font-weight: 600; }
.msg-role { font-size: 10.5px; color: var(--muted); }
.msg-time { font-size: 10.5px; color: var(--muted); margin-left: auto; font-family: var(--font-mono); }
.msg-text {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.msg-text em { color: var(--muted); }

.msg.own { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 34px; max-width: 640px; margin-left: auto; }
.msg.own .avatar.sm { grid-column: 2; grid-row: 1; }
.msg.own .msg-body { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: flex-end; }
.msg.own .msg-text { border-radius: 12px 4px 12px 12px; background: linear-gradient(180deg, rgba(245, 194, 107, 0.16), rgba(245, 194, 107, 0.08)); border-color: rgba(245, 194, 107, 0.3); color: var(--text); }
.msg.own .msg-time { margin-left: 0; }
.msg.own .msg-name { color: var(--gold); }

.day-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; margin: 4px 0; }
.day-sep::before, .day-sep::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.composer { flex: none; padding: 10px 22px 16px; border-top: 1px solid var(--line); background: rgba(11, 15, 26, 0.55); }
.typing-line { height: 17px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-bottom: 7px; }
.typing-line.active { color: var(--gold); }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.3; animation: dot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 30% { opacity: 1; transform: translateY(-1px); } }
.composer-row { display: flex; gap: 9px; }
.composer-row .input { flex: 1; }
.composer-row .btn { padding: 10px 20px; }

.chat-rail {
  border-left: 1px solid var(--line);
  padding: 20px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  overflow-y: auto;
  background: rgba(13, 18, 30, 0.6);
}

.wire-log { display: flex; flex-direction: column; max-height: 236px; overflow: hidden; }
.wire-row { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 10.5px; }
.wire-row:last-child { border-bottom: 0; }
.wire-top { display: flex; align-items: center; gap: 6px; }
.wire-type { font-weight: 700; color: var(--text-2); font-size: 10.5px; letter-spacing: 0.03em; }
.wire-dir { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wire-dir.direct { color: var(--blue); }
.wire-dir.broadcast { color: var(--green); }
.wire-body { color: var(--muted); font-family: var(--font-mono); font-size: 9.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.frames { display: flex; flex-direction: column; }
.frames > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.frames > div:last-child { border-bottom: 0; }
.frames code { color: var(--gold); font-family: var(--font-mono); font-size: 10px; }
.frames span { color: var(--muted); font-size: 10.5px; }

@media (max-width: 1180px) {
  .chat-app { grid-template-columns: 220px minmax(0, 1fr); }
  .chat-rail { display: none; }
}
