/* Wysie standalone guest widget
   Scoped exclusively to .wysie-widget so the existing site is unchanged. */

.wysie-widget {
  --wysie-blue: #2f66e8;
  --wysie-blue-dark: #2455c7;
  --wysie-text: #182033;
  --wysie-muted: #6f7787;
  --wysie-border: #e2e5eb;
  --wysie-surface: #ffffff;
  --wysie-soft: #f5f7fb;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: inherit;
  color: var(--wysie-text);
}


.wysie-widget *,
.wysie-widget *::before,
.wysie-widget *::after {
  box-sizing: border-box;
}

.wysie-widget-toggle {
  width: 78px;
  height: 78px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wysie-surface);
  box-shadow: 0 10px 30px rgba(24, 32, 51, 0.20);
  cursor: pointer;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.wysie-widget-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(24, 32, 51, 0.24);
}

.wysie-widget-bubble {
  position: absolute;
  right: 0;
  bottom: 88px;
  z-index: 10000;
  width: 280px;
  max-width: calc(100vw - 28px);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

/* Canonical bubble presentation, also used by the dashboard welcome preview. */
.wysie-widget-bubble,
.wysie-chat-bubble {
  padding: 14px 16px;
  border: 3px solid var(--wysie-brand-color);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(24, 32, 51, 0.26);
  color: var(--wysie-text);
  font: 700 15px/1.42 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
  box-sizing: border-box;
}

.wysie-widget-bubble::after,
.wysie-chat-bubble::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -10px;
  width: 16px;
  height: 16px;
  border-right: 3px solid var(--wysie-brand-color);
  border-bottom: 3px solid var(--wysie-brand-color);
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 4px 4px 8px rgba(22, 44, 80, 0.08);
}

.wysie-widget-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.wysie-widget-toggle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wysie-widget-panel {
  position: absolute;
  right: 0;
  bottom: 94px;
  display: flex;
  flex-direction: column;
  width: min(440px, calc(100vw - 48px));
  height: min(660px, calc(100vh - 118px));
  max-height: calc(100vh - 118px);
  overflow: hidden;
  border: 1px solid var(--wysie-border);
  border-radius: 28px;
  background: var(--wysie-surface);
  box-shadow: 0 24px 70px rgba(24, 32, 51, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.wysie-widget.is-open .wysie-widget-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.wysie-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--wysie-border);
}

.wysie-widget-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.wysie-widget-identity img {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: contain;
}

