/**
 * SG Assistant — Front-end widget styles.
 *
 * This stylesheet defines every visual aspect of the chat widget. It
 * is designed to be completely isolated from the surrounding theme
 * (every selector is scoped under `.sg-root`) and to inherit the
 * theme's typography and colors whenever possible, so the widget
 * looks like a natural part of the site rather than a foreign
 * element.
 *
 * =====================================================================
 * STRUCTURE
 * =====================================================================
 *
 * The file is organized into twelve sections:
 *
 *   1.  TOKENS       — CSS custom properties (design system).
 *   2.  RESET        — box-model and inheritance normalization.
 *   3.  ROOT         — the widget's outer container.
 *   4.  LAUNCHER     — the floating button and the teaser.
 *   5.  PANEL        — the widget's main surface.
 *   6.  HEAD         — the panel's header.
 *   7.  FEED         — the message log.
 *   8.  CARDS        — the result cards and their breadcrumbs.
 *   9.  CHIPS        — the suggestion chips.
 *  10.  COMPOSE      — the input form and the send button.
 *  11.  TYPEAHEAD    — the live-search dropdown.
 *  12.  RESPONSIVE   — mobile adjustments and reduced-motion support.
 *
 * =====================================================================
 * DESIGN TOKENS
 * =====================================================================
 *
 * Every color, spacing value, and radius is defined as a CSS custom
 * property on `.sg-root`. This makes the widget trivially themable:
 * a theme can override any token by setting it on `.sg-root` (or on
 * `:root`) after this stylesheet loads. The harmonization script
 * (`chat.js`) writes some of these tokens at runtime based on the
 * site's own colors.
 *
 * The tokens fall into five groups:
 *
 *   - `--sg-accent*` — the primary brand color.
 *   - `--sg-bg`, `--sg-surface`, `--sg-line` — surfaces and borders.
 *   - `--sg-text`, `--sg-muted`, `--sg-on-accent` — text colors.
 *   - `--sg-radius*`, `--sg-shadow` — shape and depth.
 *   - `--sg-size`, `--sg-*-icon-size` — sizing.
 *
 * =====================================================================
 * ISOLATION STRATEGY
 * =====================================================================
 *
 * Every selector in this file begins with `.sg-root` (or, for the
 * dark-mode overrides, `.sg-root.sg-dark`). This guarantees that the
 * widget's styles cannot accidentally leak into the surrounding page,
 * even when the theme uses aggressive global selectors like
 * `button { ... }` or `* { box-sizing: content-box }`.
 *
 * In addition, the widget resets every inherited property that a
 * theme might have set in an unexpected way (`letter-spacing`,
 * `text-transform`, `text-shadow`, `box-shadow`, `background-image`,
 * and so on) at the root, so the widget starts from a known state.
 *
 * @package   SG_Assistant
 * @author    Salman Gholami
 * @copyright 2026 Salman Gholami
 * @license   GPL-2.0-or-later
 * @link      https://salmangholami.ir
 * @since     3.0.0
 */

/* =====================================================================
 * 1. TOKENS — design system
 * ===================================================================== */

/**
 * The widget's design tokens.
 *
 * All values are declared on `.sg-root`, so a theme can override
 * them by setting the same properties on the same selector. The
 * harmonization script in `chat.js` rewrites a subset of these
 * tokens at runtime when the "harmonize" option is enabled.
 */
.sg-root {
  /* --- Accent --- */
  --sg-accent: #0e7c7b;
  --sg-on-accent: #ffffff;
  --sg-accent-soft: rgba(14, 124, 123, 0.1);

  /* --- Surfaces and lines --- */
  --sg-bg: #ffffff;
  --sg-surface: #f4f6f7;
  --sg-line: #e2e7ea;

  /* --- Text --- */
  --sg-text: #1d2b32;
  --sg-muted: #6b7a82;

  /* --- Shape and depth --- */
  --sg-radius: 18px;
  --sg-radius-sm: 13px;
  --sg-radius-xs: 9px;
  --sg-shadow: 0 20px 50px rgba(15, 30, 38, 0.18);

  /* --- Sizing --- */
  --sg-size: 60px;
  --sg-support-icon-size: 14px;

  /*
	 * The visual viewport height is set by the bootstrap script on
	 * mobile. It lets the panel resize itself when the on-screen
	 * keyboard opens, without relying on `dvh`, which some mobile
	 * browsers do not update reliably.
	 */
  --sg-vvh: 100vh;
}

