/* =============================================================================
   Oasis TTC — "Ask Oasis" floating assistant
   Every selector is namespaced .ottc-chat* / #ottc-chat* so nothing here can
   collide with styles.css. Nothing in styles.css is modified.
   Colours mirror the site tokens (deep-teal #2c1a5e, mid-teal #6d28d9,
   accent-gold #f59e0b / #fbbf24, paper #faf8f3, ink #17202a).
   z-index sits below the homepage preloader (100000) and cursor (99998/99999).
   ========================================================================== */

.ottc-chat {
  --oc-deep: #2c1a5e;
  --oc-mid: #6d28d9;
  --oc-gold: #f59e0b;
  --oc-gold-2: #fbbf24;
  --oc-paper: #f7f5fb;
  --oc-ink: #17202a;
  --oc-line: rgba(23, 32, 42, .1);
  --oc-muted: #5b6472;
  --oc-surface: #ffffff;
  --oc-bubble-bot: #ffffff;
  --oc-sans: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --oc-display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --oc-ease: cubic-bezier(.22, 1, .36, 1);
  position: fixed;
  right: clamp(14px, 2.2vw, 26px);
  bottom: clamp(14px, 2.2vw, 26px);
  z-index: 99000;
  font-family: var(--oc-sans);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------- proactive nudge -- */
.ottc-chat__teaser {
  display: none;
  align-items: flex-start;
  gap: 6px;
  max-width: min(304px, calc(100vw - 32px));
  padding: 4px 4px 4px 0;
  border-radius: 16px;
  background: var(--oc-surface);
  box-shadow: 0 14px 36px rgba(21, 15, 46, .2), 0 2px 6px rgba(21, 15, 46, .1);
}

.ottc-chat__teaser.is-on { display: flex; animation: ottcRise .45s var(--oc-ease); }
.ottc-chat.is-open .ottc-chat__teaser { display: none; }

.ottc-chat__teaser-body {
  flex: 1 1 auto;
  display: block;
  padding: 12px 4px 12px 15px;
  border: 0;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--oc-ink);
}

.ottc-chat__teaser-body strong {
  display: block;
  font: 700 .9rem/1.3 var(--oc-display);
  color: var(--oc-deep);
}

.ottc-chat__teaser-body span {
  display: block;
  margin-top: 3px;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--oc-muted);
}

.ottc-chat__teaser-x {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 6px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  background: none;
  color: var(--oc-muted);
}

.ottc-chat__teaser-x:hover { background: rgba(23, 32, 42, .07); color: var(--oc-ink); }
.ottc-chat__teaser-x svg { width: 13px; height: 13px; }

/* ------------------------------------------------------------- launcher -- */
.ottc-chat__launcher {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 0 16px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: #150f2e;
  font: 700 .95rem/1 var(--oc-display);
  letter-spacing: .01em;
  background: linear-gradient(96deg, var(--oc-gold-2), var(--oc-gold));
  box-shadow: 0 10px 26px rgba(245, 158, 11, .42), 0 2px 6px rgba(21, 15, 46, .18);
  transition: transform .22s var(--oc-ease), box-shadow .25s ease, opacity .2s ease;
}

.ottc-chat__launcher:hover,
.ottc-chat__launcher:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(245, 158, 11, .5), 0 3px 8px rgba(21, 15, 46, .2);
}

.ottc-chat__launcher:focus-visible { outline: 3px solid var(--oc-mid); outline-offset: 3px; }
.ottc-chat__launcher svg { width: 24px; height: 24px; flex: none; }

.ottc-chat__launcher::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid var(--oc-gold);
  animation: ottcPulse 2.4s ease-out 3;
  pointer-events: none;
}

@keyframes ottcPulse {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}

/* unread dot, shown with the proactive nudge */
.ottc-chat__badge {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .25s ease, transform .25s var(--oc-ease);
}

.ottc-chat__badge.is-on { opacity: 1; transform: scale(1); }

.ottc-chat.is-open .ottc-chat__launcher {
  transform: scale(.86);
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- panel -- */
.ottc-chat__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(392px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 40px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--oc-paper);
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(21, 15, 46, .32), 0 4px 12px rgba(21, 15, 46, .14);
  color: var(--oc-ink);
}

.ottc-chat.is-open .ottc-chat__panel {
  display: flex;
  animation: ottcRise .34s var(--oc-ease);
}

@keyframes ottcRise {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- header -- */
.ottc-chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  background: linear-gradient(120deg, var(--oc-deep), var(--oc-mid));
  color: #fff;
}

