/* ZoltarChat — "Ask Zoltar" side panel for ZoltarSearch. Reuses the suite's design tokens. */
:root { --zc-w: min(420px, 38vw); --zc-z: 55; }

/* The page slides aside while the panel is open (desktop). Drawers/modals (z 61+) still overlay everything. */
#suite { transition: margin-right .28s cubic-bezier(.2,.8,.2,1); }
body.zc-open #suite { margin-right: var(--zc-w); }
body.zc-open .tray, body.zc-open .toast { left: calc(50% - var(--zc-w) / 2); }
body.zc-open .fab { right: calc(var(--zc-w) + 14px); }

/* ---------- Floating button ---------- */
#zcFab {
  position: fixed; right: 18px; bottom: 18px; z-index: var(--zc-z);
  display: inline-flex; align-items: center; gap: 9px; padding: 11px 16px 11px 12px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; letter-spacing: -.005em;
  box-shadow: 0 10px 30px rgba(0,0,0,.28), 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .18s, box-shadow .3s, opacity .18s, visibility 0s;
  cursor: pointer;
}
#zcFab:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(0,0,0,.32), 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
#zcFab .zc-logo { width: 26px; height: 26px; border-radius: 50%; background: #fff; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
#zcFab .zc-pulse { position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; animation: zc-pulse 2.8s ease-out 1.2s 3; }
@keyframes zc-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
body.zc-open #zcFab { opacity: 0; visibility: hidden; transform: translateY(8px); transition: transform .18s, opacity .18s, visibility 0s .18s; }

/* ---------- Panel ---------- */
#zcPanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--zc-w); z-index: var(--zc-z);
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); color: var(--ink); border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(0,0,0,.18);
  transform: translateX(104%); visibility: hidden;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s .28s;
  font-family: var(--font-body); font-size: 14px;
}
#zcPanel.on { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s; }

.zc-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, var(--accent)); min-height: var(--topbar-h, 60px); }
.zc-head .zc-logo { width: 36px; height: 36px; border-radius: 50%; background: #fff; flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.zc-head .zc-titles { flex: 1; min-width: 0; }
.zc-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 19px; letter-spacing: -.015em; line-height: 1.1; margin: 0; }
.zc-head .zc-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zc-head .zc-ctx { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 11px; }
.zc-head .zc-ctx .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.zc-head .btn.icon { flex: none; }

.zc-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.zc-msg { max-width: 92%; padding: 10px 13px; border-radius: 16px; line-height: 1.45; font-size: 14px; word-wrap: break-word; overflow-wrap: anywhere; }
.zc-msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; white-space: pre-wrap; }
.zc-msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.zc-msg.bot.err { background: var(--bad-soft); color: var(--bad); }
.zc-msg.bot p { margin: 0 0 8px; } .zc-msg.bot p:last-child { margin-bottom: 0; }
.zc-msg.bot ul, .zc-msg.bot ol { margin: 4px 0 8px; padding-left: 18px; }
.zc-msg.bot li { margin: 2px 0; }
.zc-msg.bot code { font-family: var(--font-mono); font-size: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 5px; border-radius: 5px; }
.zc-msg.bot table { border-collapse: collapse; font-size: 12.5px; margin: 6px 0; width: 100%; }
.zc-msg.bot th, .zc-msg.bot td { border: 1px solid var(--line-2); padding: 4px 6px; text-align: left; vertical-align: top; }
.zc-msg.bot a { color: var(--accent); }
.zc-msg.bot h1, .zc-msg.bot h2, .zc-msg.bot h3 { font-size: 14px; font-family: var(--font-body); margin: 8px 0 4px; }
.zc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.zc-meta { align-self: flex-start; font-size: 11px; color: var(--ink-3); margin: -4px 0 0 6px; }

.zc-typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 12px 14px; background: var(--surface-2); border-radius: 16px; border-bottom-left-radius: 5px; }
.zc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: zc-bounce 1.1s infinite ease-in-out; }
.zc-typing i:nth-child(2) { animation-delay: .15s; } .zc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes zc-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }

.zc-welcome { padding: 4px 2px 2px; }
.zc-welcome .eyebrow { color: var(--accent); margin-bottom: 4px; }
.zc-welcome h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -.015em; margin: 0 0 6px; }
.zc-welcome p { color: var(--ink-2); font-size: 13.5px; margin: 0; }

.zc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 8px; }
.zc-chips .zc-chip { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer; text-align: left; line-height: 1.25; transition: background .15s, border-color .15s; }
.zc-chips .zc-chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.zc-input { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.zc-input textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 42px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); line-height: 1.35; font-size: 14px; }
.zc-input textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.zc-input .zc-send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; transition: filter .15s, transform .06s; }
.zc-input .zc-send:hover { filter: brightness(1.06); } .zc-input .zc-send:active { transform: translateY(1px); }
.zc-input .zc-send[disabled] { opacity: .45; cursor: not-allowed; }
.zc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 10px; font-size: 11px; color: var(--ink-3); }
.zc-foot button { border: 0; background: none; color: var(--ink-3); font-size: 11px; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.zc-foot button:hover { color: var(--accent); }

/* ---------- Narrow screens: full-width overlay, no page shift ---------- */
@media (max-width: 760px) {
  :root { --zc-w: 100vw; }
  body.zc-open #suite { margin-right: 0; }
  body.zc-open .tray, body.zc-open .toast { left: 50%; }
  body.zc-open .fab { right: 14px; }
  #zcFab { right: 14px; bottom: 136px; padding: 10px 14px 10px 10px; font-size: 13px; }
  #zcPanel { width: 100vw; border-left: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  #suite, #zcPanel, #zcFab { transition: none !important; }
  #zcFab .zc-pulse { animation: none; }
}

/* ---------- 2.3: the 2.x shell (Life Ribbon hub, Watches, Vacations) ---------- */
body.zc-open .zw-sheet, body.zc-open .zv-sheet, body.zc-open .drawer { right: var(--zc-w); transition: transform .3s cubic-bezier(.2,.8,.2,1), right .28s cubic-bezier(.2,.8,.2,1); }
body.zc-open .zw-tray, body.zc-open .zv-tray, body.zc-open .zv-toast { left: calc(50% - var(--zc-w) / 2); }
.zc-via { align-self: flex-start; max-width: 92%; margin: -4px 0 0 6px; font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 760px) {
  body.zc-open .zw-sheet, body.zc-open .zv-sheet, body.zc-open .drawer { right: 0; }
  body.zc-open .zw-tray, body.zc-open .zv-tray, body.zc-open .zv-toast { left: 50%; }
  #zcPanel.on { z-index: 85; }
}

/* ---------- 2.4: item links in answers; modules with their own bottom bar hide the floating button ---------- */
.zc-item { display: inline; padding: 0 2px; margin: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.zc-item:hover { text-decoration-thickness: 2px; }
body.zc-nofab #zcFab { display: none; }
