/* Home-page assistant widget (built-in FAQ matcher). Loaded by Views/Home/Index.cshtml only. Tokens come from tokens.css.
   Layer: 1030 (above sticky header 1020/1025, below Bootstrap offcanvas 1045 / modal 1055). */

/* ---------- floating launcher ---------- */
.assistant-launcher {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 1030;
  display: inline-flex; align-items: center; justify-content: center; gap: .75rem;
  min-width: 60px; height: 60px; padding: 0; border-radius: 30px;
  background: var(--navy-900); color: #fff;
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 8px 24px rgba(8, 23, 47, .32), 0 0 0 3px rgba(216, 180, 90, .2);
  font: 600 var(--fs-base)/1.2 var(--font-sans); cursor: pointer;
  transition: background-color var(--motion), box-shadow var(--motion), transform var(--motion);
}
.assistant-launcher-icon {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--gold-400); color: var(--navy-950);
}
.assistant-launcher-icon .bi { font-size: 1.25rem; line-height: 1; }
.assistant-launcher:hover { background: var(--navy-800); box-shadow: 0 10px 28px rgba(8, 23, 47, .4), 0 0 0 4px rgba(216, 180, 90, .28); transform: translateY(-2px); }
.assistant-launcher:active { transform: translateY(0); }
.assistant-launcher:focus-visible {
  outline: var(--focus-w) solid var(--navy-950); outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff, 0 8px 24px rgba(8, 23, 47, .32);
}
.assistant-launcher-copy { display: none; min-width: 0; text-align: left; }
.assistant-launcher-label { display: block; color: #fff; font-size: .9rem; font-weight: 700; }
.assistant-launcher-hint { display: block; margin-top: .2rem; color: var(--navy-200); font-size: .72rem; font-weight: 400; }
.assistant-launcher-status { display: none; width: 8px; height: 8px; flex: none; border-radius: 50%; background: #73d6a0; box-shadow: 0 0 0 3px rgba(115, 214, 160, .15); }
.assistant.is-open .assistant-launcher { box-shadow: 0 2px 8px rgba(8, 23, 47, .25); }

/* ---------- panel ---------- */
.assistant-panel {
  position: fixed; right: 1.25rem; bottom: 5.25rem; z-index: 1030;
  display: flex; flex-direction: column;
  width: 380px; max-width: calc(100vw - 2.5rem);
  height: 34rem; max-height: 70vh;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3), 0 18px 44px rgba(8, 23, 47, .28);
  overflow: hidden;
  font-family: var(--font-sans); font-size: .875rem; line-height: 1.5;
  animation: assistant-in 160ms ease-out;
}
.assistant-panel[hidden] { display: none; }
@keyframes assistant-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.assistant-head {
  --focus-color: var(--focus-on-dark);
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem .5rem .5rem 1rem; min-height: 3.75rem;
  background: linear-gradient(120deg, var(--navy-950), var(--navy-800)); color: #fff;
  border-bottom: 3px solid var(--gold-400);
}
.assistant-emblem { flex: none; width: 30px; height: 33px; }
.assistant-heading { flex: 1 1 auto; min-width: 0; }
.assistant-title { margin: 0; font-size: var(--fs-base); font-weight: 600; line-height: 1.25; color: #fff; }
.assistant-sub { margin: 0; font-size: var(--fs-xs); line-height: 1.3; color: var(--navy-200); }
.assistant-close {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--r-sm);
  background: transparent; color: #fff; cursor: pointer;
  transition: background-color var(--motion);
}
.assistant-close .bi { font-size: 1.05rem; }
.assistant-close:hover { background: rgba(255, 255, 255, .14); }

/* ---------- conversation ---------- */
.assistant-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem; background: var(--surface);
}
.assistant-msg { display: flex; max-width: 94%; min-width: 0; }
.assistant-msg-bot { align-self: flex-start; }
.assistant-msg-user { align-self: flex-end; }
.assistant-bubble {
  min-width: 0; padding: .6rem .8rem;
  border-radius: 4px var(--r-md) var(--r-md) var(--r-md);
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink);
  overflow-wrap: anywhere;
}
.assistant-msg-user .assistant-bubble {
  border-radius: var(--r-md) 4px var(--r-md) var(--r-md);
  background: var(--navy-700); border-color: var(--navy-700); color: #fff;
}
.assistant-bubble p { margin: 0; }
.assistant-bullets { margin: .5rem 0 0; padding-left: 1.1rem; }
.assistant-bullets li { margin: 0; }
.assistant-bullets li + li { margin-top: .3rem; }
.assistant-bullets li::marker { color: var(--gold-700); }
.assistant-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.assistant-action {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: var(--tap); padding: .35rem .8rem;
  border: 1px solid var(--navy-700); border-radius: var(--r-sm);
  background: #fff; color: var(--navy-700);
  font-size: .8125rem; font-weight: 600; line-height: 1.25; text-decoration: none;
  transition: background-color var(--motion);
}
.assistant-action:hover { background: var(--navy-100); color: var(--navy-800); text-decoration: none; }
.assistant-action .bi { font-size: .8rem; }