/**
 * Dark-mode tokens.
 *
 * Applied when the widget itself is in dark mode, either because the
 * administrator set the theme to `dark` or because the harmonization
 * script detected a dark site background.
 */
.sg-root.sg-dark {
  --sg-bg: #171e22;
  --sg-surface: #1f272c;
  --sg-line: #2e393f;
  --sg-text: #e9eef0;
  --sg-muted: #9aa8af;
  --sg-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* =====================================================================
 * 2. RESET — normalize inherited properties
 * ===================================================================== */

/**
 * Every element inside the widget inherits the theme's font by
 * default, so the widget always uses the same typeface as the rest
 * of the site. Properties that themes commonly set in surprising
 * ways are reset here so the widget starts from a known state.
 */
.sg-root,
.sg-root *,
.sg-root *::before,
.sg-root *::after {
  box-sizing: border-box;
  font-family: inherit;
  letter-spacing: normal;
  text-shadow: none;
}

/**
 * Remove the browser's default outline and replace it with a
 * theme-consistent one when the element is focused via the keyboard.
 * The `:focus-visible` pseudo-class is used so that a mouse click
 * does not produce an outline.
 */
.sg-root :focus-visible {
  outline: 2px solid var(--sg-accent);
  outline-offset: 2px;
}

/**
 * Buttons and inputs inside the widget follow the same reset rules.
 * Setting `min-width: 0` and `min-height: 0` prevents flexbox from
 * refusing to shrink them, which is a common source of layout bugs.
 */
.sg-root button,
.sg-root input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  margin: 0;
  min-width: 0;
  min-height: 0;
  width: auto;
  text-transform: none;
  box-shadow: none;
  background-image: none;
}

/**
 * All buttons in the widget share the same base style: no border, no
 * background, no padding, cursor pointer. Specific buttons add their
 * own visual treatment on top of this base.
 */
.sg-root button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  border-radius: 0;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.sg-root button:disabled {
  opacity: 0.5;
  cursor: progress;
}

/**
 * Links inside the widget inherit the surrounding text color and
 * never carry an underline in their default state. Specific links
 * add visual affordances (borders, colors) as needed.
 */
.sg-root a {
  color: inherit;
  text-decoration: none;
  box-shadow: none;
}

.sg-root a:hover {
  text-decoration: none;
}

/**
 * Images inside the widget never overflow their container and never
 * have a border-radius or shadow of their own; specific images set
 * those properties as needed.
 */
.sg-root img {
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
  display: block;
}

/**
 * The `[hidden]` attribute is respected even when the theme has set
 * `display: block` on every element.
 */
.sg-root [hidden] {
  display: none !important;
}

/* =====================================================================
 * 3. ROOT — outer container
 * ===================================================================== */

/**
 * The outer container of every widget instance.
 *
 * The container is `position: fixed` in bubble mode and
 * `position: static` in inline mode. It uses `display: flex` with a
 * column direction so that the dock and the panel stack correctly.
 *
 * The container's text direction is deliberately locked to
 * left-to-right, regardless of the site's own direction. This is
 * because the widget's inner elements use logical properties
 * (`inset-inline-*`, `margin-inline-*`) that behave correctly under
 * either direction, but the container's flex layout must be
 * predictable: reversing it in RTL would flip the order of the dock
 * and the panel in an unintended way. The panel itself has its own
 * `dir` attribute set by the script, so the content inside the panel
 * is correctly oriented for the site's language.
 */
.sg-root {
  position: fixed;
  bottom: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.85;
  color: var(--sg-text);
  text-align: start;
  direction: ltr;
}

