/* Rongda Pacific — AI Chat widget styles. Scoped under .rdai-root. */
.rdai-root {
  --rdai-accent: #0c1020;
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 99998; /* below Joinchat (usually bottom-right) so they never overlap */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.rdai-launcher {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--rdai-accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.rdai-launcher:hover { transform: scale(1.06); }

.rdai-panel {
  position: absolute;
  left: 0;
  bottom: 70px;
  width: 408px;
  max-width: calc(100vw - 28px);
  height: 640px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.rdai-root.rdai-open .rdai-panel { display: flex; }

.rdai-head {
  background: var(--rdai-accent);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rdai-title { font-weight: 600; font-size: 15px; flex: 1; }
.rdai-wa {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  padding: 3px 10px;
}
.rdai-wa:hover { background: rgba(255, 255, 255, 0.15); }
.rdai-new {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.9;
}
.rdai-new:hover { opacity: 1; transform: rotate(-45deg); transition: transform 0.15s ease; }
.rdai-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.rdai-msgs {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain; /* don't scroll the page behind the panel */
  padding: 14px;
  background: #f6f7f9;
}
.rdai-msg { display: flex; margin-bottom: 10px; }
.rdai-user { justify-content: flex-end; }
.rdai-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.rdai-bot .rdai-bubble {
  background: #fff;
  color: #1f2733;
  border: 1px solid #e6e8eb;
  border-bottom-left-radius: 4px;
}
.rdai-user .rdai-bubble {
  background: var(--rdai-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.rdai-bubble a { color: inherit; text-decoration: underline; }
.rdai-typing .rdai-bubble { color: #98a2b3; letter-spacing: 2px; }

.rdai-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #eceef0;
  background: #fff;
}
.rdai-input {
  flex: 1;
  border: 1px solid #d7dbe0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
}
.rdai-input:focus { border-color: var(--rdai-accent); }
/* .rdai-root prefix raises specificity above theme rules like
   `button[type="submit"]` (0,1,1) that would otherwise recolor/reshape the
   send button. padding/text-transform/border are reset in case the theme set them. */
.rdai-root .rdai-send {
  background: var(--rdai-accent);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
  flex-shrink: 0;
}
.rdai-attach {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0 2px;
  line-height: 1;
}
.rdai-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #eceef0;
  background: #f6f7f9;
  font-size: 12px;
  color: #4b5563;
}
.rdai-preview img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.rdai-preview span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rdai-preview-x { background: none; border: none; font-size: 18px; color: #9ca3af; cursor: pointer; }
.rdai-userimg { max-width: 180px; border-radius: 8px; display: block; margin-bottom: 4px; }

/* Quick-question chips above the input (JD-style): single row, swipe/scroll
   sideways. Mouse wheel is mapped to horizontal scroll in JS. */
.rdai-quick {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #eceef0;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.rdai-quick::-webkit-scrollbar { height: 5px; }
.rdai-quick::-webkit-scrollbar-thumb { background: #d0d5d3; border-radius: 999px; }
.rdai-quickchip {
  flex: 0 0 auto;
  background: #f2f5f4;
  border: 1px solid #e0e6e4;
  color: var(--rdai-accent);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}
.rdai-quickchip:hover { background: #e8efed; }

.rdai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 12px;
}
.rdai-chip {
  background: #fff;
  border: 1px solid var(--rdai-accent);
  color: var(--rdai-accent);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.rdai-chip:hover { background: rgba(0, 0, 0, 0.03); }
a.rdai-chip { text-decoration: none; display: inline-block; }
.rdai-chip.rdai-cart {
  background: var(--rdai-accent);
  color: #fff;
  border-color: var(--rdai-accent);
}
.rdai-chip.rdai-cart:hover { filter: brightness(0.96); background: var(--rdai-accent); }

/* JD-style "you may also ask" follow-up suggestions */
.rdai-suggest { margin: 2px 0 10px; }
.rdai-suggest-h { font-size: 12px; color: #98a2b3; margin: 6px 2px 4px; }
.rdai-suggest-q {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  padding: 9px 12px;
  margin: 6px 0;
  font-size: 13.5px;
  line-height: 1.35;
  color: #1f2733;
  cursor: pointer;
}
.rdai-suggest-q:hover { background: #f6f7f9; border-color: var(--rdai-accent); }

/* In-chat lead / booking form (overrides the bubble width cap) */
.rdai-bubble.rdai-form2 {
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rdai-form2-title { font-weight: 600; margin-bottom: 2px; }
.rdai-form2 input,
.rdai-form2 textarea {
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.rdai-form2 .lf-submit {
  background: var(--rdai-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-size: 14px;
  cursor: pointer;
}
.rdai-form2 .lf-submit:disabled { opacity: 0.6; }
.rdai-form2-note { font-size: 12.5px; color: #4b5563; line-height: 1.4; }
.rdai-form2 .lf-wa {
  display: block;
  text-align: center;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 9px;
  font-size: 14px;
  font-weight: 600;
  margin: 2px 0 4px;
}
.rdai-form2 .lf-wa:hover { filter: brightness(0.96); }

/* Proactive nudge bubble */
.rdai-teaser {
  position: absolute;
  left: 0;
  bottom: 70px;
  width: 232px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 12px 30px 12px 14px;
  font-size: 13.5px;
  line-height: 1.4;
  color: #1f2733;
  cursor: pointer;
  animation: rdai-pop 0.2s ease;
}
.rdai-teaser-txt { display: block; }
.rdai-teaser-x {
  position: absolute;
  top: 5px;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px;
}
@keyframes rdai-pop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .rdai-root { left: 12px; bottom: 12px; }
  .rdai-panel { bottom: 66px; }
}

/* ===== Rongda site fit: placement + brand theme (overrides the shared styles above) ===== */

/* PDPA notice under the input box. */
.rdai-notice { padding: 6px 14px 10px; font-size: 11px; line-height: 1.45; color: #6b7280; background: #fff; }
.rdai-notice a { color: inherit; text-decoration: underline; }

/* Placement: bottom-right, stacked above the site's WhatsApp button (.rds-wa from
   rongda-enquiry-clicks.php: right 22 / bottom 86 / 54px tall; mobile right 16 /
   bottom 78 / 54px circle) and Astra's scroll-to-top (right 30 / bottom 30).
   12px gap above WhatsApp. */
.rdai-root { left: auto; right: 22px; bottom: 152px; }
/* The open panel drops down to 20px from the screen bottom (over the WhatsApp and
   launcher buttons, which sit below it in z-order) so it gets the full height;
   close it with the × in its header. */
.rdai-panel {
  left: auto;
  right: 0;
  bottom: -132px;
  width: 400px;
  height: 620px;
  max-height: calc(100vh - 130px);
  border: 1px solid rgba(212, 175, 55, 0.45);
}
.rdai-teaser { left: auto; right: 0; bottom: 68px; }
/* The launcher would paint over the open panel; the panel's × closes it. */
.rdai-root.rdai-open .rdai-launcher { display: none; }
@media (max-width: 768px) {
  .rdai-root { left: auto; right: 15px; bottom: 144px; }
  .rdai-panel { bottom: -132px; max-height: calc(100vh - 100px); }
}

/* Launcher: the site's gold with a navy icon (a navy launcher vanishes on the
   navy pages), matching the header Contact button. */
.rdai-launcher { background: #d4af37; padding: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.rdai-launcher svg { stroke: #0c1020; flex-shrink: 0; }

/* The Astra theme pads every <button> (12px 24px on mobile) and paints inputs dark;
   reset the widget's own controls. */
.rdai-root .rdai-new, .rdai-root .rdai-close, .rdai-root .rdai-send, .rdai-root .rdai-attach,
.rdai-root .rdai-preview-x, .rdai-root .rdai-teaser-x { padding: 0; }
/* Astra main.min.css forces a dark background on text inputs with !important;
   this selector out-ranks it (checked: the plain .rdai-root input.rdai-input lost). */
.rdai-root .rdai-form input.rdai-input[type="text"] {
  background: #fff !important;
  color: #1f2733 !important;
  border: 1px solid #d7dbe0 !important;
  border-radius: 999px;
  box-shadow: none;
  height: 42px;
  margin: 0;
  padding: 0 16px;
  font-size: 14px;
}
.rdai-root .rdai-form input.rdai-input[type="text"]::placeholder { color: #98a2b3; opacity: 1; }
.rdai-root .rdai-form input.rdai-input[type="text"]:focus { border-color: #d4af37 !important; box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }

/* Header: navy with a gold rule; WhatsApp as a solid green pill so it reads as the action. */
.rdai-head { border-bottom: 2px solid #d4af37; padding: 13px 14px 13px 18px; }
.rdai-title { letter-spacing: 0.2px; }
.rdai-root .rdai-wa {
  background: #25d366;
  border: none;
  color: #fff;
  padding: 5px 12px;
}
.rdai-root .rdai-wa:hover { background: #1ebe5b; }
.rdai-root .rdai-new, .rdai-root .rdai-close { color: rgba(255, 255, 255, 0.85); background: none; }
.rdai-root .rdai-new:hover, .rdai-root .rdai-close:hover { color: #fff; }

/* Send: gold disc, navy arrow. */
.rdai-root .rdai-send { background: #d4af37; color: #0c1020; height: 42px; width: 42px; min-width: 42px; }
.rdai-root .rdai-send:hover { filter: brightness(1.05); }
.rdai-root .rdai-attach { opacity: 0.6; background: none; }
.rdai-root .rdai-attach:hover { opacity: 1; }

/* Quick questions: no visible scrollbar (wheel/swipe still scroll sideways); a
   fade on the right edge hints there are more. */
.rdai-quick {
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  mask-image: linear-gradient(to right, #000 85%, transparent);
  padding: 9px 12px;
}
.rdai-quick::-webkit-scrollbar { display: none; }
.rdai-root .rdai-quickchip { background: #faf6e8; border: 1px solid #ecdfb0; color: #0c1020; }
.rdai-root .rdai-quickchip:hover { background: #f5edcf; }

/* Action chips under the greeting: navy outline, gold on hover. */
.rdai-root .rdai-chip { background: #fff; }
.rdai-root .rdai-chip:hover { background: #faf6e8; }
