/* The Cortex chat widget, as a customer sees it. Used by the hero mock-up, the
 * widget showcase and the floating advisor panel.
 *
 * Theming is driven by custom properties so the widget builder can change them
 * live: --wg-primary / --wg-on-primary (header and launcher) and the
 * data-theme="light|dark" palette. */

.wg {
  --wg-primary: var(--nx-cortex);
  --wg-on-primary: var(--nx-ink);
  --wg-user: var(--nx-pulse);
  --wg-bg: #FAFAFA;
  --wg-sf: #FFFFFF;
  --wg-sf2: #F1F5F9;
  --wg-bd: #E2E8F0;
  --wg-tx: #0E1C2A;
  --wg-tx2: #475569;
  --wg-tx3: #64748B;
  --wg-bot: #0E1C2A;
  --wg-bot-fg: var(--nx-cortex);

  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--wg-bg);
  color: var(--wg-tx);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 64px -20px rgba(14, 28, 42, .38), 0 0 0 1px rgba(14, 28, 42, .06);
  transition: background .3s var(--ease), color .3s var(--ease);
}

.wg[data-theme="dark"] {
  --wg-bg: #0E1C2A;
  --wg-sf: #15273A;
  --wg-sf2: #1E3349;
  --wg-bd: #22384F;
  --wg-tx: #F1F5F9;
  --wg-tx2: #CBD5E1;
  --wg-tx3: #94A3B8;
  --wg-bot: #22D3EE;
  --wg-bot-fg: #0E1C2A;
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .06);
}

.wg__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: var(--wg-primary);
  color: var(--wg-on-primary);
  transition: background .3s var(--ease), color .3s var(--ease);
}

.wg__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--nx-ink);
  color: var(--nx-cortex);
}

.wg__avatar .icon {
  --icon-size: 20px;
}

.wg__id {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.wg__name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.wg__status {
  font-size: 11.5px;
  opacity: .82;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wg__close {
  flex: 0 0 auto;
  display: flex;
  padding: 6px;
  background: none;
  border: none;
  color: inherit;
  opacity: .8;
  cursor: pointer;
}

.wg__close:hover {
  opacity: 1;
}

.wg__close .icon {
  --icon-size: 17px;
}

.wg__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px 14px;
  background: var(--wg-bg);
}

.wg__row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.wg__row--user {
  align-items: flex-end;
}

.wg__bubble {
  max-width: 88%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--wg-sf2);
  color: var(--wg-tx);
  border-radius: 16px 16px 16px 4px;
}

.wg__row--user .wg__bubble {
  background: var(--wg-user);
  color: var(--nx-white);
  border-radius: 16px 16px 4px 16px;
}

.wg__bubble .cx-source {
  background: var(--wg-bd);
  color: var(--wg-tx2);
}

.wg__typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--wg-sf2);
  border-radius: 16px 16px 16px 4px;
}

.wg__typing span {
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--wg-tx3);
  animation: nxPulse 1s ease-in-out infinite;
}

.wg__typing span:nth-child(2) {
  animation-delay: .15s;
}

.wg__typing span:nth-child(3) {
  animation-delay: .3s;
}

/* Suggestions */

.wg__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.wg__chip {
  padding: 7px 12px;
  border: 1px solid var(--wg-bd);
  border-radius: var(--r-pill);
  background: var(--wg-sf);
  color: var(--wg-tx);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.3;
  text-align: left;
}

button.wg__chip {
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}

button.wg__chip:hover {
  border-color: var(--nx-pulse);
}

/* Hand-off actions */

.wg__handoff {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.wg__action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--nx-white);
  background: var(--nx-whatsapp);
}

.wg__action:hover {
  color: var(--nx-white);
  filter: brightness(.95);
}

.wg__action .icon {
  --icon-size: 18px;
}

.wg__action--mail {
  background: transparent;
  color: var(--wg-tx2);
  border: 1px solid var(--wg-bd);
  font-weight: 500;
}

.wg__action--mail:hover {
  color: var(--wg-tx);
  border-color: var(--wg-tx3);
}

/* Composer */

.wg__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--wg-bg);
  border-top: 1px solid var(--wg-bd);
}

.wg__input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--wg-bd);
  border-radius: 12px;
  background: var(--wg-sf2);
  color: var(--wg-tx3);
  font-family: inherit;
  font-size: 13.5px;
}

input.wg__input {
  color: var(--wg-tx);
}

input.wg__input::placeholder {
  color: var(--wg-tx3);
}

.wg__send {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--nx-pulse);
  color: var(--nx-white);
}

button.wg__send {
  cursor: pointer;
}

.wg__send .icon {
  --icon-size: 17px;
}

.wg__powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 0 10px;
  background: var(--wg-bg);
  font-size: 10.5px;
  color: var(--wg-tx3);
}

.wg__powered img {
  height: 11px;
  width: auto;
  display: block;
}

/* Floating launcher */

.wg-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: var(--r-pill);
  background: var(--wg-primary, var(--nx-cortex));
  box-shadow: 0 12px 28px -8px rgba(14, 116, 144, .55);
  transition: background .3s var(--ease);
}

.wg-launcher img {
  width: 30px;
  height: auto;
  display: block;
}