.wysie-widget-identity strong {
  display: block;
  margin-bottom: 3px;
  color: var(--wysie-header-text-color, #fff);
  font-size: 25px;
  line-height: 1.05;
}

.wysie-widget-identity img.wysie-wordmark {
  width: 112px;
  height: 38px;
  flex: 0 0 auto;
  object-fit: contain;
}

.wysie-widget-identity img.wysie-wordmark[src$="wysie-logo-navy.png"] {
  width: 128px;
  height: 44px;
}

.wysie-widget-identity span {
  display: block;
  color: var(--wysie-header-text-color, #fff);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}

.wysie-widget-close {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid var(--wysie-border);
  border-radius: 50%;
  background: var(--wysie-surface);
  color: var(--wysie-text);
  font-size: 34px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.wysie-widget-merchant-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--wysie-border);
  background: #f3f7ff;
  background: color-mix(in srgb, var(--wysie-brand-color) 7%, #fff);
}

.wysie-widget-merchant-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 42%;
  max-height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: left center;
}

.wysie-widget-merchant-name {
  min-width: 0;
  color: var(--wysie-text);
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.wysie-widget-merchant-tagline {
  font-size: .88em;
  font-weight: 400;
}

.wysie-widget-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 20px 16px;
  scrollbar-width: thin;
}

.wysie-widget-welcome {
  padding: 14px 16px;
  border-radius: 24px;
  background: var(--wysie-blue);
  color: #fff;
  box-shadow: 0 5px 14px rgba(47, 102, 232, 0.18);
}

.wysie-widget-welcome strong {
  display: block;
  margin-bottom: 7px;
  font-size: 19px;
  line-height: 1.25;
}

.wysie-widget-welcome p {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.wysie-widget-suggestions-heading {
  margin: 22px 8px 10px;
  color: #2859c9;
  font-size: 20px;
  font-weight: 700;
}

.wysie-widget-suggestions {
  display: grid;
  gap: 10px;
}

.wysie-widget-suggestion {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--wysie-border);
  border-radius: 18px;
  background: #fff;
  color: var(--wysie-text);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(24, 32, 51, 0.05);
}

.wysie-widget-suggestion:hover {
  border-color: #b9c8ef;
  background: #fbfcff;
}

.wysie-widget-messages {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.wysie-widget-message {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: 17px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.wysie-widget-message.is-guest {
  justify-self: end;
  border-bottom-right-radius: 6px;
  background: var(--wysie-blue);
  color: #fff;
}

.wysie-widget-message.is-wysie {
  justify-self: start;
  border-bottom-left-radius: 6px;
  background: var(--wysie-soft);
  color: var(--wysie-text);
}

.wysie-widget-message.is-pending {
  opacity: 0.65;
}

.wysie-widget-message.is-error {
  border: 1px solid #ead2d2;
}

.wysie-widget-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--wysie-border);
  background: var(--wysie-surface);
}

.wysie-widget input.wysie-widget-input {
  min-width: 0;
  flex: 1;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--wysie-border);
  border-radius: 18px;
  outline: none;
  background: #fafbfe;
  color: var(--wysie-text);
  font: inherit;
  font-size: 16px;
}

.wysie-widget input.wysie-widget-input:focus {
  border-color: #9db4ec;
  box-shadow: 0 0 0 3px rgba(47, 102, 232, 0.10);
}

.wysie-widget-send {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 0;
  border-radius: 50%;
  background: #a9c2f5;
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.wysie-widget-send:hover:not(:disabled) {
  background: var(--wysie-blue);
}

.wysie-widget-send:disabled {
  cursor: default;
  opacity: 0.72;
}

.wysie-widget-send.is-loading {
  animation: wysie-widget-pulse 900ms ease-in-out infinite alternate;
}

@keyframes wysie-widget-pulse {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}

@media (max-width: 600px) {
  .wysie-widget {
    right: 14px;
    bottom: 14px;
  }

  .wysie-widget-toggle {
    width: 68px;
    height: 68px;
  }

  .wysie-widget-panel {
    right: -4px;
    bottom: 82px;
    width: min(390px, 92vw);
    height: 72dvh;
    max-height: 72dvh;
    border-radius: 24px;
  }

  .wysie-widget-header {
    min-height: 66px;
    padding: 8px 12px;
  }

  .wysie-widget-identity img {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .wysie-widget-identity strong {
    font-size: 20px;
  }

  .wysie-widget-identity span {
    font-size: 16px;
  }

  .wysie-widget-close {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    font-size: 30px;
  }

  .wysie-widget-merchant-brand {
    min-height: 58px;
    gap: 10px;
    padding: 7px 12px;
  }

  .wysie-widget-merchant-logo {
    max-width: 38%;
    max-height: 40px;
  }

  .wysie-widget-merchant-name {
    font-size: 17px;
  }

  .wysie-widget-body {
    padding: 10px 12px 10px;
  }

  .wysie-widget-welcome {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .wysie-widget-welcome strong {
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: 500;
  }

  .wysie-widget-welcome p {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
  }
  .wysie-widget-suggestions-heading {
    margin: 12px 4px 8px;
    font-size: 15px;
  }

  .wysie-widget-suggestions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .wysie-widget-suggestion {
    padding: 10px 9px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .wysie-widget-notice {
    padding: 0 10px 8px;
    font-size: 10px;
    line-height: 1.3;
  }
}

.wysie-widget.wysie-widget-left { right: auto; left: 24px; }
.wysie-widget.wysie-widget-right { left: auto; right: 24px; }
.wysie-widget.wysie-widget-left .wysie-widget-bubble { right: auto; left: 0; }
.wysie-widget.wysie-widget-right .wysie-widget-bubble { left: auto; right: 0; }
.wysie-widget { --wysie-brand-color: #1655d9; }
.wysie-widget-toggle {
  border: 3px solid var(--wysie-brand-color);
  background: transparent;
  box-shadow: 0 10px 28px rgba(24, 32, 51, 0.24);
}
.wysie-widget-header { background: var(--wysie-brand-color); }
@media (max-width: 640px) {
  .wysie-widget.wysie-widget-left { left: 14px; }
  .wysie-widget.wysie-widget-right { right: 14px; }
}

/* Wysie remains the standard assistant identity for every merchant. */
.wysie-avatar-composite {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1190 / 1322;
  overflow: visible;
  isolation: isolate;
}

.wysie-avatar-composite > .wysie-avatar-base {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.wysie-avatar-composite > .wysie-avatar-base {
  object-fit: contain;
  z-index: 1;
}

.wysie-widget-toggle .wysie-avatar-composite {
  width: 100%;
  height: 100%;
}

.wysie-widget-identity .wysie-avatar-composite {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
}

/* Square geometry for the supplied floating Wysie artwork. */
.wysie-widget-toggle .wysie-avatar-composite {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}

/* Merchant dashboard preview: keep the customer-facing speech bubble visible for review. */
.preview-desktop .wysie-widget:not(.is-open) .wysie-widget-bubble,
.preview-mobile .wysie-widget:not(.is-open) .wysie-widget-bubble {
  opacity: 1;
  transform: translateY(0);
}

/* Keep the knowledge and privacy notice at the base of the modal. */
.wysie-widget-notice {
  flex: 0 0 auto;
  padding: 0 14px 14px;
  color: var(--wysie-muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.wysie-widget-notice > div + div {
  margin-top: 4px;
}

/* Keep merchant theme button defaults out of Wysie's existing controls. */
.wysie-widget .wysie-widget-toggle,
.wysie-widget .wysie-widget-close,
.wysie-widget .wysie-widget-send,
.wysie-widget .wysie-widget-suggestion,
.wysie-widget .wysie-widget-voice-mic,
.wysie-widget .wysie-widget-speak {
  margin: 0;
  min-width: 0;
  min-height: 0;
  letter-spacing: normal;
  text-transform: none;
}

.wysie-widget .wysie-widget-close,
.wysie-widget .wysie-widget-send,
.wysie-widget .wysie-widget-voice-mic,
.wysie-widget .wysie-widget-speak {
  padding: 0;
}

.wysie-widget .wysie-widget-composer {
  margin: 0;
}

.wysie-widget input.wysie-widget-input {
  /* Preserve the working Appgenx input spacing without theme dependence. */
  margin: 0 0 14px;
  min-height: 0;
  box-shadow: none;
}

@media (max-width: 600px) {
  .wysie-widget input.wysie-widget-input {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* On mobile, show the notice on first opening only. */
@media (max-width: 600px) {
  .wysie-widget.wysie-widget-notice-dismissed .wysie-widget-notice {
    display: none;
  }
}
