/*!
 * Secure Insurance — Navigation Assistant
 * assistant.css
 *
 * All selectors namespaced .si-* to avoid collisions with site styles.
 * Version: 1.0.0
 */

.si-root {
  --si-brand: #0b3d63;
  --si-brand-dark: #072a45;
  --si-accent: #1a7fb5;
  --si-bg: #ffffff;
  --si-surface: #f4f7f9;
  --si-text: #16232e;
  --si-muted: #4a5763;
  --si-border: #dde5ea;
  --si-radius: 12px;
  --si-shadow: 0 12px 40px rgba(11, 61, 99, .18);

  --si-font-size: 16px;
  --si-max-width: 820px;
  --si-inline-h: 560px;
  --si-inline-h-mobile: 70vh;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: var(--si-font-size);
  line-height: 1.6;
  color: var(--si-text);
}

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

/* ---------- INLINE MODE ---------- */

.si-mode-inline {
  display: block;
  width: 100%;
  max-width: var(--si-max-width);
  margin: 0 auto;
}

.si-mode-inline .si-panel {
  width: 100%;
  height: var(--si-inline-h);
  max-height: none;
  margin: 0;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(11, 61, 99, .10);
}

/* ---------- BUBBLE MODE ---------- */

.si-mode-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
}

.si-mode-bubble .si-panel {
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  margin-bottom: 12px;
}

/* ---------- Launcher ---------- */

.si-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--si-brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--si-shadow);
  transition: background .18s ease, transform .18s ease;
}
.si-launcher:hover { background: var(--si-brand-dark); transform: translateY(-1px); }
.si-launcher:focus-visible { outline: 3px solid var(--si-accent); outline-offset: 3px; }
.si-launcher-icon { display: flex; }
.si-launcher-logo {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}
.si-open .si-launcher-text { display: none; }
.si-open .si-launcher { padding: 14px; }

/* ---------- Header logo ---------- */

.si-header-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  flex: 0 0 auto;
  padding: 3px;
}

/* ---------- Message avatar ---------- */

.si-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--si-border);
  flex: 0 0 auto;
  margin-right: 8px;
  align-self: flex-end;
}

/* ---------- Panel ---------- */

.si-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--si-bg);
  border: 1px solid var(--si-border);
  border-radius: var(--si-radius);
  box-shadow: var(--si-shadow);
}
.si-panel[hidden] { display: none; }

/* ---------- Header ---------- */

.si-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--si-brand);
  color: #fff;
  flex: 0 0 auto;
}
.si-title { font-weight: 700; font-size: 1.05em; }
.si-subtitle { font-size: .8em; opacity: .85; }
.si-close {
  border: 0; background: transparent; color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
  padding: 0 4px; border-radius: 6px; opacity: .85;
}
.si-close:hover { opacity: 1; }
.si-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.si-reset {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: .82em;
  font-weight: 600;
  cursor: pointer;
}
.si-reset:hover { background: rgba(255,255,255,.14); }
.si-reset:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- AI disclosure (permanent) ---------- */

.si-ai-notice {
  flex: 0 0 auto;
  padding: 10px 20px;
  background: #fff8e6;
  border-bottom: 1px solid #f0e2bd;
  color: #6b5518;
  font-size: .82em;
  font-weight: 600;
}

/* ---------- Log ---------- */

.si-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px;
  background: var(--si-surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overscroll-behavior: contain;
}

.si-row { display: flex; }
.si-row-user { justify-content: flex-end; }
.si-row-bot  { justify-content: flex-start; }

