/* MagicAIl Table — styles: table talk (build 74). The Log / Chat tabs, the chat and its input field, speech bubbles.
   Loaded last (index.html), so these rules win over the older files. */

/* ---------- Tabs like index cards ---------- */

.log-tabs { display: flex; gap: 4px; min-width: 0; }

.log-tab {
  position: relative;
  padding: 4px 10px 5px;
  border: 1px solid var(--border);
  border-bottom-color: transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.log-tab:hover { color: var(--text); }
.log-tab.active { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.log-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* The red dot with the number of new lines. */
.chat-badge {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d9412b;
  color: #fff;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.chat-badge[hidden],
.log[hidden],
.chat-pane[hidden],
#copy-log[hidden] { display: none; }

/* ---------- The chat ---------- */

.chat-pane { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }

.chat {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 0;
  min-height: 160px;
  max-height: 42vh;
  overflow-y: auto;
  font-size: 13px;
}

.side-panel .chat { max-height: none; }

.chat li { padding: 6px 0; border-bottom: 1px solid var(--border); line-height: 1.4; overflow-wrap: anywhere; }
.chat time { color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: 11px; margin-right: 4px; }
.chat b { color: var(--text); }
.chat-whisper { color: #f3d36b; font-style: italic; }
.chat-whisper b { color: #f3d36b; }
.chat-hidden { opacity: 0.8; }
.chat-empty { color: var(--muted); font-style: italic; border-bottom: none !important; }

.chat-form { display: flex; flex-direction: column; gap: 6px; }
.chat-form select { padding: 6px 8px; font-size: 13px; }
.chat-input-row { display: flex; gap: 6px; }
.chat-input-row .input { flex: 1; min-width: 0; padding: 8px 10px; font-size: 14px; }
.chat-send { flex: none; }
.chat-error { margin: 0; font-size: 13px; }
.chat-error[hidden] { display: none; }

/* A whisper in the action log: only who whispers to whom. */
.log-talk { color: #f3d36b; font-style: italic; }

/* ---------- Speech bubbles ---------- */

.bubble-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }

.bubble-stack { position: fixed; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: min(360px, calc(100vw - 16px)); }
.bubble-stack.at-table { align-items: flex-end; }

.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  padding: 8px 12px 9px;
  border-radius: 14px;
  background: #f6f2e6;
  color: #1b1a16;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  /* Bigger since build 79 (was 14px), the Chat tab stays as it is. */
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  animation: bubble-in 0.22s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}

/* The tail points at the speaker's box: left for the boxes on the left, up for the others. */
.bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 14px;
  border: 7px solid transparent;
  border-left: 0;
  border-right-color: inherit;
}

.at-box .bubble::before { border-right-color: #f6f2e6; }
.at-box .bubble-whisper::before { border-right-color: #f3d36b; }
.at-table .bubble::before { display: none; }

.bubble-whisper { background: #f3d36b; font-style: italic; }
.bubble-name { font-family: var(--font-display); font-weight: 700; font-style: normal; font-size: 12px; letter-spacing: 0.04em; color: #5a4a1c; }
.bubble.leaving { opacity: 0; transform: translateY(-6px); }

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
