/* ORIA — website assistant widget. Every class is prefixed with "oa-". */

.oa-root {
  --oa-navy: #071A42;
  --oa-accent: #1E3BB3;
  --oa-accent-2: #13247D;
  --oa-surface: #F5F5F2;
  --oa-line: #E4E4DE;
  --oa-text: #071A42;
  --oa-muted: #4A4A4A;
  --oa-radius: 16px;
  font-family: 'Inter', Arial, system-ui, sans-serif;
  color: var(--oa-text);
  -webkit-font-smoothing: antialiased;
}

.oa-root *,
.oa-root *::before,
.oa-root *::after {
  box-sizing: border-box;
}

.oa-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: none;
}

.oa-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- launcher ---------- */

.oa-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--oa-navy);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(7, 26, 66, .28), 0 2px 6px rgba(7, 26, 66, .18);
  transition: background-color .2s ease, transform .2s ease;
}

.oa-launcher:hover {
  background: var(--oa-accent);
  transform: translateY(-1px);
}

.oa-launcher:focus {
  outline: none;
}

.oa-launcher:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--oa-accent);
}

.oa-launcher .oa-icon {
  width: 26px;
  height: 26px;
}

.oa-launcher .oa-icon-close,
.oa-is-open .oa-launcher .oa-icon-chat {
  display: none;
}

.oa-is-open .oa-launcher .oa-icon-close {
  display: block;
}

/* ---------- panel ---------- */

.oa-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  right: max(20px, env(safe-area-inset-right));
  z-index: 2147483001;
  width: 380px;
  height: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  color: var(--oa-text);
  border: 1px solid var(--oa-line);
  border-radius: var(--oa-radius);
  box-shadow: 0 18px 48px rgba(7, 26, 66, .22), 0 2px 8px rgba(7, 26, 66, .12);
  font-size: 14.5px;
  line-height: 1.55;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}

.oa-is-open .oa-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .2s ease, transform .2s ease, visibility 0s linear 0s;
}

/* header */

.oa-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 14px 16px;
  background: var(--oa-navy);
  color: #fff;
}

.oa-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--oa-accent);
  color: #fff;
}

.oa-avatar .oa-icon {
  width: 20px;
  height: 20px;
}

.oa-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.oa-title {
  margin: 0;
  padding: 0;
  font-family: 'Manrope', Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: #fff;
}

.oa-subtitle {
  margin: 2px 0 0;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.3;
  color: rgba(255, 255, 255, .8);
}

.oa-icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.oa-icon-btn .oa-icon {
  width: 20px;
  height: 20px;
}

.oa-icon-btn:hover {
  background: rgba(255, 255, 255, .12);
}

.oa-icon-btn:focus {
  outline: none;
}

.oa-icon-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

/* messages */

.oa-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  background: var(--oa-surface);
}

.oa-messages:focus {
  outline: none;
}

.oa-messages:focus-visible {
  box-shadow: inset 0 0 0 2px var(--oa-accent);
}

.oa-msg {
  display: flex;
  margin: 0 0 10px;
}

.oa-msg-user {
  justify-content: flex-end;
}

.oa-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  overflow-wrap: anywhere;
}

.oa-msg-bot .oa-bubble {
  background: #fff;
  color: var(--oa-text);
  border: 1px solid var(--oa-line);
  border-bottom-left-radius: 4px;
}