/**
 * Left-aligned launcher.
 */
.sg-root.sg-left {
  left: 20px;
  align-items: flex-start;
}

/**
 * Right-aligned launcher.
 */
.sg-root.sg-right {
  right: 20px;
  align-items: flex-end;
}

/**
 * Inline embed mode: the widget flows inside the page's content
 * rather than floating above it.
 */
.sg-root.sg-embed {
  position: static;
  display: block;
  width: 100%;
  margin: 0 0 24px;
}

/* =====================================================================
 * 4. LAUNCHER — floating button and teaser
 * ===================================================================== */

/**
 * The dock holds the launcher and the teaser.
 */
.sg-root .sg-dock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row-reverse;
}

.sg-root.sg-right .sg-dock {
  flex-direction: row;
}

/**
 * The launcher button.
 *
 * Its size is controlled by `--sg-size`, which the script sets from
 * the administrator's settings. When the launcher has text, its
 * width becomes auto and it turns into a pill-shaped button.
 */
.sg-root .sg-launcher {
  position: relative;
  width: var(--sg-size);
  height: var(--sg-size);
  padding: 0;
  border-radius: 50%;
  background: var(--sg-accent);
  color: var(--sg-on-accent);
  box-shadow: var(--sg-shadow);
  flex: 0 0 auto;
}

.sg-root .sg-launcher.sg-has-text {
  width: auto;
  height: 56px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 700;
}

.sg-root .sg-launcher svg {
  width: calc(var(--sg-size) * 0.44);
  height: calc(var(--sg-size) * 0.44);
  flex: 0 0 auto;
}

.sg-root .sg-launcher-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sg-root .sg-launcher.sg-has-text .sg-launcher-img {
  width: 28px;
  height: 28px;
}

/**
 * The pulse ring around the launcher, shown while the teaser is
 * visible. The ring is a pseudo-element so it does not affect the
 * button's layout.
 */
.sg-root .sg-launcher::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid var(--sg-accent);
  opacity: 0;
}

.sg-root .sg-launcher.sg-pulse::after {
  animation: sg-pulse 2.4s ease-out 3;
}

@keyframes sg-pulse {
  0% {
    opacity: 0.55;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(1.22);
  }
  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

/**
 * The teaser bubble.
 *
 * It appears next to the launcher after a delay and disappears on
 * its own after a few seconds. The bubble's direction is set by the
 * script through the `dir` attribute, so its text is correctly
 * oriented for the site's language.
 */
.sg-root .sg-teaser {
  position: relative;
  max-width: 240px;
  padding: 11px 14px;
  background: var(--sg-bg);
  color: var(--sg-text);
  border: 1px solid var(--sg-line);
  border-radius: 16px;
  box-shadow: var(--sg-shadow);
  font-size: 12.5px;
  line-height: 1.75;
  cursor: pointer;
  text-align: start;
  display: block;
}

.sg-root .sg-teaser[dir="rtl"] {
  direction: rtl;
}

.sg-root .sg-teaser[dir="ltr"] {
  direction: ltr;
}

.sg-root .sg-teaser b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}

.sg-root .sg-teaser-x {
  position: absolute;
  top: -8px;
  inset-inline-end: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sg-surface);
  border: 1px solid var(--sg-line);
  color: var(--sg-muted);
  font-size: 14px;
  line-height: 1;
}

/* =====================================================================
 * 5. PANEL — main surface
 * ===================================================================== */

/**
 * The panel is the widget's main surface. It is a flex column with
 * four children: the header, the feed, the compose area, and the
 * footer.
 *
 * The panel's height is bounded so that it fits on small screens
 * without overflowing. In bubble mode, `100dvh` is used with a
 * `100vh` fallback for browsers that do not support `dvh`. In
 * inline mode, the height is controlled by the shortcode's height
 * attribute.
 */
