/* STACKGee website assistant: launcher button and the chat panel. Uses the tokens from site.css. */

.assist-launch {
  position: fixed; right: 18px; bottom: 18px; z-index: 41;
  /* Icon only at every width; aria-label and title carry the name. */
  display: inline-flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: var(--pill);
  background: var(--blue-700); color: #fff;
  font: inherit; font-weight: 700; line-height: 1; cursor: pointer;
  /* The thin light ring keeps the button visible over the dark hero and page heads. */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .28), var(--shadow-3);
  transition: background-color .15s var(--ease), transform .15s var(--ease);
}
.assist-launch:hover { background: var(--blue-800); }
.assist-launch:active { transform: translateY(1px); }
.assist-launch:focus-visible { outline: 3px solid var(--blue-400); outline-offset: 3px; }
.assist-launch .icon { width: 24px; height: 24px; }
.assist-launch span { display: none; }
.assist-launch:hover { transform: translateY(-2px) scale(1.05); }
.assist-has-wa .assist-launch { bottom: 80px; }
html.has-cookie-bar .assist-launch { bottom: calc(var(--cookie-bar-h, 0px) + 18px); }
html.has-cookie-bar .assist-has-wa .assist-launch { bottom: calc(var(--cookie-bar-h, 0px) + 80px); }

/* The panel. Its open state is :popover-open, or [open] where Popover is missing. */
.assist-panel {
  position: fixed; inset: auto 18px 84px auto; z-index: 42;
  width: min(400px, calc(100vw - 36px)); height: min(600px, calc(100dvh - 110px));
  margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-l);
  background: #fff; color: var(--text); box-shadow: var(--shadow-3);
}
.assist-panel:is(:popover-open, [open]) { display: flex; flex-direction: column; animation: assist-in .18s var(--ease); }
@keyframes assist-in { from { opacity: 0; translate: 0 8px; } }
@media (prefers-reduced-motion: reduce) { .assist-panel:is(:popover-open, [open]) { animation: none; } }

.assist-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px;
  background: radial-gradient(120% 140% at 0% 0%, #0d3a6d 0%, var(--navy) 60%); color: #d6e6f7;
}
.assist-avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #8fd3ad; }
.assist-avatar .icon { width: 18px; height: 18px; }
.assist-heading { flex: 1; min-width: 0; }
.assist-heading h2 { margin: 0; color: #fff; font-size: 1rem; line-height: 1.3; }
.assist-heading p { margin: 0; font-size: .8rem; color: #9fb6cf; }
.assist-close {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer;
}
.assist-close:hover { background: rgba(255, 255, 255, .12); }
.assist-close:focus-visible { outline: 2px solid #8fd3ad; outline-offset: 1px; }

.assist-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); }
.assist-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: .94rem; line-height: 1.5; }
.assist-msg p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.assist-bot { align-self: flex-start; border: 1px solid var(--line); border-bottom-left-radius: 4px; background: #fff; }
.assist-user { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--blue-700); color: #fff; }
.assist-pending p { color: var(--muted); font-style: italic; }
.assist-notice { margin: 0 0 6px !important; padding: 6px 8px; border-radius: 8px; background: var(--amber-100); color: var(--amber-700); font-size: .82rem; }
.assist-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.assist-actions a {
  display: inline-flex; align-items: center; padding: 6px 11px; border: 1px solid var(--blue-200); border-radius: var(--pill);
  background: var(--blue-50); color: var(--blue-700); font-size: .85rem; font-weight: 700; text-decoration: none;
}
.assist-actions a:hover { border-color: var(--blue-700); }
.assist-actions a:focus-visible { outline: 3px solid var(--blue-400); outline-offset: 1px; }

.assist-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 16px 12px; list-style: none; background: var(--surface); }
.assist-suggest[hidden] { display: none; }
.assist-suggest button {
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--pill); background: #fff;
  color: var(--ink); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.assist-suggest button:hover { border-color: var(--blue-700); color: var(--blue-700); }
.assist-suggest button:focus-visible { outline: 3px solid var(--blue-400); outline-offset: 1px; }

.assist-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.assist-form[hidden] { display: none; }
.assist-form textarea {
  flex: 1; min-height: 44px; max-height: 120px; field-sizing: content; resize: none;
  padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 12px;
  font: inherit; font-size: 1rem; line-height: 1.4; color: var(--ink); background: #fff;
}
.assist-form textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
.assist-send {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: var(--blue-700); color: #fff; cursor: pointer;
}
.assist-send:hover { background: var(--blue-800); }
.assist-send:disabled { opacity: .55; cursor: progress; }
.assist-send:focus-visible { outline: 3px solid var(--blue-400); outline-offset: 2px; }

.assist-foot { padding: 8px 14px 12px; background: #fff; font-size: .76rem; color: var(--muted); }
.assist-foot p { margin: 0; }
.assist-foot a { color: var(--blue-700); }
.assist-human { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px !important; }
.assist-human a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .82rem; text-decoration: none; }
.assist-human a:hover { text-decoration: underline; }
.assist-human .icon { width: 15px; height: 15px; }

@media (max-width: 560px) {
  .assist-panel { inset: auto 0 0 0; width: 100%; height: min(85dvh, 640px); border-radius: var(--radius-l) var(--radius-l) 0 0; border-width: 1px 0 0; }
}

@media print { .assist { display: none; } }
@media (forced-colors: active) { .assist-launch, .assist-panel, .assist-msg { border: 1px solid CanvasText; } }
