/* ──────────────────────────────────────────────────────────
   Jack — drop-in LLM chat panel
   ──────────────────────────────────────────────────────────
   Pair with /static/shared/jack.js. Auto-mounts a fixed
   right-side panel (380px) below the shared header, with a
   collapsed-state edge tab on the right.

   All colors come from the theme system (themes.css) so the
   pane re-tints itself when the user picks a different theme.
   ────────────────────────────────────────────────────────── */

.ai-pane {
  position: fixed;
  top: var(--bl-sh-height, 52px);
  right: 0;
  bottom: 0;
  z-index: 40;
  width: var(--ai-pane-w, 380px);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg1);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: width .2s ease;
}
.ai-pane.collapsed { width: 0; border-left: none; }

.ai-pane-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
  min-height: 38px;
}
.ai-pane-title {
  font-size: 11px; font-weight: 600;
  color: var(--txt1);
  letter-spacing: 0.2px;
}
.ai-pane-collapse {
  background: transparent; border: none;
  color: var(--txt2);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 3px;
  transition: color .15s, background .15s;
}
.ai-pane-collapse:hover { color: var(--txt0); background: var(--bg3); }

.ai-msgs {
  flex: 1; overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--txt3);
  font-size: 12px;
  padding: 24px 16px;
  line-height: 1.5;
}

.ai-msg {
  max-width: 92%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg-user {
  align-self: flex-end;
  background: var(--acc-bg);
  color: var(--txt0);
  border: 1px solid var(--line);
}
.ai-msg-assistant {
  align-self: flex-start;
  background: var(--bg2);
  color: var(--txt0);
}
.ai-msg-loading {
  align-self: flex-start;
  background: transparent;
  color: var(--txt3);
  padding: 4px 8px;
}
.ai-loading-dots span {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--txt2);
  margin: 0 2px;
  animation: ai-bounce 1.2s infinite;
}
.ai-loading-dots span:nth-child(2) { animation-delay: .15s; }
.ai-loading-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

.ai-composer {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.ai-input {
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12.5px;
  background: var(--bg0);
  color: var(--txt0);
  min-height: 36px; max-height: 140px;
  outline: none;
  line-height: 1.4;
  transition: border-color .15s;
}
.ai-input:focus { border-color: var(--acc); }
.ai-input::placeholder { color: var(--txt3); }
.ai-send {
  align-self: flex-end;
  background: var(--acc); color: white;
  border: none; border-radius: 8px;
  padding: 6px 16px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.ai-send:hover:not(:disabled) { background: var(--acc-dim); }
.ai-send:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-pane-expand {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 48px;
  border-radius: 6px 0 0 6px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-right: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--txt3);
  font-size: 12px;
  z-index: 50;
  transition: color .15s;
}
.ai-pane-expand:hover { color: var(--acc); }
.ai-pane:not(.collapsed) ~ .ai-pane-expand { display: none; }