.sg-root .sg-panel {
  display: flex;
  flex-direction: column;
  width: 388px;
  height: min(640px, calc(100vh - 130px));
  height: min(640px, calc(100dvh - 130px));
  margin-bottom: 12px;
  background: var(--sg-bg);
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius);
  box-shadow: var(--sg-shadow);
  overflow: hidden;
  text-align: start;
}

.sg-root .sg-panel[dir="rtl"] {
  direction: rtl;
}

.sg-root .sg-panel[dir="ltr"] {
  direction: ltr;
}

.sg-root.sg-embed .sg-panel {
  width: 100%;
  height: var(--sg-embed-height, 520px);
  margin: 0;
}

/* =====================================================================
 * 6. HEAD — panel header
 * ===================================================================== */

.sg-root .sg-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  background: var(--sg-accent);
  color: var(--sg-on-accent);
}

.sg-root .sg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sg-root .sg-avatar svg {
  width: 19px;
  height: 19px;
}

.sg-root .sg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sg-root .sg-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.5;
}

.sg-root .sg-head-text b {
  font-size: 14.5px;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-root .sg-head-text small {
  font-size: 11px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-root .sg-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.sg-root .sg-phone:hover {
  background: rgba(255, 255, 255, 0.26);
}

.sg-root .sg-phone svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.sg-root .sg-head button {
  width: 30px;
  height: 30px;
  border-radius: var(--sg-radius-xs);
  color: inherit;
  font-size: 17px;
  line-height: 1;
  opacity: 0.85;
}

.sg-root .sg-head button:hover {
  background: rgba(255, 255, 255, 0.16);
  opacity: 1;
}

/* =====================================================================
 * 7. FEED — message log
 * ===================================================================== */

.sg-root .sg-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 4px;
  background: var(--sg-surface);
  scrollbar-width: thin;
  scroll-behavior: auto;
}

/**
 * The spacer is an empty element at the bottom of the feed. The
 * script changes its height to keep the user's question anchored to
 * the top of the visible area while the answer is inserted below.
 */
.sg-root .sg-spacer {
  flex: 0 0 auto;
}

/**
 * A message bubble.
 *
 * The border-radius uses physical corners rather than logical ones,
 * because the tail should always be on the trailing edge of the
 * bubble, regardless of the site's direction. The `[dir="rtl"]`
 * override below flips the tail for RTL panels.
 */
.sg-root .sg-msg {
  max-width: 90%;
  margin: 0 0 10px;
  padding: 10px 13px;
  background: var(--sg-bg);
  border: 1px solid var(--sg-line);
  border-radius: 14px 14px 14px 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.9;
  color: var(--sg-text);
}

.sg-root .sg-panel[dir="rtl"] .sg-msg {
  border-radius: 14px 14px 4px 14px;
}

/**
 * The user's own messages are right-aligned in LTR, left-aligned in
 * RTL, and use the accent color as their background.
 */
.sg-root .sg-msg.sg-me {
  margin-inline-start: auto;
  background: var(--sg-accent);
  border-color: transparent;
  color: var(--sg-on-accent);
  border-radius: 14px 14px 4px 14px;
  font-weight: 600;
}

.sg-root .sg-panel[dir="rtl"] .sg-msg.sg-me {
  border-radius: 14px 14px 14px 4px;
}

/**
 * Note messages carry auxiliary information and use a lighter
 * treatment.
 */
.sg-root .sg-msg.sg-note {
  font-size: 11.5px;
  color: var(--sg-muted);
  background: transparent;
  border-style: dashed;
}

/**
 * The waiting bubble's dot pulses to indicate progress.
 */
.sg-root .sg-msg.sg-wait {
  color: var(--sg-muted);
  font-style: normal;
}

.sg-root .sg-msg.sg-wait::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-start: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: sg-blink 1s infinite ease-in-out;
  vertical-align: middle;
}

@keyframes sg-blink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* =====================================================================
 * 8. CARDS — result cards and breadcrumbs
 * ===================================================================== */

.sg-root .sg-group {
  margin: 0 0 14px;
}

.sg-root .sg-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
}

.sg-root .sg-group .sg-cards {
  margin: 0;
}

