/* TransCal chatbot - styles. All selectors are prefixed .tcb- so they cannot clash with the site CSS.
   Brand tokens mirror the site (navy #1a1a6b, blue #2f5fd0, Inter + Manrope).
   Mobile: the site has a fixed bottom bar (.mbar) at <=700px, so the launcher sits above it.
   Pages without .mbar can override:  .tcb-launch{--tcb-bottom:1.25rem}                         */

.tcb-launch, .tcb-panel {
  --navy: #1a1a6b; --blue: #2f5fd0; --blue-dk: #2449a8; --sky: #6ea2ff;
  --ice: #eef3ff; --ink: #101828; --muted: #5b6478; --line: #dfe6f5;
  font: 400 15px/1.5 Inter, system-ui, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}
.tcb-panel *, .tcb-panel *::before, .tcb-panel *::after, .tcb-launch *, .tcb-launch *::before, .tcb-launch *::after { box-sizing: border-box; }

/* ---------- launcher ---------- */
.tcb-launch {
  position: fixed; right: 1.25rem; bottom: var(--tcb-bottom, 1.25rem); z-index: 1000;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.15rem .8rem .95rem; border: 0; border-radius: 999px;
  background: var(--blue); color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer;
  box-shadow: 0 10px 30px rgba(36, 73, 168, .35); transition: background .2s, transform .2s;
}
.tcb-launch:hover { background: var(--blue-dk); transform: translateY(-2px); }
.tcb-launch svg { width: 22px; height: 22px; flex: none; }
.tcb-launch[aria-expanded="true"] { display: none; }
.tcb-ldot {
  position: absolute; top: -2px; right: -2px; width: 13px; height: 13px; border-radius: 50%;
  background: #9aa3b5; border: 2px solid #fff;
}
.tcb-launch.open .tcb-ldot { background: #22a559; }

/* ---------- panel ---------- */
.tcb-panel {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1001;
  width: min(390px, calc(100vw - 2rem));
  height: min(620px, calc(100vh - 2.5rem));
  height: min(620px, calc(100dvh - 2.5rem));
  display: none; flex-direction: column; background: #fff;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
}
.tcb-panel.on { display: flex; animation: tcbIn .22s ease-out; }
@keyframes tcbIn { from { opacity: 0; transform: translateY(12px); } }

.tcb-head { display: flex; align-items: center; gap: .7rem; padding: .85rem .9rem .85rem 1rem; background: var(--navy); color: #fff; }
.tcb-av { width: 38px; height: 38px; flex: none; border-radius: 10px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font: 800 .95rem Manrope, Inter, system-ui, sans-serif; }
.tcb-ttl { font: 800 1rem/1.2 Manrope, Inter, system-ui, sans-serif; }
.tcb-st { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: #cfd8ff; margin-top: .1rem; }
.tcb-st i { width: 8px; height: 8px; border-radius: 50%; background: #9aa3b5; flex: none; }
.tcb-st.open i { background: #4ade80; }
.tcb-hb { margin-left: auto; display: flex; gap: .2rem; }
.tcb-ib { width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.tcb-ib:hover { background: rgba(255, 255, 255, .16); }
.tcb-ib svg { width: 18px; height: 18px; }

/* ---------- messages ---------- */
.tcb-log {
  position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: .6rem; padding: 1rem; background: var(--ice);
}
.tcb-m { max-width: 90%; padding: .65rem .85rem; border-radius: 14px; overflow-wrap: anywhere; }
.tcb-bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.tcb-user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.tcb-p { margin: 0 0 .5rem; }
.tcb-p:last-child { margin-bottom: 0; }
.tcb-ul { margin: .15rem 0 .5rem; padding-left: 1.1rem; }
.tcb-ul li { margin: .15rem 0; }
.tcb-ul a { color: var(--blue); font-weight: 600; }
.tcb-lnks { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.tcb-lnk {
  display: inline-block; padding: .3rem .8rem; border: 1px solid var(--blue); border-radius: 999px;
  background: #fff; color: var(--blue); font-weight: 600; font-size: .88rem; text-decoration: none;
}
.tcb-lnk:hover { background: var(--blue); color: #fff; }

.tcb-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.tcb-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .35rem .8rem;
  font: 600 .86rem Inter, system-ui, "Segoe UI", Arial, sans-serif; color: var(--navy); cursor: pointer;
}
.tcb-chip:hover { border-color: var(--blue); color: var(--blue); }

.tcb-typing { display: inline-flex; gap: 4px; align-items: center; padding: .85rem .9rem; }
.tcb-typing b { width: 7px; height: 7px; border-radius: 50%; background: #9aa8cc; animation: tcbDot 1s infinite ease-in-out; }
.tcb-typing b:nth-child(2) { animation-delay: .15s; }
.tcb-typing b:nth-child(3) { animation-delay: .3s; }
@keyframes tcbDot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ---------- in-chat lead form ---------- */
.tcb-m.tcb-wide { max-width: 96%; width: 96%; }
.tcb-form { display: grid; gap: .6rem; margin-top: .6rem; }
.tcb-form label { display: block; font-weight: 600; font-size: .82rem; }
.tcb-form input, .tcb-form textarea {
  width: 100%; margin-top: .2rem; padding: .6rem .75rem; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  color: var(--ink); background: #fbfcff; border: 1px solid #c9d3ea; border-radius: 10px;
}
.tcb-form textarea { resize: vertical; min-height: 72px; }
.tcb-form input:focus, .tcb-form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 95, 208, .18); background: #fff; }
.tcb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tcb-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.tcb-btn { border: 2px solid var(--blue); background: var(--blue); color: #fff; border-radius: 999px; padding: .5rem 1.1rem; font: 600 .9rem Inter, system-ui, "Segoe UI", Arial, sans-serif; cursor: pointer; }
.tcb-btn:hover { background: var(--blue-dk); border-color: var(--blue-dk); }
.tcb-btn:disabled { opacity: .6; cursor: default; }
.tcb-btn.ghost { background: #fff; color: var(--blue); }
.tcb-btn.ghost:hover { background: var(--ice); }
.tcb-err { margin: 0; padding: .5rem .7rem; border-radius: 10px; background: #fdecec; border: 1px solid #f3b4b4; color: #7f1d1d; font-weight: 600; font-size: .86rem; }
.tcb-err[hidden] { display: none; }

/* ---------- input row ---------- */
.tcb-in { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: #fff; }
.tcb-in input { flex: 1; min-width: 0; padding: .65rem .9rem; font: inherit; font-size: 16px; color: var(--ink); background: #fbfcff; border: 1px solid #c9d3ea; border-radius: 999px; }
.tcb-in input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 95, 208, .18); background: #fff; }
.tcb-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--blue); color: #fff; cursor: pointer; display: grid; place-items: center; }
.tcb-send:hover { background: var(--blue-dk); }
.tcb-send:disabled { opacity: .5; cursor: default; }
.tcb-send svg { width: 18px; height: 18px; }
.tcb-note { margin: 0; padding: 0 .8rem .6rem; background: #fff; text-align: center; font-size: .74rem; color: var(--muted); }

.tcb-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tcb-launch:focus-visible, .tcb-panel button:focus-visible, .tcb-panel a:focus-visible,
.tcb-panel input:focus-visible, .tcb-panel textarea:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  .tcb-launch { --tcb-bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) {
  .tcb-panel { right: 0; left: 0; bottom: 0; width: 100%; height: 88vh; height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .tcb-in { padding-bottom: calc(.7rem + env(safe-area-inset-bottom, 0px)); }
  html.tcb-lock { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .tcb-panel.on, .tcb-typing b { animation: none; }
  .tcb-launch { transition: none; }
}
@media print { .tcb-launch, .tcb-panel { display: none !important; } }