/* typing indicator (CSS only; removed under reduced motion) */
.assistant-typing .assistant-bubble { display: inline-flex; align-items: center; gap: 5px; padding: .75rem .9rem; }
.assistant-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--navy-500); animation: assistant-bounce 1.1s infinite ease-in-out; }
.assistant-dot:nth-of-type(2) { animation-delay: .15s; }
.assistant-dot:nth-of-type(3) { animation-delay: .3s; }
@keyframes assistant-bounce { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .assistant-typing .assistant-dot { display: none; } .assistant-typing .assistant-bubble { padding: 0; border: 0; background: transparent; } }

/* ---------- suggested questions ---------- */
.assistant-suggest {
  display: flex; flex-wrap: wrap; gap: .4rem;
  max-height: 8.75rem; overflow-y: auto;
  padding: .6rem 1rem; background: #fff; border-top: 1px solid var(--line);
}
.assistant-suggest[hidden] { display: none; }
.assistant-chip {
  min-height: var(--tap-sm); padding: .3rem .7rem;
  border: 1px solid var(--navy-200); border-radius: var(--r-md);
  background: var(--navy-50); color: var(--navy-700);
  font: 500 .8125rem/1.3 var(--font-sans); text-align: left; cursor: pointer;
  transition: background-color var(--motion), border-color var(--motion);
}
.assistant-chip:hover { background: var(--navy-100); border-color: var(--navy-500); }

/* ---------- input ---------- */
.assistant-form { display: flex; gap: .5rem; padding: .6rem 1rem; background: #fff; border-top: 1px solid var(--line); }
.assistant-input {
  flex: 1 1 auto; min-width: 0; height: var(--tap); padding: 0 .75rem;
  border: 1px solid var(--control-border); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font: 400 1rem/1.2 var(--font-sans);
}
.assistant-input::placeholder { color: var(--muted); opacity: 1; }
.assistant-send {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--r-sm);
  background: var(--navy-700); color: #fff; cursor: pointer;
  transition: background-color var(--motion);
}
.assistant-send:hover { background: var(--navy-800); }
.assistant-send:disabled { opacity: .55; cursor: not-allowed; }
.assistant-note { margin: 0; padding: .5rem 1rem .7rem; background: #fff; border-top: 1px solid var(--line); font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); }

/* ---------- wide screens: launcher shows its label ---------- */
@media (min-width: 576px) {
  .assistant-launcher { right: 1.25rem; bottom: 1.25rem; height: 68px; padding: 0 1rem 0 .55rem; border-radius: 34px; }
  .assistant-launcher-copy, .assistant-launcher-status { display: block; }
}

/* ---------- phones: full-width bottom sheet; the launcher steps aside while it is open ---------- */
@media (max-width: 575.98px) {
  .assistant-panel {
    left: 0; right: 0; bottom: 0; width: auto; max-width: none;
    height: 34rem; max-height: 70vh;
    border-radius: 14px 14px 0 0; border-bottom: 0;
  }
  @supports (height: 1dvh) { .assistant-panel { max-height: 70dvh; } }
  .assistant-note { padding-bottom: calc(.7rem + env(safe-area-inset-bottom, 0px)); }
  .assistant.is-open .assistant-launcher { visibility: hidden; }
  .assistant-chip { min-height: var(--tap); }
}

/* keep the last footer links reachable: the page gets room for the floating button */
body:has(.assistant) .site-footer { padding-bottom: 4.5rem; }

@media print { .assistant { display: none; } }
@media (forced-colors: active) {
  .assistant-launcher, .assistant-panel, .assistant-bubble, .assistant-chip, .assistant-action { border: 1px solid CanvasText; }
}
