/* Athena X chat client styles are scoped to the widget on each WordPress site. */
#axc-widget {
  --axc-font: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --axc-accent: #493185;
  --axc-accent-ink: #fff;
  --axc-ink: #231f29;
  --axc-muted: #625d6b;
  --axc-paper: #fff;
  --axc-canvas: #faf9fb;
  --axc-soft: #f1edf5;
  --axc-line: #e8e3eb;
  --axc-error: #963c27;
  --axc-shadow: rgb(26 16 41 / 20%);
  --axc-height: 100vh;
  --axc-edge: 22px;
  --axc-space: 18px;
  color: var(--axc-ink);
  color-scheme: light;
  font: 400 15px/1.5 var(--axc-font);
  -webkit-text-size-adjust: 100%;
}

@supports (color: color-mix(in srgb, white, black)) {
  #axc-widget {
    --axc-canvas: color-mix(in srgb, var(--axc-paper) 97%, var(--axc-accent));
    --axc-soft: color-mix(in srgb, var(--axc-paper) 93%, var(--axc-accent));
  }
}

@supports (height: 100dvh) {
  #axc-widget { --axc-height: 100dvh; }
}

#axc-widget,
#axc-widget * {
  box-sizing: border-box;
}

#axc-widget[hidden],
#axc-widget [hidden] {
  display: none !important;
}

#axc-widget .axc-sr-only,
#axc-widget .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

#axc-widget button,
#axc-widget textarea {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  margin: 0;
}

#axc-widget button {
  appearance: none;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#axc-widget button:focus-visible,
#axc-widget .axc-credit a:focus-visible,
#axc-widget #axc-messages:focus-visible {
  outline: 2px solid var(--axc-ink);
  outline-offset: 3px;
}

#axc-widget button svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

#axc-widget #axc-launcher {
  position: fixed;
  z-index: 99990;
  right: max(var(--axc-edge), env(safe-area-inset-right, 0px));
  bottom: calc(var(--axc-edge) + env(safe-area-inset-bottom, 0px));
  gap: 10px;
  min-height: 54px;
  max-width: calc(100vw - 36px);
  padding: 6px 17px 6px 7px;
  border-color: rgb(0 0 0 / 12%);
  border-radius: 18px 18px 6px 18px;
  background: var(--axc-accent);
  color: var(--axc-accent-ink);
  box-shadow: 0 10px 32px var(--axc-shadow), inset 0 1px rgb(255 255 255 / 18%);
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

#axc-widget #axc-launcher svg {
  box-sizing: content-box;
  width: 19px;
  height: 19px;
  padding: 9px;
  border: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 26%, transparent);
  border-radius: 13px 13px 5px 13px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

#axc-widget #axc-launcher[aria-expanded="true"] {
  visibility: hidden;
  pointer-events: none;
}

#axc-widget #axc-launcher span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (hover: hover) {
  #axc-widget #axc-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgb(28 19 42 / 32%);
  }
}

#axc-widget #axc-panel {
  position: fixed;
  z-index: 99991;
  right: max(var(--axc-edge), env(safe-area-inset-right, 0px));
  bottom: calc(var(--axc-viewport-bottom, 0px) + var(--axc-edge) + env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100vw - 2 * var(--axc-edge)));
  height: min(610px, calc(var(--axc-viewport-height, var(--axc-height)) - 2 * var(--axc-edge) - env(safe-area-inset-bottom, 0px)));
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--axc-line);
  border-radius: 24px 24px 8px 24px;
  background: var(--axc-paper);
  color: var(--axc-ink);
  box-shadow: 0 22px 65px var(--axc-shadow), 0 4px 16px rgb(24 17 35 / 9%);
  transform-origin: bottom right;
  animation: axc-panel-open 220ms cubic-bezier(.16,.82,.25,1) both;
}

#axc-widget .axc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  isolation: isolate;
  flex: none;
  min-height: 77px;
  padding: 12px 12px 12px var(--axc-space);
  border-bottom: 1px solid var(--axc-line);
  background: var(--axc-paper);
}