.si-bubble {
  max-width: 84%;
  padding: 14px 18px;
  border-radius: var(--si-radius);
  box-shadow: 0 1px 2px rgba(22, 35, 46, .07);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.si-bubble p { margin: 0 0 11px; }
.si-bubble p:last-child { margin-bottom: 0; }

.si-bubble-bot  { background: #fff; border: 1px solid var(--si-border); border-bottom-left-radius: 4px; }
.si-bubble-user { background: var(--si-brand); color: #fff; border-bottom-right-radius: 4px; }

.si-typing .si-bubble { color: var(--si-muted); letter-spacing: 3px; }

/* ---------- Actions ---------- */

.si-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 4px;
}

.si-chip {
  padding: 11px 18px;
  border: 1px solid var(--si-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--si-accent);
  font: inherit;
  font-size: .95em;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.si-chip:hover { background: var(--si-accent); color: #fff; }
.si-chip:focus-visible { outline: 2px solid var(--si-brand); outline-offset: 2px; }

/* Question chips — full width, left aligned, for the FAQ menu */
.si-faq-menu { flex-direction: column; align-items: stretch; }
.si-chip-q {
  text-align: left;
  border-radius: 10px;
  font-weight: 500;
  line-height: 1.4;
  padding: 10px 14px;
}

.si-cta {
  display: inline-block;
  padding: 13px 20px;
  border-radius: 9px;
  background: var(--si-accent);
  color: #fff;
  font-weight: 700;
  font-size: .95em;
  text-decoration: none;
  transition: background .15s ease;
}
.si-cta:hover { background: #14688f; }
.si-cta:focus-visible { outline: 3px solid var(--si-brand); outline-offset: 2px; }

.si-contact {
  display: inline-block;
  padding: 11px 17px;
  border: 1px solid var(--si-border);
  border-radius: 9px;
  background: #fff;
  color: var(--si-brand);
  font-weight: 600;
  font-size: .95em;
  text-decoration: none;
}
.si-contact:hover { background: #eef4f8; }

/* ---------- Composer ---------- */

.si-composer {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid var(--si-border);
}
.si-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 18px;
  font-size: 1em;
  border: 1px solid var(--si-border);
  border-radius: 999px;
  font: inherit;
  color: var(--si-text);
  background: #fff;
}
.si-input:focus { outline: none; border-color: var(--si-accent); box-shadow: 0 0 0 3px rgba(26,127,181,.15); }

.si-send {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--si-brand);
  color: #fff; cursor: pointer;
}
.si-send:hover { background: var(--si-brand-dark); }
.si-send:focus-visible { outline: 3px solid var(--si-accent); outline-offset: 2px; }

/* ---------- Disclaimer (permanent) ---------- */

.si-disclaimer {
  flex: 0 0 auto;
  padding: 12px 20px;
  background: var(--si-surface);
  border-top: 1px solid var(--si-border);
  color: var(--si-muted);
  font-size: .75em;
  line-height: 1.5;
}

/* ---------- Responsive ---------- */

/* Tablet and below — inline panel gets taller relative to viewport */
@media (max-width: 820px) {
  .si-mode-inline .si-panel { height: var(--si-inline-h-mobile); min-height: 460px; }
}

@media (max-width: 560px) {
  .si-root { --si-font-size: 16px; }   /* never below 16px — prevents iOS zoom */

  .si-mode-inline .si-panel {
    height: var(--si-inline-h-mobile);
    min-height: 440px;
    border-radius: 12px;
  }
  .si-mode-inline .si-header { padding: 14px 16px; }
  .si-mode-inline .si-log { padding: 16px; gap: 12px; }
  .si-mode-inline .si-bubble { max-width: 90%; padding: 13px 16px; }
  .si-mode-inline .si-composer { padding: 12px; }
  .si-mode-inline .si-ai-notice,
  .si-mode-inline .si-disclaimer { padding-left: 16px; padding-right: 16px; }

  .si-mode-bubble { right: 12px; bottom: 12px; left: 12px; }
  .si-mode-bubble .si-panel { width: 100%; height: min(74vh, 580px); }
  .si-mode-bubble .si-launcher-text { display: none; }
  .si-mode-bubble .si-launcher { padding: 14px; }
}

/* Very short screens — stop the panel overflowing */
@media (max-height: 620px) {
  .si-mode-inline .si-panel { height: 88vh; min-height: 380px; }
}

/* Large screens — a little more breathing room */
@media (min-width: 1200px) {
  .si-mode-inline .si-panel { height: var(--si-inline-h); }
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  .si-launcher, .si-chip, .si-cta { transition: none; }
}

@media (prefers-contrast: more) {
  .si-root { --si-border: #6b7b88; --si-muted: #33414d; }
}

/* ============================================================
   INLINE AUTO-HEIGHT OVERRIDE — no internal scrolling
   Paste at the very END of assistant.css
   ============================================================ */

/* 1. Panel grows with its content (was locked to 560px) */
.si-mode-inline .si-panel {
  height: auto;
  min-height: 0;
  max-height: none;
}

/* 2. Message log expands instead of scrolling */
.si-mode-inline .si-log {
  flex: 0 0 auto;          /* was 1 1 auto */
  height: auto;
  max-height: none;
  overflow-y: visible;     /* was auto — this was the scrollbar */
  overscroll-behavior: auto;
  min-height: 200px;
}

/* 3. Override every responsive height rule from above */
@media (max-width: 820px) {
  .si-mode-inline .si-panel { height: auto; min-height: 0; }
}
@media (max-width: 560px) {
  .si-mode-inline .si-panel { height: auto; min-height: 0; }
  .si-mode-inline .si-log   { min-height: 180px; }
}
@media (max-height: 620px) {
  .si-mode-inline .si-panel { height: auto; min-height: 0; }
}
@media (min-width: 1200px) {
  .si-mode-inline .si-panel { height: auto; }
}