/**
 * The breadcrumb trail shown above each group of results.
 */
.sg-root .sg-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 2px 6px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--sg-muted);
}

.sg-root .sg-crumb {
  color: inherit;
}

.sg-root a.sg-crumb {
  border-bottom: 1px dotted currentColor;
}

.sg-root a.sg-crumb:hover {
  color: var(--sg-accent);
}

.sg-root .sg-crumb-sep {
  opacity: 0.55;
}

/**
 * A single result card.
 */
.sg-root .sg-card {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px;
  background: var(--sg-bg);
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius-sm);
  transition:
    border-color 0.15s,
    transform 0.15s;
}

.sg-root .sg-card:hover {
  border-color: var(--sg-accent);
  transform: translateY(-1px);
}

/**
 * An "exact match" card — the result whose title matches the user's
 * query word-for-word — is highlighted with a colored border and a
 * soft shadow so it stands out from the other results.
 */
.sg-root .sg-card-exact {
  border-color: var(--sg-accent);
  box-shadow:
    0 0 0 1px var(--sg-accent),
    0 10px 24px -6px var(--sg-accent-soft);
}

.sg-root .sg-card-exact .sg-card-title {
  color: var(--sg-accent);
}

.sg-root .sg-card img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: var(--sg-radius-xs);
  flex: 0 0 auto;
  background: var(--sg-surface);
  margin: 0;
}

.sg-root .sg-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.sg-root .sg-card-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.75;
  color: var(--sg-text);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-root .sg-card-text {
  font-size: 11.5px;
  color: var(--sg-muted);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-root .sg-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-top: 2px;
}

.sg-root .sg-card-price {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--sg-text);
}

.sg-root .sg-card-old {
  font-size: 11px;
  color: var(--sg-muted);
  text-decoration: line-through;
}

.sg-root .sg-card-stock {
  font-size: 11px;
  color: var(--sg-accent);
  font-weight: 600;
}

.sg-root .sg-card-stock.sg-out {
  color: var(--sg-muted);
  font-weight: 400;
}

.sg-root .sg-card-note {
  font-size: 10px;
  color: var(--sg-muted);
}

/**
 * The "More results" button.
 */
.sg-root .sg-more {
  display: flex;
  margin: 0 auto 12px;
  padding: 8px 18px;
  border: 1px solid var(--sg-line);
  border-radius: 999px;
  background: var(--sg-bg);
  color: var(--sg-text);
  font-size: 12px;
}

.sg-root .sg-more:hover {
  border-color: var(--sg-accent);
  color: var(--sg-accent);
}

/* =====================================================================
 * 9. CHIPS — suggestion buttons
 * ===================================================================== */

.sg-root .sg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.sg-root .sg-chip {
  display: inline-block;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--sg-line);
  border-radius: 999px;
  background: var(--sg-bg);
  color: var(--sg-text);
  font-size: 11.5px;
  line-height: 1.7;
  text-align: start;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-root .sg-chip:hover {
  border-color: var(--sg-accent);
  background: var(--sg-accent-soft);
  color: var(--sg-accent);
}

/**
 * A "pick" chip — used for the disambiguation options — carries a
 * stronger visual treatment so the user understands that choosing it
 * will trigger a specific action.
 */
.sg-root .sg-chip-pick {
  border-color: var(--sg-accent);
  color: var(--sg-accent);
  font-weight: 700;
  background: var(--sg-accent-soft);
}

/* =====================================================================
 * 10. COMPOSE — input form
 * ===================================================================== */

.sg-root .sg-compose {
  position: relative;
  border-top: 1px solid var(--sg-line);
  background: var(--sg-bg);
  padding: 10px 12px 8px;
}

.sg-root .sg-form {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.sg-root .sg-input {
  flex: 1;
  height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--sg-line);
  border-radius: 12px;
  background: var(--sg-surface);
  color: var(--sg-text);
  font-size: 13px;
  line-height: 1.6;
}

.sg-root .sg-input::placeholder {
  color: var(--sg-muted);
  opacity: 1;
}

