/* Compact messenger UI. Data flow and chat actions remain in site-chat.js. */
.site-chat {
  --site-chat-panel-bg: #11131b;
  --site-chat-panel-border: rgba(255,255,255,.1);
  --site-chat-soft-bg: rgba(255,255,255,.06);
  --site-chat-soft-border: rgba(255,255,255,.09);
  --site-chat-bubble-assistant: rgba(255,255,255,.075);
  --site-chat-bubble-user: linear-gradient(135deg, #ee756a, #c9453d);
  --site-chat-on-user: #fff;
}
.site-chat__panel {
  width: min(408px, calc(100vw - 32px));
  height: min(680px, calc(100dvh - 96px));
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(155deg, #1a1d28, #101218 52%, #0d0f15);
  box-shadow: 0 28px 80px rgba(0,0,0,.46);
}
.site-chat__header { min-height: 72px; padding: 14px 16px; background: rgba(255,255,255,.025); }
.site-chat__avatar { width: 40px; height: 40px; box-shadow: 0 0 0 3px rgba(109,214,143,.13); }
.site-chat__manager-name { font-size: 15px; }
.site-chat__manager-role { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.site-chat__manager-meta { color: #70d994; font-size: 11px; }
.site-chat__control { width: 36px; height: 36px; border-radius: 12px; font-size: 0; line-height: 0; }
.site-chat__body { min-height: 0; padding: 0; background: radial-gradient(circle at 8% 0, rgba(230,190,152,.07), transparent 32%), #101218; }
.site-chat__timeline { min-height: 0; padding: 18px 14px 8px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(230,190,152,.44) transparent; }
.site-chat__timeline::-webkit-scrollbar { width: 5px; }
.site-chat__timeline::-webkit-scrollbar-thumb { background: rgba(230,190,152,.44); border-radius: 99px; }
.site-chat__day { width: max-content; margin: 0 auto 14px; padding: 5px 10px; font-size: 10px; border-radius: 999px; }
.site-chat__message { max-width: 86%; margin-bottom: 10px; }
.site-chat__bubble { padding: 10px 12px; border-radius: 16px; font-size: 14px; line-height: 1.42; box-shadow: 0 5px 16px rgba(0,0,0,.1); }
.site-chat__message--assistant .site-chat__bubble { border-top-left-radius: 5px; }
.site-chat__message--user .site-chat__bubble { border-top-right-radius: 5px; }
.site-chat__message-time { margin: 0 4px 4px; font-size: 10px; }
.site-chat__message--emoji { width: fit-content; max-width: none; }
.site-chat__message--emoji .site-chat__bubble--emoji {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: clamp(42px, 5.4vw, 56px);
  line-height: .98;
}
.site-chat__attachments { gap: 8px; }
.site-chat__attachment--image { border-radius: 14px; overflow: hidden; }
.site-chat__attachment--image img { aspect-ratio: 4/3; object-fit: cover; }
.site-chat__message--image .site-chat__attachment--image img { aspect-ratio: 4 / 5; object-fit: cover; }
.site-chat__attachment--audio { width: min(100%, 272px); gap: 7px; padding: 10px; border: 1px solid var(--site-chat-soft-border); border-radius: 14px; background: var(--site-chat-soft-bg); }
.site-chat__attachment--audio { color: inherit; }
.site-chat__audio-toggle { background: #e96e63; }
.site-chat__attachment--audio .site-chat__attachment-name { color: inherit; font-size: 12px; }
.site-chat__attachment--audio .site-chat__attachment-caption span { font-size: 10px; }
.site-chat__composer { padding: 10px 12px 14px; background: linear-gradient(180deg, rgba(16,18,24,.78), #11131b); }
.site-chat__composer-shell { min-height: 50px; padding: 6px; border-radius: 17px; background: rgba(255,255,255,.065); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.site-chat__input { min-height: 38px; max-height: 112px; padding: 9px 6px; font-size: 14px; line-height: 1.4; }
.site-chat__char-counter { min-height: 13px; margin: 4px 8px 0 auto; color: var(--site-chat-muted); font-size: 10px; line-height: 1.3; text-align: right; }
.site-chat__char-counter.is-warning { color: #ef796c; font-weight: 700; }
.site-chat__emoji-toggle, .site-chat__send { width: 38px; height: 38px; border-radius: 12px; }
.site-chat__send { background: linear-gradient(135deg, #ef796c, #c8443c); box-shadow: 0 8px 18px rgba(200,68,60,.25); }
.site-chat__suggestions { padding: 0 14px 10px; }
.site-chat__chips { gap: 6px; }
.site-chat__chip { min-height: 32px; padding: 6px 9px; border-radius: 10px; font-size: 11px; }
.site-chat__photo-dialog { width: min(440px, calc(100vw - 28px)); border-radius: 20px; }
/* Keep messenger controls compact, reachable and independent from the page scroll. */
.site-chat__launcher { min-height: 56px; border-radius: 18px; }
.site-chat__control, .site-chat__emoji-toggle, .site-chat__send { min-width: 44px; min-height: 44px; }
.site-chat__emoji { position: relative; }
.site-chat__emoji-panel, .site-chat__emoji-popover { position: absolute !important; z-index: 30; right: 0; bottom: calc(100% + 10px); width: min(280px, calc(100vw - 40px)); max-height: 220px; overflow: auto; padding: 8px; grid-template-columns: repeat(6, minmax(0,1fr)); border-radius: 16px; box-shadow: 0 18px 42px rgba(0,0,0,.42); }
.site-chat__emoji-option { min-width: 38px; min-height: 38px; border-radius: 10px; }
.site-chat__photo-dialog { max-height: min(760px, calc(100dvh - 28px)); overflow: auto; }
.site-chat__photo-dialog img { max-height: min(58dvh, 520px); object-fit: contain; }
.site-chat__timeline img { content-visibility: auto; }
.site-chat__panel [data-site-chat-close]:focus-visible, .site-chat__panel button:focus-visible, .site-chat__panel a:focus-visible { outline: 3px solid rgba(239,199,159,.9); outline-offset: 2px; }

/* The emoji control is intentionally a quiet icon, not a second input field.
   The popover keeps the touch target, while the reactions stay visually light. */
.site-chat__emoji-toggle {
  border: 0;
  background: transparent;
  color: var(--theme-text-soft);
  box-shadow: none;
  transition: color 160ms ease, transform 160ms ease;
}

.site-chat__emoji-toggle:hover,
.site-chat__emoji-toggle[aria-expanded="true"] {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--theme-text-strong);
  transform: translateY(-1px) scale(1.08);
}

.site-chat__emoji-toggle:focus-visible {
  color: var(--theme-text-strong);
  outline: 2px solid color-mix(in srgb, var(--theme-accent) 78%, transparent);
  outline-offset: 2px;
  transform: translateY(-1px) scale(1.08);
}

.site-chat__emoji-toggle:focus:not(:focus-visible) {
  outline: none;
}

.site-chat__emoji-popover {
  gap: 2px;
  padding: 6px;
  border: 0;
  background: color-mix(in srgb, var(--theme-surface-2) 96%, transparent);
  box-shadow: 0 18px 38px color-mix(in srgb, var(--theme-bg) 30%, transparent);
}

.site-chat__emoji-option {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 10px;
  background: transparent;
}

.site-chat__emoji-option:hover {
  background: transparent;
  box-shadow: none;
  transform: translateY(-1px) scale(1.08);
}

.site-chat__emoji-option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-accent) 78%, transparent);
  outline-offset: 1px;
  transform: translateY(-1px) scale(1.08);
}

.site-chat__emoji-option:focus:not(:focus-visible) {
  outline: none;
}

/* site-chat-modern originally pinned the messenger to a dark palette.  These
   tokens let it follow the active site preset instead of leaving a dark island
   when the visitor switches to a light theme. */
html[class*="theme-preset--light"] .site-chat {
  --site-chat-panel-bg: #fffdf9;
  --site-chat-panel-border: color-mix(in srgb, var(--theme-border-strong) 72%, transparent);
  --site-chat-soft-bg: color-mix(in srgb, var(--theme-control-bg) 92%, white 8%);
  --site-chat-soft-border: color-mix(in srgb, var(--theme-control-border) 82%, transparent);
  --site-chat-bubble-assistant: color-mix(in srgb, var(--theme-surface-2) 72%, white 28%);
  --site-chat-bubble-user: linear-gradient(135deg, var(--theme-main), var(--theme-accent));
  --site-chat-on-user: #fff;
}

html[class*="theme-preset--light"] .site-chat__panel {
  background: linear-gradient(155deg, color-mix(in srgb, white 92%, var(--theme-surface) 8%), var(--theme-surface) 58%, var(--theme-surface-2));
  box-shadow: 0 28px 70px color-mix(in srgb, var(--theme-accent-strong) 14%, transparent);
}

html[class*="theme-preset--light"] .site-chat__header {
  background: color-mix(in srgb, white 82%, var(--theme-surface) 18%);
}

html[class*="theme-preset--light"] .site-chat__body {
  background: radial-gradient(circle at 8% 0, color-mix(in srgb, var(--theme-main) 10%, transparent), transparent 34%), var(--theme-surface);
}

html[class*="theme-preset--light"] .site-chat__composer {
  background: linear-gradient(180deg, color-mix(in srgb, white 72%, transparent), var(--theme-surface));
}

html[class*="theme-preset--light"] .site-chat__composer-shell {
  background: color-mix(in srgb, white 78%, var(--theme-surface-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.88);
}

html[class*="theme-preset--light"] .site-chat__emoji-popover {
  background: color-mix(in srgb, white 94%, var(--theme-surface));
  box-shadow: 0 18px 36px color-mix(in srgb, var(--theme-accent-strong) 14%, transparent);
}

html[class*="theme-preset--light"] .site-chat__panel [data-site-chat-close]:focus-visible,
html[class*="theme-preset--light"] .site-chat__panel button:focus-visible,
html[class*="theme-preset--light"] .site-chat__panel a:focus-visible {
  outline-color: color-mix(in srgb, var(--theme-accent) 76%, white 24%);
}
@media (max-width: 600px) {
  .site-chat { right: 12px; bottom: 12px; }
  .site-chat__launcher { min-height: 54px; padding: 8px 14px 8px 8px; }
  .site-chat__panel { width: calc(100vw - 24px); height: min(720px, calc(100dvh - 24px)); border-radius: 20px; }
  .site-chat__message { max-width: 90%; }
  .site-chat__panel { bottom: max(12px, env(safe-area-inset-bottom)); }
  .site-chat__composer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .site-chat__emoji-panel, .site-chat__emoji-popover { right: -4px; width: min(280px, calc(100vw - 32px)); }
}
@media (prefers-reduced-motion: reduce) { .site-chat *, .site-chat *::before, .site-chat *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; } }

@media (hover: none) and (pointer: coarse) {
  .site-chat__emoji {
    display: none;
  }
}
