/*
 * Saariv Agentic Mode: the on/off switch, the search bar sheet and the answer panel. Shared by ai-mode.js (inside a
 * Shadow DOM on any site) and the demo pages. Deliberately quiet: the site's own colour and type, hairline
 * borders, soft shadows, no badges, glows or sparkles. The state element (the shadow wrapper, or the demo's
 * body) carries .aim, and .ai-on while Agentic Mode is on.
 */

/* ------------------------------------------------------------------ the switch */
.aim-toggle {
  all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 7px 0 14px; border-radius: 999px; cursor: pointer; user-select: none;
  background: #fff; color: #18181b; border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 20px -12px rgba(15, 23, 42, 0.35);
  font: 600 14px/1 var(--font-heading, system-ui, -apple-system, "Segoe UI", sans-serif); letter-spacing: -0.005em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease; -webkit-tap-highlight-color: transparent;
}
.aim-toggle:hover { border-color: rgba(15, 23, 42, 0.24); }
/* visitors may long-press and drag it (assistant.js makeMovable) */
.aim-toggle.is-movable { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.aim-toggle.is-pressing { transform: scale(0.97); transition: transform 0.45s ease, border-color 0.15s ease; }
.aim-toggle.is-dragging { transform: scale(1.06); cursor: grabbing;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.10), 0 18px 36px -12px rgba(15, 23, 42, 0.45); }
@media (prefers-reduced-motion: reduce) { .aim-toggle.is-pressing, .aim-toggle.is-dragging { transform: none; } }
.aim-toggle:focus-visible { outline: 2px solid var(--primary, #18181b); outline-offset: 2px; }
.aim-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: #d4d4d8;
  transition: background 0.2s ease; }
.aim-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
.aim-toggle[aria-checked="true"] .aim-track { background: var(--primary, #18181b); }
.aim-toggle[aria-checked="true"] .aim-knob { transform: translateX(14px); }

/* a second line says what it's for, so it reads as an invitation, not a setting */
.aim-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1; }
.aim-sub { font-size: 11.5px; font-weight: 500; color: #71717a; letter-spacing: 0; }
.aim-toggle.has-sub { height: 46px; padding-left: 15px; }

/* a gentle nudge on a visitor's first visits, beside the intro card */
.aim-toggle.is-hinting { animation: aim-hint 1.2s ease-out 2; }
@keyframes aim-hint {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary, #18181b) 40%, transparent),
    0 8px 20px -12px rgba(15, 23, 42, 0.35); }
  100% { box-shadow: 0 0 0 12px transparent, 0 8px 20px -12px rgba(15, 23, 42, 0.35); } }

/* ------------------------------------------------------------------ first-visit intro callout (compact) */
.aim-intro { position: fixed; z-index: 2147483002; box-sizing: border-box; padding: 9px 10px 10px 12px;
  border-radius: 12px; background: #fff; color: #18181b; border: 1px solid rgba(15, 23, 42, 0.10);
  border-top: 3px solid var(--primary, #18181b);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 14px 32px -14px rgba(15, 23, 42, 0.40);
  font: 400 13px/1.4 var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif); text-align: left;
  opacity: 0; transform: translateY(-4px); transition: opacity 0.2s ease, transform 0.2s ease; }
.aim-intro.is-above { transform: translateY(4px); border-top-width: 1px; border-bottom: 3px solid var(--primary, #18181b); }
.aim-intro.is-shown { opacity: 1; transform: none; }
.aim-intro-caret { position: absolute; top: -7px; width: 9px; height: 9px; background: var(--primary, #18181b);
  transform: rotate(45deg); }
.aim-intro.is-above .aim-intro-caret { top: auto; bottom: -7px; }
.aim-intro-head { display: flex; align-items: center; gap: 6px; }
.aim-intro-go { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  flex: 1; cursor: pointer; border-radius: 6px; }
.aim-intro-new { flex: none; padding: 1px 6px; border-radius: 999px; background: var(--primary, #18181b);
  color: var(--on-primary, #fff); font: 700 10px/16px var(--font-heading, system-ui, sans-serif);
  letter-spacing: 0.04em; text-transform: uppercase; animation: aim-intro-pulse 1.6s ease-out 0.6s 2; }
.aim-intro-title { font: 600 14px/1.3 var(--font-heading, system-ui, sans-serif); letter-spacing: -0.01em;
  white-space: nowrap; }
.aim-intro-title::after { content: " \2192"; color: var(--primary, #18181b); }
.aim-intro-go:hover .aim-intro-title { text-decoration: underline; text-underline-offset: 3px; }
.aim-intro-close { all: unset; box-sizing: border-box; flex: none; display: grid; place-items: center; width: 24px;
  height: 24px; margin: -2px -2px 0 0; border-radius: 6px; color: #71717a; font-size: 18px; line-height: 1;
  cursor: pointer; }
.aim-intro-close:hover { background: #f4f4f5; color: #18181b; }
.aim-intro-text { margin: 3px 0 0; color: #52525b; }
.aim-intro-examples { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.aim-intro-example { all: unset; box-sizing: border-box; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fafafa; color: #27272a; font-size: 12px; line-height: 18px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; }
.aim-intro-example:hover { border-color: var(--primary, #18181b); background: #fff; }
.aim-intro button:focus-visible { outline: 2px solid var(--primary, #18181b); outline-offset: 2px; }
@keyframes aim-intro-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary, #18181b) 45%, transparent); }
  100% { box-shadow: 0 0 0 7px transparent; } }

/* ------------------------------------------------------------------ the bar, sliding up from the bottom */
.aim-sheet {
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -10px 30px -20px rgba(15, 23, 42, 0.35);
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.aim.ai-on .aim-sheet { transform: none; }
.aim .aim-sheet::before { display: none; }
.aim .sa-form {
  border-radius: 12px; border: 1px solid rgba(15, 23, 42, 0.14); background: #fff; box-shadow: none;
  padding: 5px 5px 5px 44px;
}
.aim .sa-form:focus-within { border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.aim .sa-icon { left: 15px; color: var(--muted); opacity: 1; }
.aim .sa-input { font-size: 15.5px; padding: 9px 0; }
.aim .sa-input::placeholder { color: #9ca3af; }
.aim .sa-send { width: 38px; min-height: 38px; padding: 0; border-radius: 9px; display: grid; place-items: center; }
.aim .sa-form.has-attach { padding-left: 5px; }
.aim .sa-send svg { display: block; }
.aim .sa-powered { margin-top: 6px; }
.aim .sa-stop { min-height: 38px; border-radius: 9px; padding: 0 14px; font-size: 14px; }

/* ------------------------------------------------------------------ the answer panel */
/* a slim strip: "Back to site" turns Agentic Mode off, "New chat" starts over (no separate close button) */
.aim .sa-panel-head { padding: 8px 10px 4px 12px; border-bottom: 0; }
.aim .sa-close { display: none; }
.aim .sa-back, .aim .sa-new { padding: 8px 10px; font-size: 13px; }
.aim .sa-panel {
  border-radius: 14px; border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 28px 60px -28px rgba(15, 23, 42, 0.45);
  animation: aim-rise 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes aim-rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.aim .sa-scroll { padding: 22px 28px 24px; }
.aim .sa-scroll > .thread { max-width: none; }  /* the panel already is the site's content width */
.aim .sa-scroll .sa-turn { padding: 22px 0 24px; border-top: 1px solid rgba(15, 23, 42, 0.07); }
.aim .sa-scroll .sa-turn:first-child { padding-top: 0; border-top: 0; }
.aim .sa-scroll .msg-user { font: 600 17px/1.35 var(--font-heading); letter-spacing: -0.01em; margin-bottom: 12px; }
.aim .trace { display: none; }  /* tool names are for us, not visitors */

/* widgets sit in the answer like part of the page: no frame, no title strip, no "Code" button */
.aim .blk { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.aim .blk-head { padding: 0 0 8px; border: 0; }
.aim .blk-title { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.aim .blk-toggle, .aim .blk-code { display: none !important; }
.aim .blk-frame { background: transparent; }
.aim .blk-skeleton { margin: 0; border-radius: 10px; }

/* ------------------------------------------------------------------ the site behind */
.aim.ai-on .sa-scrim { opacity: 1; pointer-events: auto; background: rgba(15, 23, 42, 0.06);
  -webkit-backdrop-filter: none; backdrop-filter: none; }

@media (max-width: 640px) {
  .aim .sa-send { width: 42px; min-height: 42px; }
  .aim .sa-form.has-attach { padding-left: 4px; }
  .aim .sa-scroll { padding: 16px 18px 18px; }
  .aim-sheet { padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .aim-sheet, .aim-knob, .aim-track, .aim-intro { transition: none; }
  .aim-intro-new, .aim-toggle.is-hinting { animation: none; }
  .aim .sa-panel { animation: none; }
}
