/* AI Global Solutions — live-chat widget styles
 * Uses the site's design tokens (assets/style.css :root) so it inherits the
 * brand palette and light/dark theming automatically. No hard-coded brand
 * colours. Self-contained; safe to load on every page.
 */

.abs-chat {
  --abs-radius: 18px;
  --abs-gap: 20px;
  position: fixed;
  right: var(--abs-gap);
  bottom: var(--abs-gap);
  z-index: 2147483000; /* above site chrome, below native OS dialogs */
  font-family: "Open Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* ---------- launcher ---------- */
.abs-launch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px 13px 16px;
  border: 1px solid var(--border-str, rgba(255, 255, 255, 0.17));
  border-radius: 999px;
  background: var(--accent, #2e90fa);
  color: var(--btn-ink, #fff);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 14px 34px -12px rgba(46, 144, 250, 0.6),
    var(--shadow, 0 24px 60px -24px rgba(0, 0, 0, 0.62));
  transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.18s ease;
}
.abs-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px -12px rgba(46, 144, 250, 0.7);
}
.abs-launch:active {
  transform: translateY(0);
}
.abs-launch .abs-ico {
  display: inline-flex;
}
.abs-launch.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

/* ---------- panel ---------- */
.abs-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 2 * var(--abs-gap)));
  height: min(600px, calc(100vh - 2 * var(--abs-gap) - 8px));
  display: flex;
  flex-direction: column;
  background: var(--surface, #0f1930);
  color: var(--text, #eaf0fa);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
  border-radius: var(--abs-radius);
  box-shadow: var(--shadow, 0 24px 60px -24px rgba(0, 0, 0, 0.62)),
    0 2px 0 rgba(255, 255, 255, 0.02) inset;
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
.abs-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- header ---------- */
.abs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.09));
  background: linear-gradient(
    180deg,
    var(--surface-2, #16233f),
    var(--surface, #0f1930)
  );
}
.abs-title-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.abs-title {
  font-family: "Heebo", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.abs-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3fb950; /* semantic "online" green, per brand hero console */
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18);
  flex: none;
}
.abs-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted, #94a3be);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  flex: none;
}
.abs-close:hover {
  color: var(--text, #eaf0fa);
  background: var(--accent-soft, rgba(46, 144, 250, 0.14));
  border-color: var(--border, rgba(255, 255, 255, 0.09));
}

/* ---------- message log ---------- */
.abs-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-str, rgba(255, 255, 255, 0.17)) transparent;
}
.abs-log::-webkit-scrollbar {
  width: 8px;
}
.abs-log::-webkit-scrollbar-thumb {
  background: var(--border-str, rgba(255, 255, 255, 0.17));
  border-radius: 8px;
}

.abs-msg {
  display: flex;
  max-width: 88%;
}
.abs-user {
  align-self: flex-end;
  justify-content: flex-end;
}
.abs-assistant {
  align-self: flex-start;
}
.abs-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.abs-assistant .abs-bubble {
  background: var(--surface-2, #16233f);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.09));
  color: var(--text, #eaf0fa);
  border-bottom-left-radius: 5px;
}
.abs-user .abs-bubble {
  background: var(--accent, #2e90fa);
  color: var(--btn-ink, #fff);
  border-bottom-right-radius: 5px;
}

/* typing indicator */
.abs-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 1em;
}
.abs-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted, #94a3be);
  opacity: 0.5;
  animation: abs-blink 1.2s infinite ease-in-out both;
}
.abs-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.abs-dots span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes abs-blink {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---------- status line ---------- */
.abs-status {
  min-height: 0;
  padding: 0 16px;
  font-size: 0.78rem;
  color: var(--muted, #94a3be);
}
.abs-status:not(:empty) {
  padding: 4px 16px;
}

/* ---------- input row ---------- */
.abs-inputrow {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.09));
  background: var(--surface, #0f1930);
}
.abs-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 120px;
  min-height: 42px;
  padding: 11px 13px;
  border: 1px solid var(--border-str, rgba(255, 255, 255, 0.17));
  border-radius: 12px;
  background: var(--ground, #080d1a);
  color: var(--text, #eaf0fa);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.abs-input::placeholder {
  color: var(--muted, #94a3be);
}
.abs-input:focus {
  border-color: var(--accent, #2e90fa);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(46, 144, 250, 0.14));
}
.abs-send {
  flex: none;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  background: var(--accent, #2e90fa);
  color: var(--btn-ink, #fff);
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.12s ease, opacity 0.18s ease;
}
.abs-send:hover {
  filter: brightness(1.08);
}
.abs-send:active {
  transform: scale(0.94);
}
.abs-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- footer ---------- */
.abs-foot {
  padding: 0 14px 12px;
  text-align: center;
  background: var(--surface, #0f1930);
}
.abs-book {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-text, #6fb4ff);
  text-decoration: none;
  padding: 4px 2px;
}
.abs-book:hover {
  text-decoration: underline;
}

/* ---------- focus visibility (keyboard) ---------- */
.abs-chat button:focus-visible,
.abs-chat a:focus-visible,
.abs-chat textarea:focus-visible {
  outline: 2px solid var(--accent-text, #6fb4ff);
  outline-offset: 2px;
}

/* ---------- mobile ---------- */
@media (max-width: 480px) {
  .abs-chat {
    --abs-gap: 12px;
  }
  .abs-panel {
    width: calc(100vw - 2 * var(--abs-gap));
    height: calc(100dvh - 2 * var(--abs-gap));
    height: calc(100vh - 2 * var(--abs-gap));
  }
  .abs-launch-label {
    display: none; /* icon-only on small screens */
  }
  .abs-launch {
    padding: 14px;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .abs-panel,
  .abs-launch,
  .abs-send {
    transition: opacity 0.01ms linear;
  }
  .abs-panel {
    transform: none;
  }
  .abs-panel.open {
    transform: none;
  }
  .abs-launch:hover {
    transform: none;
  }
  .abs-dots span {
    animation: none;
    opacity: 0.6;
  }
}