.ottc-chat__avatar {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(96deg, var(--oc-gold-2), var(--oc-gold));
  color: #150f2e;
  font: 800 1rem/1 var(--oc-display);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .16);
}

.ottc-chat__titles { min-width: 0; flex: 1 1 auto; }

.ottc-chat__title {
  margin: 0;
  font: 700 1.02rem/1.2 var(--oc-display);
  letter-spacing: -.01em;
}

.ottc-chat__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  font-size: .74rem;
  color: rgba(255, 255, 255, .74);
}

.ottc-chat__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .22);
}

.ottc-chat__hbtn {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  transition: background .18s ease;
}

.ottc-chat__hbtn + .ottc-chat__hbtn { margin-left: 6px; }
.ottc-chat__hbtn:hover { background: rgba(255, 255, 255, .26); }
.ottc-chat__hbtn:focus-visible { outline: 2px solid var(--oc-gold); outline-offset: 2px; }
.ottc-chat__hbtn svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------- messages -- */
.ottc-chat__log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
}

.ottc-chat__log::-webkit-scrollbar { width: 8px; }
.ottc-chat__log::-webkit-scrollbar-thumb {
  background: rgba(109, 40, 217, .26);
  border-radius: 8px;
}

.ottc-chat__group { display: flex; align-items: flex-end; gap: 8px; }
.ottc-chat__group--me { justify-content: flex-end; }

.ottc-chat__ava {
  width: 27px;
  height: 27px;
  flex: none;
  margin-bottom: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--oc-deep), var(--oc-mid));
  color: #fff;
  font: 700 .68rem/1 var(--oc-display);
}

.ottc-chat__stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 84%;
}

.ottc-chat__group--me .ottc-chat__stack { align-items: flex-end; }

.ottc-chat__msg {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: .885rem;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: ottcPop .32s var(--oc-ease);
}

