/* InnoPair Health — assistant widget (all pages). Matches the landing page's glass + sky-blue language. */

.assist-root {
  --as-sky: #38bdf8;
  --as-blue: #2563eb;
  --as-deep: #1d4ed8;
  --as-glass: rgb(255 255 255 / 0.82);
  --as-glass-border: rgb(255 255 255 / 0.9);
  --as-shadow: 0 1px 2px rgb(15 23 42 / 0.05), 0 24px 60px rgb(37 99 235 / 0.18);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: var(--font-sans);
}

/* ---------- Launcher ---------- */
.assist-toggle {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.55);
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 30% 20%, rgb(255 255 255 / 0.45), transparent 45%),
    linear-gradient(140deg, rgb(56 189 248 / 0.92), rgb(37 99 235 / 0.94) 60%, rgb(29 78 216 / 0.96));
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.6),
    inset 0 -6px 14px rgb(29 78 216 / 0.35),
    0 10px 28px rgb(37 99 235 / 0.38),
    0 0 0 6px rgb(56 189 248 / 0.12);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.assist-toggle::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgb(56 189 248 / 0.45);
  opacity: 0;
  animation: assist-pulse 3.2s ease-out 1.5s 3;
  pointer-events: none;
}
.assist-toggle:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 0.6),
    inset 0 -6px 14px rgb(29 78 216 / 0.35),
    0 14px 34px rgb(37 99 235 / 0.45),
    0 0 0 8px rgb(56 189 248 / 0.16);
}
.assist-toggle:focus-visible { outline: 2px solid var(--as-blue); outline-offset: 4px; }
.assist-toggle svg { position: absolute; transition: transform 260ms cubic-bezier(.2,.7,.2,1), opacity 200ms ease; filter: drop-shadow(0 1px 2px rgb(29 78 216 / 0.35)); }
.assist-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.assist-root.open .assist-toggle .assist-icon-chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
.assist-root.open .assist-toggle .assist-icon-close { opacity: 1; transform: none; }
.assist-root.open .assist-toggle::after { animation: none; }
@keyframes assist-pulse {
  0% { opacity: 0.9; transform: scale(0.95); }
  70%, 100% { opacity: 0; transform: scale(1.35); }
}

/* ---------- Nudge ---------- */
.assist-nudge {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 260px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--as-glass-border);
  border-radius: 16px 16px 4px 16px;
  background: var(--as-glass);
  box-shadow: var(--as-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: assist-in 300ms cubic-bezier(.2,.7,.2,1);
}
.assist-nudge[hidden] { display: none; }
.assist-nudge-body { padding: 8px 0; border: 0; background: none; color: var(--text-body); font-size: var(--text-sm); text-align: left; cursor: pointer; }
.assist-nudge-body b { color: var(--as-blue); }
.assist-nudge-close { flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; cursor: pointer; }
.assist-nudge-close:hover { background: var(--slate-100); color: var(--text); }

/* ---------- Panel ---------- */
.assist-panel {
  display: flex;
  flex-direction: column;
  width: min(384px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--as-glass-border);
  border-radius: 24px;
  background:
    radial-gradient(80% 40% at 50% 0%, rgb(56 189 248 / 0.12), transparent 70%),
    var(--as-glass);
  box-shadow: var(--as-shadow);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  backdrop-filter: blur(20px) saturate(1.2);
  transform-origin: bottom right;
  animation: assist-in 260ms cubic-bezier(.2,.7,.2,1);
}
.assist-panel[hidden] { display: none !important; }
@keyframes assist-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }

.assist-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 10px 14px 16px;
  background: linear-gradient(120deg, var(--as-sky), var(--as-blue) 65%, var(--as-deep));
  color: #fff;
}
.assist-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgb(255 255 255 / 0.45);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.18);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 0.5);
}
.assist-avatar svg { width: 22px; height: 22px; }
.assist-heading { flex: 1; min-width: 0; }
.assist-heading h2 { margin: 0; color: #fff; font-size: var(--text-base); font-weight: 700; letter-spacing: -0.01em; }
.assist-heading p { display: flex; align-items: center; gap: 6px; margin: 1px 0 0; color: rgb(255 255 255 / 0.85); font-size: var(--text-xs); }
.assist-status { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 2px rgb(255 255 255 / 0.35); }
.assist-icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.assist-icon-btn:hover { background: rgb(255 255 255 / 0.18); }
.assist-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.assist-stream {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px 16px 8px;
  overscroll-behavior: contain;
}
.assist-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: 88%; }
.assist-msg.enter { animation: assist-msg-in 240ms ease-out; }
@keyframes assist-msg-in { from { opacity: 0; transform: translateY(6px); } }
.assist-msg p {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 6px;
  background: #fff;
  color: var(--text-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  box-shadow: 0 2px 8px rgb(15 23 42 / 0.04);
}
.assist-msg.user { align-self: flex-end; align-items: flex-end; }
.assist-msg.user p {
  border-color: transparent;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, var(--as-sky), var(--as-blue));
  color: #fff;
  box-shadow: 0 6px 16px rgb(37 99 235 / 0.22);
}
.assist-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.assist-action {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #1e293b;
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.assist-action:hover { background: var(--as-blue); }

.assist-msg.typing p { display: flex; gap: 4px; padding: 13px 14px; }
.assist-msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-400); animation: assist-dot 1s ease-in-out infinite; }
.assist-msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.assist-msg.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes assist-dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.assist-suggest {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px 10px;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.assist-suggest::-webkit-scrollbar { display: none; }
.assist-chip {
  flex: none;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: rgb(239 246 255 / 0.9);
  color: var(--as-deep);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.assist-chip:hover { border-color: var(--as-blue); background: #dbeafe; }

.assist-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgb(15 23 42 / 0.05);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.assist-form:focus-within { border-color: var(--as-blue); box-shadow: 0 0 0 3px rgb(37 99 235 / 0.15); }
.assist-form input,
.assist-form input:focus {
  flex: 1;
  min-width: 0;
  min-height: 36px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  font-size: var(--text-sm) !important;
  outline: none;
}
.assist-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--as-sky), var(--as-blue));
  color: #fff;
  box-shadow: 0 4px 12px rgb(37 99 235 / 0.3);
  cursor: pointer;
  transition: transform 150ms ease;
}
.assist-send:hover { transform: translateX(2px); }
.assist-foot { margin: 0; padding: 8px 16px 12px; color: var(--text-muted); font-size: 0.6875rem; text-align: center; }

/* Keep page toasts clear of the launcher. */
body:has(.assist-root) .toast { right: 100px; }

@media (max-width: 640px) {
  .assist-root { right: 16px; bottom: 16px; }
  .assist-root.open { left: 0; right: 0; bottom: 0; align-items: stretch; gap: 0; }
  .assist-root.open .assist-toggle { display: none; }
  .assist-panel { width: 100%; height: min(85vh, 640px); border-radius: 24px 24px 0 0; transform-origin: bottom center; }
  body:has(.assist-root) .toast { right: var(--space-4); bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .assist-toggle::after, .assist-msg.typing i { animation: none; }
  .assist-panel, .assist-nudge, .assist-msg.enter { animation: none; }
}

/* ---------- Ollie ---------- */
.assist-toggle { overflow: hidden; }
.assist-toggle .assist-ollie {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(160deg, #e0f2fe, #bfdbfe);
  object-fit: cover;
  object-position: 50% 30%;
  transition: transform 260ms cubic-bezier(.2,.7,.2,1), opacity 200ms ease;
}
.assist-toggle:hover .assist-ollie { transform: scale(1.06) rotate(-4deg); }
.assist-root.open .assist-toggle .assist-ollie { opacity: 0; transform: rotate(90deg) scale(0.6); }
.assist-avatar.ollie { overflow: hidden; padding: 0; background: linear-gradient(160deg, #e0f2fe, #bfdbfe); }
.assist-avatar.ollie img { width: 100%; height: 100%; object-fit: cover; }

.assist-msg.bot:not(.typing), .assist-msg.bot.typing { flex-direction: row; align-items: flex-end; gap: 8px; }
.assist-msg-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(160deg, #e0f2fe, #bfdbfe); object-fit: cover; box-shadow: 0 2px 6px rgb(15 23 42 / 0.12); }
.assist-msg-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
/* Only the last message in a run of Ollie's replies shows his face. */
.assist-msg.bot:has(+ .assist-msg.bot) .assist-msg-avatar { visibility: hidden; }

.assist-nudge-body { display: flex; align-items: center; gap: 10px; }
.assist-nudge-body img { flex: none; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(160deg, #e0f2fe, #bfdbfe); object-fit: cover; }