.oa-msg-user .oa-bubble {
  background: var(--oa-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.oa-bubble p {
  margin: 0 0 8px;
  padding: 0;
}

.oa-bubble p:last-child {
  margin-bottom: 0;
}

.oa-bubble strong {
  font-weight: 600;
}

.oa-list {
  margin: 2px 0 8px;
  padding: 0 0 0 18px;
  list-style: disc;
}

.oa-list:last-child {
  margin-bottom: 0;
}

.oa-list li {
  margin: 0 0 3px;
  padding: 0;
}

.oa-link {
  color: var(--oa-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.oa-link:hover {
  color: var(--oa-accent-2);
}

.oa-msg-bot .oa-bubble {
  max-width: 92%;
}

/* sourced answers */

.oa-quote {
  margin: 4px 0 6px;
  padding: 8px 10px 8px 12px;
  border: 0;
  border-left: 3px solid var(--oa-accent);
  border-radius: 0 8px 8px 0;
  background: #F4F6FC;
  color: var(--oa-text);
  font-style: normal;
  quotes: none;
}

.oa-quote::before,
.oa-quote::after {
  content: none;
}

.oa-quote p {
  margin: 0;
}

.oa-bubble .oa-quote .oa-quote-q,
.oa-bubble .oa-faq-q {
  margin: 0 0 4px;
  font-weight: 600;
}

.oa-linklist {
  margin: 2px 0 0;
}

.oa-hl {
  padding: 0 1px;
  border-radius: 3px;
  background: rgba(30, 59, 179, .14);
  color: inherit;
  font-weight: 600;
}

.oa-bubble .oa-source {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--oa-muted);
}

.oa-bubble .oa-source:last-child {
  margin-bottom: 0;
}

.oa-related {
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--oa-line);
}

.oa-bubble .oa-related-label {
  margin: 0 0 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--oa-muted);
}

.oa-related-list {
  margin: 0;
  padding: 0 0 0 16px;
  list-style: disc;
  font-size: 13.5px;
}

.oa-related-list li {
  margin: 0 0 2px;
  padding: 0;
}

.oa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.oa-bubble .oa-suggestions {
  margin: 10px 0 0;
}

.oa-msg-error .oa-bubble {
  background: #FFF5F3;
  border-color: #F0C8C0;
  color: #6B1D10;
}

.oa-retry {
  display: inline-block;
  margin: 8px 0 0;
  padding: 6px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.oa-retry:hover {
  background: rgba(107, 29, 16, .07);
}

/* suggestion chips */

.oa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}

.oa-chip {
  display: inline-block;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #C8D0EE;
  border-radius: 999px;
  background: #fff;
  color: var(--oa-accent);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.oa-chip:hover {
  background: #EEF1FB;
  border-color: var(--oa-accent);
}

.oa-chip-primary,
.oa-chip-primary:visited {
  background: var(--oa-navy);
  border-color: var(--oa-navy);
  color: #fff;
}

.oa-chip-primary:hover {
  background: var(--oa-accent);
  border-color: var(--oa-accent);
  color: #fff;
}

.oa-chip:focus {
  outline: none;
}

.oa-chip:focus-visible,
.oa-link:focus-visible,
.oa-retry:focus-visible {
  outline: 2px solid var(--oa-accent);
  outline-offset: 2px;
}

/* typing indicator */

.oa-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 14px;
}

.oa-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8A93AE;
  animation: oa-blink 1.2s infinite ease-in-out both;
}

.oa-dot-2 {
  animation-delay: .15s;
}

.oa-dot-3 {
  animation-delay: .3s;
}

@keyframes oa-blink {
  0%, 80%, 100% {
    opacity: .35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* composer */

.oa-form {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--oa-line);
  background: #fff;
}

.oa-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  max-height: 120px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #CDD2DE;
  border-radius: 12px;
  background: #fff;
  color: var(--oa-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  overflow-y: auto;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.oa-input::placeholder {
  color: #6B7183;
  opacity: 1;
}

.oa-input:focus {
  border-color: var(--oa-accent);
  box-shadow: 0 0 0 3px rgba(30, 59, 179, .18);
}

.oa-input[readonly] {
  background: #F7F7F5;
}

.oa-send {
  flex: none;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--oa-accent);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}

.oa-send .oa-icon {
  width: 20px;
  height: 20px;
}

.oa-send:hover {
  background: var(--oa-accent-2);
}

.oa-send:disabled {
  opacity: .5;
  cursor: default;
}

.oa-send:focus {
  outline: none;
}

.oa-send:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--oa-accent);
}

.oa-note {
  flex: none;
  margin: 0;
  padding: 0 14px 10px;
  background: #fff;
  color: var(--oa-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

/* ---------- small screens: full-screen sheet ---------- */

@media (max-width: 600px) {
  .oa-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
    transform: translateY(24px);
    transform-origin: bottom center;
  }

  .oa-header {
    padding-top: 14px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .oa-note {
    padding-bottom: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .oa-input {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  html.oa-lock,
  html.oa-lock body {
    overflow: hidden;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .oa-launcher,
  .oa-chip,
  .oa-send,
  .oa-panel,
  .oa-is-open .oa-panel {
    transition: none;
  }

  .oa-panel,
  .oa-launcher:hover {
    transform: none;
  }

  .oa-dot {
    animation: none;
    opacity: .7;
  }
}

@media print {
  .oa-root {
    display: none !important;
  }
}
