/* =========================================================
   A&D Specialists — chat.css (scripted assistant widget)
   Self-contained: only .adchat* selectors. Uses the site tokens where present.
   ========================================================= */
.adchat {
  --c-blue: #306FB6; --c-blue-deep: #24589A; --c-blue-ink: #0F2A47; --c-blue-tint: #E7EFF8;
  --c-green: #84AF51; --c-green-tint: #EEF4E5; --c-ink: #0C1416; --c-muted: #4E5E61; --c-line: #DCE3E0;
  --c-font-display: "Poppins", "Segoe UI", system-ui, sans-serif;
  --c-font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --c-ease: cubic-bezier(.2,.7,.2,1);
  --c-bar: 0px; /* mobile sticky call bar height, set below */
  font-family: var(--c-font-body);
  font-size: 1rem; line-height: 1.45; color: var(--c-ink);
}
.adchat *, .adchat *::before, .adchat *::after { box-sizing: border-box; }
.adchat button { font: inherit; }

/* ---------- Launcher ---------- */
.adchat-launcher {
  position: fixed; right: 1rem; bottom: calc(1rem + var(--c-bar) + env(safe-area-inset-bottom)); z-index: 105;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .55rem 1.1rem .55rem .6rem; border: 0; border-radius: 999px;
  background: var(--c-blue); color: #fff; cursor: pointer;
  font-family: var(--c-font-display); font-weight: 600; font-size: .9375rem; white-space: nowrap;
  box-shadow: 0 10px 28px rgba(12,20,22,.22);
  transition: transform 150ms var(--c-ease), box-shadow 150ms var(--c-ease), background-color 150ms;
}
.adchat-launcher:hover { transform: translateY(-2px); background: var(--c-blue-deep); box-shadow: 0 14px 32px rgba(12,20,22,.28); }
.adchat-launcher:focus-visible { outline: 3px solid var(--c-green); outline-offset: 3px; }
.adchat-launcher-mark { width: 28px; height: 28px; border-radius: 50%; background: #fff; padding: 2px; }
.adchat-launcher-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-green); box-shadow: 0 0 0 3px rgba(132,175,81,.3); flex: none; }
@media (max-width: 767.98px) {
  .adchat { --c-bar: 76px; }
  .adchat-launcher-label { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  .adchat.is-open .adchat-launcher { display: none; }
}

/* ---------- Panel ---------- */
.adchat-panel {
  position: fixed; right: 1rem; bottom: calc(1rem + var(--c-bar) + env(safe-area-inset-bottom) + 64px); z-index: 110;
  width: 380px; max-width: calc(100vw - 2rem); height: min(640px, calc(100vh - 7rem));
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--c-line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(12,20,22,.28);
  transform: translateY(12px) scale(.98); opacity: 0;
  transition: transform 200ms var(--c-ease), opacity 200ms var(--c-ease);
}
.adchat.is-open .adchat-panel { transform: none; opacity: 1; }
@media (max-width: 767.98px) {
  .adchat-panel {
    right: 0; left: 0; bottom: 0; width: auto; max-width: none;
    height: min(88vh, 100vh - 3rem); border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.adchat-head {
  display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem;
  background: var(--c-blue-ink); color: #fff;
}
.adchat-head-mark { width: 32px; height: 32px; border-radius: 50%; background: #fff; padding: 2px; flex: none; }
.adchat-head-text { flex: 1; min-width: 0; }
.adchat-title { margin: 0; font-family: var(--c-font-display); font-size: 1rem; font-weight: 700; line-height: 1.2; color: #fff; letter-spacing: 0; }
.adchat-disclaimer { margin: .15rem 0 0; font-size: .75rem; color: rgba(255,255,255,.72); line-height: 1.3; }
.adchat-close {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: rgba(255,255,255,.1);
  color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.adchat-close:hover { background: rgba(255,255,255,.2); }
.adchat-close:focus-visible { outline: 2px solid var(--c-green); outline-offset: 2px; }

/* ---------- Messages ---------- */
.adchat-messages {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1rem;
  display: flex; flex-direction: column; gap: .5rem;
  background: #F6F8F7;
}
.adchat-msg {
  max-width: 88%; padding: .6rem .85rem; border-radius: 14px; white-space: pre-line;
  font-size: .9375rem; line-height: 1.45;
  animation: adchat-in 220ms var(--c-ease);
}
.adchat-msg-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 4px; color: var(--c-ink); }
.adchat-msg-user { align-self: flex-end; background: var(--c-blue); color: #fff; border-bottom-right-radius: 4px; }
@keyframes adchat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.adchat-typing { display: inline-flex; gap: 4px; padding: .7rem .85rem; }
.adchat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted); opacity: .5; animation: adchat-dot 900ms infinite; }
.adchat-typing span:nth-child(2) { animation-delay: 150ms; }
.adchat-typing span:nth-child(3) { animation-delay: 300ms; }
@keyframes adchat-dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Summary card */
.adchat-card { margin-top: .5rem; background: var(--c-blue-tint); border-radius: 10px; padding: .6rem .75rem; }
.adchat-card dl { margin: 0; }
.adchat-card-row { display: grid; grid-template-columns: 1fr; gap: .1rem; padding: .35rem 0; border-bottom: 1px solid rgba(48,111,182,.15); }
.adchat-card-row:last-child { border-bottom: 0; }
.adchat-card dt { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-blue); }
.adchat-card dd { margin: 0; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.adchat-edit { border: 0; background: none; color: var(--c-blue); font-weight: 600; font-size: .8125rem; text-decoration: underline; cursor: pointer; padding: 0; flex: none; }
.adchat-card-note { margin: .6rem 0 0; font-size: .875rem; color: var(--c-muted); }

/* ---------- Choices / inputs ---------- */
.adchat-choices {
  display: flex; flex-wrap: wrap; gap: .45rem; padding: .75rem 1rem; border-top: 1px solid var(--c-line); background: #fff;
  max-height: 46%; overflow-y: auto; overscroll-behavior: contain;
}
.adchat-choices:empty { display: none; }
.adchat-choice {
  display: inline-flex; align-items: center; justify-content: center; text-align: left;
  padding: .5rem .85rem; border-radius: 999px; border: 1.5px solid var(--c-blue); background: #fff; color: var(--c-blue);
  font-family: var(--c-font-display); font-weight: 600; font-size: .875rem; line-height: 1.25; cursor: pointer; text-decoration: none;
  transition: background-color 120ms, color 120ms, transform 120ms var(--c-ease);
}
.adchat-choice:hover { background: var(--c-blue-tint); }
.adchat-choice:active { transform: scale(.98); }
.adchat-choice:focus-visible { outline: 3px solid var(--c-green); outline-offset: 2px; }
.adchat-choice:disabled { opacity: .45; cursor: not-allowed; }
.adchat-choice-primary { background: var(--c-blue); color: #fff; }
.adchat-choice-primary:hover { background: var(--c-blue-deep); }
.adchat-choice-call { width: 100%; padding: .85rem 1rem; font-size: 1.0625rem; background: var(--c-blue); color: #fff; border-color: var(--c-blue); }
.adchat-choice-call:hover { background: var(--c-blue-deep); }
.adchat-back { border-color: var(--c-line); color: var(--c-muted); }
.adchat-back:hover { background: #F6F8F7; }
.adchat-more { border-style: dashed; }
.adchat-chip[aria-pressed="true"] { background: var(--c-green); border-color: var(--c-green); color: var(--c-blue-ink); }

.adchat-input { display: flex; gap: .45rem; width: 100%; }
.adchat-input input {
  flex: 1; min-width: 0; padding: .6rem .8rem; font: inherit; font-size: 1rem; color: var(--c-ink);
  border: 1.5px solid var(--c-line); border-radius: 10px; background: #fff;
}
.adchat-input input:focus { outline: 0; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(48,111,182,.18); }
.adchat-error { width: 100%; margin: 0; font-size: .8125rem; font-weight: 600; color: #C23B3B; }
.adchat-error:empty { display: none; }

.adchat-steppers { width: 100%; display: grid; gap: .35rem; margin-bottom: .25rem; }
.adchat-stepper { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: .5rem; }
.adchat-stepper-label { font-weight: 600; font-size: .9375rem; }
.adchat-stepper-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--c-blue); background: #fff; color: var(--c-blue);
  font-size: 1.125rem; font-weight: 700; cursor: pointer;
}
.adchat-stepper-btn:hover { background: var(--c-blue-tint); }
.adchat-stepper-btn:focus-visible { outline: 3px solid var(--c-green); outline-offset: 2px; }
.adchat-stepper-val { min-width: 2.2rem; text-align: center; font-family: var(--c-font-display); font-weight: 700; font-variant-numeric: tabular-nums; }

.adchat-multi { display: flex; flex-wrap: wrap; gap: .45rem; width: 100%; }

.adchat-fallback { width: 100%; display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding-bottom: .35rem; margin-bottom: .25rem; border-bottom: 1px solid var(--c-line); }
.adchat-fallback-label { width: 100%; margin: 0; font-size: .8125rem; color: var(--c-muted); }

/* ---------- Footer ---------- */
.adchat-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; padding: .6rem 1rem; border-top: 1px solid var(--c-line); background: #fff;
}
.adchat-foot-link {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  padding: .55rem .5rem; border-radius: 8px; background: var(--c-green-tint); color: var(--c-blue-ink);
  font-family: var(--c-font-display); font-weight: 600; font-size: .8125rem; text-decoration: none; white-space: nowrap;
}
.adchat-foot-link:hover { background: #E2ECD3; }
.adchat-foot-link:focus-visible { outline: 3px solid var(--c-green); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .adchat-panel, .adchat-launcher, .adchat-choice { transition: none; }
  .adchat-msg { animation: none; }
  .adchat-typing span { animation: none; opacity: .6; }
}
