/* ==========================================================================
   Unified contact widget — one floating icon (AI assistant + WhatsApp)
   Uses the site's existing palette, radius and shadow language.
   The launcher itself reuses the approved .whatsapp-float-btn geometry from
   style.css (54px circle, right 28px, bottom 85px, z-index 990).
   ========================================================================== */

.ra-contact {
  --ra-brand: #ff5e14;
  --ra-brand-dark: #e4510c;
  --ra-ink: #12141a;
  --ra-ink-2: #1b1e26;
  --ra-line: rgba(255, 255, 255, 0.1);
  --ra-text: #e8ebf0;
  --ra-muted: #a4a9b6;
  --ra-green: #25d366;
  font-family: 'Kumbh Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- launcher ---------- */
.ra-contact__launcher {
  cursor: pointer;
  border: 0;
  padding: 0;
  outline-offset: 4px;
}
.ra-contact__launcher:focus-visible {
  outline: 3px solid #ffffff !important;
  outline-offset: 3px;
}
.ra-contact__launcher svg {
  display: block;
  pointer-events: none;
}
.ra-contact__launcher .ra-contact__ico-close {
  display: none;
}
.ra-contact.is-open .ra-contact__launcher .ra-contact__ico-chat {
  display: none;
}
.ra-contact.is-open .ra-contact__launcher .ra-contact__ico-close {
  display: block;
}

/* ---------- panel ---------- */
.ra-contact__panel {
  position: fixed;
  right: 28px;
  bottom: 152px;
  width: 372px;
  max-width: calc(100vw - 36px);
  max-height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--ra-ink);
  color: var(--ra-text);
  border: 1px solid var(--ra-line);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 6px 18px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 989;
  transform-origin: bottom right;
  animation: ra-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.ra-contact__panel[hidden] {
  display: none !important;
}
@keyframes ra-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ra-contact__panel { animation: none; }
}

.ra-contact__view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.ra-contact__view[hidden] { display: none !important; }

/* ---------- heads ---------- */
.ra-contact__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 18px 0;
}
.ra-contact__head--chat {
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ra-line);
  background: var(--ra-ink-2);
}
.ra-contact__headtext { flex: 1 1 auto; min-width: 0; }
.ra-contact__eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ra-brand);
  font-weight: 700;
  margin-bottom: 4px;
}
.ra-contact__title {
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
  font-weight: 700;
  color: #fff;
}
.ra-contact__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ra-muted);
  margin-top: 2px;
}
.ra-contact__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ra-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}
.ra-contact__close,
.ra-contact__back {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--ra-line);
  color: var(--ra-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.ra-contact__close:hover,
.ra-contact__back:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ra-contact__close:focus-visible,
.ra-contact__back:focus-visible,
.ra-contact__option:focus-visible,
.ra-contact__send:focus-visible,
.ra-contact__submit:focus-visible,
.ra-contact__ghost:focus-visible {
  outline: 2px solid var(--ra-brand);
  outline-offset: 2px;
}

.ra-contact__lede {
  margin: 10px 18px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ra-muted);
}