#axc-widget .axc-header::after {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  width: min(62%, 234px);
  height: 100%;
  pointer-events: none;
  content: '';
  background:
    radial-gradient(circle, color-mix(in srgb, var(--axc-accent) 32%, transparent) 1px, transparent 1.5px) right top / 8px 8px,
    linear-gradient(115deg, transparent 40%, var(--axc-soft));
  mask-image: linear-gradient(90deg, transparent, #000 85%);
  opacity: .8;
}

#axc-widget .axc-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

#axc-widget .axc-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  max-width: none;
  max-height: none;
  padding: 5px;
  margin: 0;
  border: 1px solid var(--axc-line);
  border-radius: 14px 14px 5px 14px;
  overflow: hidden;
  background: var(--axc-soft);
  color: var(--axc-ink);
  box-shadow: inset 0 0 0 2px var(--axc-paper);
}

#axc-widget .axc-avatar:has(> svg) {
  padding: 10px;
  background: var(--axc-accent);
  color: var(--axc-accent-ink);
  border-color: transparent;
  box-shadow: none;
}

#axc-widget .axc-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 5px;
  object-fit: contain;
}

#axc-widget .axc-heading {
  min-width: 0;
}

#axc-widget #axc-title {
  color: var(--axc-ink);
  font: 700 17px/1.25 var(--axc-font);
  letter-spacing: -0.025em;
  text-transform: none;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#axc-widget .axc-heading p {
  margin: 3px 0 0;
  color: var(--axc-muted);
  font: 400 12px/1.3 var(--axc-font);
}

#axc-widget #axc-close {
  background: var(--axc-paper);
  color: var(--axc-ink);
  border-color: var(--axc-line);
  border-radius: 50%;
}

#axc-widget #axc-close svg {
  width: 17px;
  height: 17px;
}

#axc-widget #axc-close:hover {
  background: var(--axc-soft);
  border-color: var(--axc-line);
}

#axc-widget #axc-messages {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--axc-space);
  background: var(--axc-canvas);
  scrollbar-width: thin;
}

#axc-widget #axc-messages:focus-visible {
  outline-offset: -3px;
}

#axc-widget .axc-message {
  width: fit-content;
  max-width: 94%;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid var(--axc-line);
  border-radius: 5px 16px 16px 16px;
  color: var(--axc-ink);
  background: var(--axc-paper);
  box-shadow: 0 2px 5px rgb(29 20 40 / 5%);
  animation: axc-open 160ms ease-out both;
}

#axc-widget .axc-message:last-child {
  margin-bottom: 0;
}

#axc-widget .axc-message-body {
  margin: 0;
  color: inherit;
  font: 400 15px/1.56 var(--axc-font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#axc-widget .axc-message-user {
  max-width: 86%;
  margin-left: auto;
  border-color: transparent;
  border-radius: 16px 5px 16px 16px;
  background: var(--axc-accent);
  color: var(--axc-accent-ink);
}

#axc-widget .axc-message-pending .axc-message-body,
#axc-widget .axc-message-error .axc-message-body {
  color: var(--axc-muted);
}

#axc-widget .axc-message-pending .axc-message-body::after {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-inline-start: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: .16em;
  content: '';
  animation: axc-thinking 1.25s ease-in-out infinite alternate;
}

#axc-widget .axc-message-error {
  border-color: var(--axc-error);
}

#axc-widget .axc-retry {
  min-height: 44px;
  padding: 6px 11px;
  margin-top: 5px;
  border-color: var(--axc-line);
  border-radius: 8px;
  background: var(--axc-paper);
  color: var(--axc-ink);
  font-size: 13px;
  font-weight: 600;
}

#axc-widget #axc-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: none;
  margin: 12px var(--axc-space) 2px;
  padding: 5px;
  border: 1px solid var(--axc-line);
  border-radius: 17px;
  background: var(--axc-canvas);
}

#axc-widget #axc-form:focus-within {
  outline: 2px solid var(--axc-ink);
  outline-offset: 1px;
}