.sg-root .sg-input:focus {
  border-color: var(--sg-accent);
  background: var(--sg-bg);
}

.sg-root .sg-send {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  background: var(--sg-send-bg, var(--sg-accent));
  color: var(--sg-send-fg, var(--sg-on-accent));
  flex: 0 0 44px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.sg-root .sg-send:hover {
  filter: brightness(1.06);
}

.sg-root .sg-send:active {
  filter: brightness(0.94);
  transform: scale(0.96);
}

.sg-root .sg-send svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/**
 * In RTL, the send icon is mirrored horizontally, so its visual
 * direction matches the reading direction.
 */
.sg-root .sg-panel[dir="rtl"] .sg-send svg {
  transform: scaleX(-1);
}

/* =====================================================================
 * 11. TYPEAHEAD — live-search dropdown
 * ===================================================================== */

.sg-root .sg-typeahead {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline: 12px;
  background: var(--sg-bg);
  border: 1px solid var(--sg-line);
  border-radius: var(--sg-radius-sm);
  box-shadow: var(--sg-shadow);
  overflow: hidden auto;
  max-height: 232px;
  z-index: 2;
}

.sg-root .sg-typeahead button {
  display: block;
  width: 100%;
  padding: 9px 13px;
  text-align: start;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--sg-text);
  border-bottom: 1px solid var(--sg-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-root .sg-typeahead button:last-child {
  border-bottom: 0;
}

.sg-root .sg-typeahead button:hover {
  background: var(--sg-accent-soft);
  color: var(--sg-accent);
}

/* =====================================================================
 * 12. FOOTER — note and support link
 * ===================================================================== */

.sg-root .sg-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 13px 10px;
  background: var(--sg-bg);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--sg-muted);
}

.sg-root .sg-foot .sg-support {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--sg-accent);
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}

.sg-root .sg-foot .sg-support-icon {
  display: inline-flex;
  flex: 0 0 auto;
}

.sg-root .sg-foot .sg-support-icon svg {
  width: var(--sg-support-icon-size);
  height: var(--sg-support-icon-size);
  flex: 0 0 auto;
}

.sg-root .sg-foot .sg-support-img {
  width: var(--sg-support-icon-size);
  height: var(--sg-support-icon-size);
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 auto;
}

/* =====================================================================
 * 13. RESPONSIVE — mobile adjustments
 * ===================================================================== */

@media (max-width: 480px) {
  /**
	 * On mobile, respect the safe area at the bottom of the screen
	 * so the launcher is not hidden behind the home indicator.
	 */
  .sg-root {
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }

  /**
	 * When the panel is open on mobile, it takes almost the full
	 * width of the screen and its position overrides the
	 * left/right offsets set by the script.
	 */
  .sg-root.sg-open {
    left: 12px !important;
    right: 12px !important;
    align-items: center !important;
  }

  .sg-root .sg-panel {
    width: 100%;
    max-width: 460px;
    height: min(85vh, calc(var(--sg-vvh) - 24px));
  }

  /**
	 * On mobile, the launcher is hidden when the panel is open, so
	 * the panel can use the full width of the screen.
	 */
  .sg-root.sg-open .sg-dock {
    display: none;
  }

  /**
	 * The teaser is narrower on mobile to fit next to the smaller
	 * launcher.
	 */
  .sg-root .sg-teaser {
    max-width: 200px;
  }

  /**
	 * The input's font size is bumped to 16px on mobile. Below that
	 * threshold, iOS Safari zooms the page when the input is
	 * focused, which is jarring.
	 */
  .sg-root .sg-input {
    font-size: 16px;
  }
}

/* =====================================================================
 * 14. PREFERS-REDUCED-MOTION — accessibility
 * ===================================================================== */

/**
 * When the visitor has requested reduced motion, disable every
 * animation and transition in the widget. This is required by WCAG
 * 2.1 success criterion 2.3.3.
 */
@media (prefers-reduced-motion: reduce) {
  .sg-root *,
  .sg-root *::before,
  .sg-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