@keyframes ottcPop {
  from { opacity: 0; transform: translateY(7px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.ottc-chat__msg--bot {
  background: var(--oc-bubble-bot);
  border: 1px solid var(--oc-line);
  border-bottom-left-radius: 5px;
  color: var(--oc-ink);
  box-shadow: 0 2px 8px rgba(21, 15, 46, .05);
}

.ottc-chat__msg--me {
  background: linear-gradient(120deg, var(--oc-deep), var(--oc-mid));
  border-bottom-right-radius: 5px;
  color: #fff;
  white-space: pre-line;
}

.ottc-chat__p { margin: 0 0 7px; }
.ottc-chat__p:last-child { margin-bottom: 0; }

.ottc-chat__msg a {
  color: var(--oc-mid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ottc-chat__time {
  padding: 0 4px;
  font-size: .66rem;
  letter-spacing: .02em;
  color: var(--oc-muted);
  opacity: .8;
}

/* fact table inside an answer */
.ottc-chat__meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(109, 40, 217, .06);
  font-size: .845rem;
}

.ottc-chat__meta dt {
  color: var(--oc-muted);
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 2px;
}

.ottc-chat__meta dd { margin: 0; color: var(--oc-ink); }

/* tappable option rows */
.ottc-chat__bullets {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ottc-chat__bullet {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font: 500 .845rem/1.4 var(--oc-sans);
  color: var(--oc-ink);
  background: rgba(109, 40, 217, .05);
  text-align: left;
}

.ottc-chat__bullet--tap {
  position: relative;
  border: 1px solid rgba(109, 40, 217, .18);
  cursor: pointer;
  padding-right: 28px;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.ottc-chat__bullet--tap::after {
  content: '›';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-52%);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--oc-mid);
}

.ottc-chat__bullet--tap:hover {
  background: rgba(109, 40, 217, .12);
  border-color: rgba(109, 40, 217, .4);
  transform: translateX(2px);
}

.ottc-chat__bullet--tap:focus-visible { outline: 2px solid var(--oc-mid); outline-offset: 1px; }

.ottc-chat__note {
  margin: 8px 0 0;
  font-size: .81rem;
  line-height: 1.5;
  color: var(--oc-muted);
}

/* source footnote — the trust marker */
.ottc-chat__src {
  display: block;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(109, 40, 217, .22);
  font-size: .72rem;
  color: var(--oc-muted);
}

.ottc-chat__src a { color: var(--oc-mid); font-weight: 600; }

/* action buttons under an answer */
.ottc-chat__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.ottc-chat__act {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(109, 40, 217, .32);
  border-radius: 999px;
  cursor: pointer;
  background: var(--oc-surface);
  color: var(--oc-mid);
  font: 600 .8rem/1.2 var(--oc-sans);
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.ottc-chat__act:hover {
  background: rgba(109, 40, 217, .1);
  transform: translateY(-1px);
  text-decoration: none;
}

.ottc-chat__act:focus-visible { outline: 2px solid var(--oc-deep); outline-offset: 2px; }

.ottc-chat__act--primary {
  border-color: transparent;
  background: linear-gradient(120deg, var(--oc-deep), var(--oc-mid));
  color: #fff;
  box-shadow: 0 4px 12px rgba(109, 40, 217, .28);
}

.ottc-chat__act--primary:hover { background: linear-gradient(120deg, var(--oc-mid), var(--oc-deep)); color: #fff; }

/* was this helpful */
.ottc-chat__fb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
}

.ottc-chat__fb-q, .ottc-chat__fb-done { font-size: .73rem; color: var(--oc-muted); }

.ottc-chat__fb-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--oc-line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--oc-surface);
  color: var(--oc-muted);
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.ottc-chat__fb-btn:hover { color: var(--oc-mid); border-color: var(--oc-mid); background: rgba(109, 40, 217, .08); }
.ottc-chat__fb-btn:focus-visible { outline: 2px solid var(--oc-mid); outline-offset: 1px; }
.ottc-chat__fb-btn svg { width: 13px; height: 13px; }

/* typing indicator */
.ottc-chat__typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 13px 15px;
  border-radius: 16px 16px 16px 5px;
  background: var(--oc-bubble-bot);
  border: 1px solid var(--oc-line);
}

.ottc-chat__typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--oc-mid);
  opacity: .35;
  animation: ottcBlink 1.1s ease-in-out infinite;
}

.ottc-chat__typing i:nth-child(2) { animation-delay: .18s; }
.ottc-chat__typing i:nth-child(3) { animation-delay: .36s; }

@keyframes ottcBlink {
  0%, 100% { opacity: .3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

/* jump to latest */
.ottc-chat__jump {
  position: absolute;
  right: 16px;
  bottom: 150px;
  width: 34px;
  height: 34px;
  display: none;
  place-items: center;
  border: 1px solid var(--oc-line);
  border-radius: 50%;
  cursor: pointer;
  background: var(--oc-surface);
  color: var(--oc-mid);
  box-shadow: 0 6px 18px rgba(21, 15, 46, .18);
}

.ottc-chat__jump.is-on { display: grid; animation: ottcPop .25s var(--oc-ease); }
.ottc-chat__jump svg { width: 18px; height: 18px; }

/* ----------------------------------------------------------------- chips -- */
/* Wraps rather than scrolls: a horizontal scroller with a hidden scrollbar cut
   the second suggestion off mid-word, and a visitor cannot tap what they cannot
   see. Long labels shrink onto two lines instead of disappearing. */
.ottc-chat__chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  padding: 4px 16px 11px;
}

.ottc-chat__chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(109, 40, 217, .3);
  border-radius: 999px;
  /* Sized so two full questions usually share a row: wrapping costs vertical
     space, and the log is worth more of the panel than the suggestions are. */
  padding: 7px 12px;
  cursor: pointer;
  background: var(--oc-surface);
  color: var(--oc-mid);
  font: 600 .755rem/1.25 var(--oc-sans);
  text-align: left;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

.ottc-chat__chip:hover {
  background: var(--oc-mid);
  color: #fff;
  transform: translateY(-1px);
}

.ottc-chat__chip:focus-visible { outline: 2px solid var(--oc-deep); outline-offset: 2px; }

/* The route to a person never wraps or shrinks — it is the one control that
   must stay legible on every turn. */
.ottc-chat__chip--wa {
  flex: none;
  border-color: rgba(37, 211, 102, .55);
  color: #128c3f;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ottc-chat__chip--wa:hover { background: #25d366; color: #fff; border-color: #25d366; }
.ottc-chat__chip--wa svg { width: 14px; height: 14px; flex: none; }

/* ------------------------------------------------------------------ form -- */
.ottc-chat__form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 11px 12px;
  border-top: 1px solid var(--oc-line);
  background: var(--oc-surface);
}

.ottc-chat__inputwrap { position: relative; flex: 1 1 auto; min-width: 0; }

.ottc-chat__input {
  display: block;
  width: 100%;
  max-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--oc-line);
  border-radius: 14px;
  background: var(--oc-paper);
  color: var(--oc-ink);
  font: 400 .89rem/1.45 var(--oc-sans);
  resize: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.ottc-chat__input:focus {
  outline: 0;
  border-color: var(--oc-mid);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, .14);
}

.ottc-chat__count {
  position: absolute;
  right: 12px;
  bottom: 4px;
  font-size: .64rem;
  color: var(--oc-muted);
  pointer-events: none;
}

.ottc-chat__send {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(120deg, var(--oc-deep), var(--oc-mid));
  color: #fff;
  transition: transform .16s ease, opacity .16s ease;
}

.ottc-chat__send:hover:not(:disabled) { transform: translateY(-2px); }
.ottc-chat__send:disabled { opacity: .4; cursor: not-allowed; }
.ottc-chat__send:focus-visible { outline: 2px solid var(--oc-gold); outline-offset: 2px; }
.ottc-chat__send svg { width: 19px; height: 19px; }

.ottc-chat__foot {
  margin: 0;
  padding: 0 14px 11px;
  background: var(--oc-surface);
  font-size: .655rem;
  line-height: 1.5;
  color: var(--oc-muted);
  text-align: center;
}

.ottc-chat__foot span { display: block; }
.ottc-chat__foot-warn { opacity: .8; }

/* ----------------------------------------------------------- responsive -- */
@media (max-width: 480px) {
  .ottc-chat { right: 12px; bottom: 12px; left: 12px; }
  .ottc-chat__panel {
    width: auto;
    left: 0;
    right: 0;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    border-radius: 18px;
  }
  .ottc-chat__stack { max-width: 88%; }
  .ottc-chat__launcher { height: 52px; padding: 0 18px 0 14px; font-size: .88rem; }
  .ottc-chat__teaser { max-width: none; }
}

@media (max-height: 560px) {
  .ottc-chat__panel { height: calc(100vh - 16px); }
  .ottc-chat__log { padding-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ottc-chat__launcher,
  .ottc-chat__launcher::after,
  .ottc-chat__badge,
  .ottc-chat.is-open .ottc-chat__panel,
  .ottc-chat__teaser.is-on,
  .ottc-chat__msg,
  .ottc-chat__typing i,
  .ottc-chat__jump.is-on,
  .ottc-chat__chip,
  .ottc-chat__act,
  .ottc-chat__bullet--tap,
  .ottc-chat__send {
    animation: none !important;
    transition: none !important;
  }
  .ottc-chat__launcher:hover,
  .ottc-chat__chip:hover,
  .ottc-chat__act:hover,
  .ottc-chat__bullet--tap:hover,
  .ottc-chat__send:hover { transform: none; }
}

/* --------------------------------------------------------------- dark UI -- */
@media (prefers-color-scheme: dark) {
  .ottc-chat {
    --oc-surface: #1b1533;
    --oc-paper: #14102a;
    --oc-bubble-bot: #221b41;
    --oc-ink: #f1eefb;
    --oc-muted: #a79fc4;
    --oc-line: rgba(255, 255, 255, .13);
  }
  .ottc-chat__msg--bot { box-shadow: none; }
  .ottc-chat__meta { background: rgba(196, 181, 253, .1); }
  .ottc-chat__bullet { background: rgba(196, 181, 253, .08); color: var(--oc-ink); }
  .ottc-chat__bullet--tap { border-color: rgba(196, 181, 253, .26); }
  .ottc-chat__bullet--tap::after { color: #c4b5fd; }
  .ottc-chat__bullet--tap:hover { background: rgba(196, 181, 253, .18); }
  .ottc-chat__chip { background: #241d44; color: #c4b5fd; border-color: rgba(196, 181, 253, .3); }
  .ottc-chat__chip--wa { color: #4ade80; border-color: rgba(74, 222, 128, .4); }
  .ottc-chat__act { background: #241d44; color: #c4b5fd; border-color: rgba(196, 181, 253, .3); }
  .ottc-chat__act--primary { color: #fff; }
  .ottc-chat__fb-btn { background: #241d44; }
  .ottc-chat__src { border-top-color: rgba(255, 255, 255, .16); }
  .ottc-chat__src a, .ottc-chat__msg a { color: #c4b5fd; }
  .ottc-chat__typing i { background: #c4b5fd; }
  .ottc-chat__jump { background: #241d44; color: #c4b5fd; }
  .ottc-chat__teaser-body strong { color: #e9e4ff; }
  .ottc-chat__log::-webkit-scrollbar-thumb { background: rgba(196, 181, 253, .3); }
}

/* Print: the widget is chrome, not content. */
@media print { .ottc-chat { display: none !important; } }