/* ---------- option buttons ---------- */
.ra-contact__option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 14px 10px;
  padding: 13px 14px;
  background: var(--ra-ink-2);
  border: 1px solid var(--ra-line);
  border-radius: 14px;
  color: var(--ra-text);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
  font: inherit;
  width: calc(100% - 28px);
}
.ra-contact__option:hover {
  border-color: rgba(255, 94, 20, 0.55);
  background: #22262f;
  transform: translateY(-1px);
  color: var(--ra-text);
}
.ra-contact__option-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.ra-contact__option-icon--ai { background: linear-gradient(140deg, #ff7a2f, #ff5e14); }
.ra-contact__option-icon--wa { background: #1faa52; }
.ra-contact__option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.ra-contact__option-body strong { font-size: 14px; font-weight: 700; color: #fff; }
.ra-contact__option-body small { font-size: 12px; color: var(--ra-muted); line-height: 1.4; }
.ra-contact__chevron { color: var(--ra-muted); font-size: 20px; line-height: 1; }

.ra-contact__foot {
  margin: auto 0 0;
  padding: 6px 18px 16px;
  font-size: 12px;
  color: var(--ra-muted);
  text-align: center;
}
.ra-contact__foot a { color: var(--ra-brand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- chat ---------- */
.ra-contact__messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  scrollbar-width: thin;
}
.ra-contact__msg { display: flex; }
.ra-contact__msg--bot { justify-content: flex-start; }
.ra-contact__msg--user { justify-content: flex-end; }
.ra-contact__bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ra-contact__msg--bot .ra-contact__bubble {
  background: var(--ra-ink-2);
  border: 1px solid var(--ra-line);
  border-bottom-left-radius: 5px;
  color: var(--ra-text);
}
.ra-contact__msg--user .ra-contact__bubble {
  background: var(--ra-brand);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.ra-contact__bubble a { color: inherit; text-decoration: underline; }
.ra-contact__bubble strong { color: #fff; }
.ra-contact__typing { display: inline-flex; gap: 4px; align-items: center; }
.ra-contact__typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ra-muted);
  animation: ra-bounce 1.1s infinite ease-in-out;
}
.ra-contact__typing i:nth-child(2) { animation-delay: 0.15s; }
.ra-contact__typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ra-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ra-contact__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 6px;
  border-top: 1px solid var(--ra-line);
  background: var(--ra-ink-2);
}
.ra-contact__composer textarea {
  flex: 1 1 auto;
  resize: none;
  max-height: 96px;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--ra-line);
  background: #0e1014;
  color: var(--ra-text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
}
.ra-contact__composer textarea::placeholder { color: #6f7787; }
.ra-contact__composer textarea:focus {
  outline: none;
  border-color: rgba(255, 94, 20, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 94, 20, 0.14);
}
.ra-contact__send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 0;
  background: var(--ra-brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
.ra-contact__send:hover { background: var(--ra-brand-dark); }
.ra-contact__send:disabled { opacity: 0.5; cursor: not-allowed; }
.ra-contact__hint {
  padding: 0 14px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: #7d8494;
  background: var(--ra-ink-2);
}

/* ---------- lead form ---------- */
.ra-contact__form { padding: 14px 16px 18px; overflow-y: auto; }
.ra-contact__formnote { font-size: 12.5px; color: var(--ra-muted); line-height: 1.55; margin: 0 0 12px; }
.ra-contact__form label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #cfd5e0;
  margin: 0 0 5px;
}
.ra-contact__form input[type="text"],
.ra-contact__form input[type="email"],
.ra-contact__form input[type="tel"],
.ra-contact__form textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 11px;
  border-radius: 11px;
  border: 1px solid var(--ra-line);
  background: #0e1014;
  color: var(--ra-text);
  font: inherit;
  font-size: 13.5px;
}
.ra-contact__form input:focus,
.ra-contact__form textarea:focus {
  outline: none;
  border-color: rgba(255, 94, 20, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 94, 20, 0.14);
}
.ra-contact__form textarea { resize: vertical; min-height: 66px; }
.ra-contact__check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12px !important;
  font-weight: 400 !important;
  color: var(--ra-muted) !important;
  line-height: 1.5;
  margin: 2px 0 12px !important;
}
.ra-contact__check input { margin-top: 2px; accent-color: var(--ra-brand); }
.ra-contact__submit {
  width: 100%;
  padding: 12px 18px;
  border-radius: 12px;
  border: 0;
  background: var(--ra-brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: background 0.18s ease;
}
.ra-contact__submit:hover { background: var(--ra-brand-dark); color: #fff; }
.ra-contact__submit--wa { background: #1faa52; }
.ra-contact__submit--wa:hover { background: #189145; }
.ra-contact__fine { font-size: 11.5px; color: #7d8494; margin: 10px 0 0; text-align: center; }
.ra-contact__fine a { color: var(--ra-brand); }
.ra-contact__error {
  margin: 0 0 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #ff8b95;
  font-size: 12.5px;
}

.ra-contact__success { padding: 26px 20px 24px; text-align: center; }
.ra-contact__success-icon {
  width: 58px; height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.14);
  color: var(--ra-green);
  display: flex; align-items: center; justify-content: center;
}
.ra-contact__success h3 { font-size: 17px; margin: 0 0 8px; color: #fff; font-weight: 700; }
.ra-contact__success p { font-size: 13px; color: var(--ra-muted); line-height: 1.6; margin: 0 0 16px; }
.ra-contact__success-actions { display: flex; flex-direction: column; gap: 8px; }
.ra-contact__ghost {
  border: 1px solid var(--ra-line);
  background: transparent;
  color: var(--ra-muted);
  padding: 10px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.ra-contact__ghost:hover { color: #fff; border-color: rgba(255, 255, 255, 0.25); }

.ra-contact__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 767px) {
  .ra-contact__panel {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    bottom: 136px;
    max-height: min(74vh, 560px);
    border-radius: 18px;
  }
  .ra-contact__messages { min-height: 130px; }
}

@media (max-width: 380px) {
  .ra-contact__panel { bottom: 128px; }
}

/* The launcher must disappear with the rest of the floating UI when the
   mobile menu is open — style.css already handles .whatsapp-float-btn, this
   keeps the panel from lingering. */
body.mobile-menu-visible .ra-contact__panel { display: none !important; }

/* ---------- lead-first flow + quick actions (added) ---------- */
.ra-contact__req { color: #ff8b87; }
.ra-contact__opt { color: #7d8494; font-weight: 400; }
.ra-contact__ref { color: inherit; opacity: 0.8; }
.ra-contact__form input[type="date"] { color-scheme: dark; }
.ra-contact__quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
  background: var(--ra-ink-2);
}
.ra-contact__chip {
  border: 1px solid var(--ra-line);
  background: rgba(255, 255, 255, 0.04);
  color: #cfd5e0;
  font: inherit;
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.ra-contact__chip:hover {
  border-color: rgba(255, 94, 20, 0.55);
  background: rgba(255, 94, 20, 0.12);
  color: #fff;
}
.ra-contact__chip:focus-visible { outline: 2px solid var(--ra-brand); outline-offset: 2px; }