#axc-widget #axc-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 112px;
  margin: 0;
  padding: 10px 6px 10px 10px;
  border: 0;
  border-radius: 9px;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: var(--axc-ink);
  font: 400 16px/1.5 var(--axc-font);
  resize: none;
  overflow-y: auto;
  appearance: none;
}

#axc-widget #axc-input::placeholder {
  color: var(--axc-muted);
  opacity: 1;
}

#axc-widget #axc-send {
  width: 44px;
  height: 44px;
  border-radius: 13px 13px 5px 13px;
  background: var(--axc-accent);
  color: var(--axc-accent-ink);
  transition: transform 160ms ease;
}

#axc-widget #axc-send:active:not(:disabled) {
  transform: scale(.93);
}

#axc-widget #axc-send:disabled {
  background: var(--axc-line);
  color: var(--axc-muted);
  cursor: default;
  opacity: 1;
}

#axc-widget #axc-form.axc-busy #axc-send svg {
  display: none;
}

#axc-widget #axc-form.axc-busy #axc-send::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
}

#axc-widget #axc-status {
  flex: none;
  margin: 0 var(--axc-space) 8px;
  color: var(--axc-error);
  font-size: 13px;
  line-height: 1.4;
}

#axc-widget #axc-status:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

#axc-widget .axc-credit {
  display: flex;
  flex: none;
  justify-content: center;
  margin: 0 var(--axc-space) 5px;
}

#axc-widget .axc-credit a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--axc-muted);
  font: 600 11px/1.4 var(--axc-font);
  text-decoration: none;
  text-underline-offset: 3px;
  white-space: nowrap;
}

#axc-widget .axc-credit a:hover {
  color: var(--axc-ink);
  text-decoration: underline;
}

#axc-widget .axc-credit svg {
  width: 11px;
  height: 11px;
  flex: none;
}

#axc-widget.axc-compact .axc-header {
  min-height: 52px;
  padding-block: 3px;
}

#axc-widget.axc-compact #axc-input {
  max-height: 76px;
}

#axc-widget.axc-compact #axc-form {
  margin-top: 7px;
}

#axc-widget.axc-compact .axc-credit {
  margin-bottom: 2px;
}

@media (max-width: 600px) {
  #axc-widget {
    --axc-edge: 14px;
    --axc-space: 14px;
  }

  #axc-widget #axc-launcher {
    min-height: 50px;
    border-radius: 16px 16px 6px 16px;
  }

  #axc-widget #axc-panel {
    inset: calc(var(--axc-viewport-top, 0px) + max(8px, env(safe-area-inset-top, 0px))) max(8px, env(safe-area-inset-right, 0px)) auto max(8px, env(safe-area-inset-left, 0px));
    width: auto;
    height: calc(var(--axc-viewport-height, var(--axc-height)) - max(8px, env(safe-area-inset-top, 0px)) - max(8px, env(safe-area-inset-bottom, 0px)));
    border-radius: 19px 19px 7px 19px;
  }

  #axc-widget .axc-header {
    min-height: 66px;
  }
}

@media (prefers-color-scheme: dark) {
  #axc-widget {
    --axc-ink: #f4f0f7;
    --axc-muted: #c5bdcc;
    --axc-paper: #211e28;
    --axc-canvas: #1b1821;
    --axc-soft: #31293a;
    --axc-line: #474050;
    --axc-error: #ed9b89;
    --axc-shadow: rgb(0 0 0 / 43%);
    color-scheme: dark;
  }
}

@keyframes axc-panel-open {
  from { opacity: 0; transform: translateY(9px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes axc-open {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes axc-thinking {
  from { opacity: .45; transform: scale(.8); }
  to { opacity: 1; transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  #axc-widget *,
  #axc-widget *::before,
  #axc-widget *::after,
  #axc-widget #axc-panel {
    animation: none !important;
    transition: none !important;
  }

  #axc-widget #axc-launcher:hover,
  #axc-widget #axc-send:active:not(:disabled) {
    transform: none;
  }
}
