/* ROTAI Assistant — embeddable widget styles.
   One inline module with two tabs (Ask / Compare). All rules are prefixed
   (.rotai-inline-*, .ra-*) so they can't leak into or out of the theme.

   Two surfaces:
     • the banner itself — brand green (#005430), white text on it
     • white inner surfaces (input, chips, active tab, message bubbles,
       compare card) — dark text on white */

.rotai-inline-banner {
  --ri-bg: #005430;            /* brand green — banner background */
  --ri-on-bg: #ffffff;         /* text/controls directly on the green */
  --ri-on-bg-soft: rgba(255, 255, 255, 0.8);
  --ri-on-bg-line: rgba(255, 255, 255, 0.28);
  --ri-surface: #ffffff;       /* white inner surfaces */
  --ri-ink: #16211d;           /* text on white surfaces */
  --ri-soft: #5b6b64;          /* muted text on white surfaces */
  --ri-line: #e3e9e6;          /* hairline borders on white surfaces */
  --ri-accent: #005430;        /* brand green for buttons/accents on white */
  --ri-accent-ink: #ffffff;

  font-family: -apple-system, "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  position: relative;
  display: block;
  width: 100%;
  background: var(--ri-bg);
  border-radius: 16px;
  margin: 24px 0;
  padding: 26px 24px;
  box-sizing: border-box;
}
.rotai-inline-banner *,
.rotai-inline-banner *::before,
.rotai-inline-banner *::after { box-sizing: border-box; }

.rotai-inline-inner { max-width: 640px; margin: 0 auto; text-align: center; }

/* language toggle — top corner, on the green */
.ra-lang {
  position: absolute;
  top: 14px;
  inset-inline-end: 16px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--ri-on-bg-line);
  background: transparent;
  color: var(--ri-on-bg);
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
}
.ra-lang:hover { background: rgba(255, 255, 255, 0.12); }

.rotai-inline-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ri-on-bg);
  background: rgba(255, 255, 255, 0.14);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.rotai-inline-heading {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  line-height: 1.25;
  font-weight: 800;
  color: var(--ri-on-bg);
  margin: 0 0 8px;
}
.rotai-inline-sub {
  font-size: 14.5px;
  color: var(--ri-on-bg-soft);
  margin: 0 0 18px;
  line-height: 1.55;
}

/* ---- tabs ---- */
.ra-tabs {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--ri-on-bg-line);
  border-radius: 12px;
  padding: 4px;
  max-width: 420px;
  margin: 0 auto 18px;
}
.ra-tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ri-on-bg-soft);
  cursor: pointer;
  font-family: inherit;
}
.ra-tab.is-active {
  background: var(--ri-surface);
  color: var(--ri-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.ra-tabpanel[hidden] { display: none; }

/* ---- Ask tab ---- */
.rotai-inline-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.rotai-inline-quick button {
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 20px;
  border: 1px solid var(--ri-line);
  background: var(--ri-surface);
  color: var(--ri-ink);
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
}
.rotai-inline-quick button:hover { color: var(--ri-accent); }

.rotai-inline-input-row {
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
.rotai-inline-input-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ri-line);
  border-radius: 24px;
  padding: 12px 18px;
  font-size: 15px;
  outline: none;
  background: var(--ri-surface);
  color: var(--ri-ink);
  font-family: inherit;
}
.rotai-inline-input-row input::placeholder { color: var(--ri-soft); }
.rotai-inline-send {
  border: none;
  background: var(--ri-surface);
  color: var(--ri-accent);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  cursor: pointer;
  font-size: 16px;
}

.rotai-inline-messages {
  max-width: 560px;
  margin: 14px auto;
  text-align: start;
  /* Scroll the conversation inside a fixed area so the input below stays
     reachable — the customer never has to scroll the page back up to ask
     the next question. Plain block (not flex) to avoid flex+overflow scroll
     quirks. */
  display: block;
  max-height: min(360px, 50vh);
  overflow-y: auto;
  padding: 2px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.rotai-inline-messages[hidden] { display: none; }

.ra-msg {
  display: block;
  width: fit-content;
  max-width: 90%;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ra-msg:last-child { margin-bottom: 0; }
.ra-msg.user {
  margin-inline-start: auto;
  background: #00713f;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.ra-msg.assistant {
  margin-inline-end: auto;
  background: var(--ri-surface);
  color: var(--ri-ink);
  border: 1px solid var(--ri-line);
}
.ra-msg.handoff {
  margin-inline-end: auto;
  background: #fff4ec;
  color: #7a3b25;
  border: 1px solid #f0d3c6;
}
.ra-msg a { color: var(--ri-accent); text-decoration: underline; word-break: break-all; }
.ra-msg.user a { color: #ffffff; }
.ra-msg.handoff a { color: #7a3b25; font-weight: 700; }

/* ---- Compare tab ---- */
.ra-compare-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}
.ra-compare-picker select {
  flex: 1 1 44%;
  min-width: 0;
  padding: 10px;
  font-size: 13px;
  border: 1px solid var(--ri-line);
  border-radius: 9px;
  background: var(--ri-surface);
  color: var(--ri-ink);
  font-family: inherit;
}
.ra-cmp-vs { color: var(--ri-on-bg-soft); font-size: 12px; flex: 0 0 auto; }
.ra-cmp-go {
  flex: 1 1 100%;
  padding: 11px;
  border: none;
  border-radius: 9px;
  background: var(--ri-surface);
  color: var(--ri-accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.ra-cmp-go:disabled { opacity: 0.5; cursor: default; }

.ra-compare-result { max-width: 560px; margin: 14px auto 0; text-align: start; }
.ra-compare-hint { color: var(--ri-on-bg-soft); font-size: 13px; text-align: center; margin: 8px 0 0; }

.ra-compare-card {
  border: 1px solid var(--ri-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ri-surface);
  color: var(--ri-ink);
}
.ra-cmp-cols { display: flex; }
.ra-cmp-col { flex: 1 1 50%; min-width: 0; padding: 12px; text-align: center; }
.ra-cmp-col:first-child { border-inline-end: 1px solid var(--ri-line); }
.ra-cmp-col img,
.ra-cmp-col .ra-cmp-noimg {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f1f4f2;
  display: block;
}
.ra-cmp-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--ri-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}
.ra-cmp-tag.ra-cmp-tag-sm { width: 18px; height: 18px; font-size: 10px; margin-top: 0; }
.ra-cmp-name { font-weight: 700; font-size: 13px; line-height: 1.35; margin-top: 4px; }
.ra-cmp-name span { font-weight: 500; color: var(--ri-soft); }
.ra-cmp-cond {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ri-accent);
}
.ra-cmp-price { font-weight: 700; font-size: 14px; margin-top: 4px; }
.ra-cmp-price s { color: var(--ri-soft); font-weight: 400; font-size: 12px; }

.ra-compare-table { width: 100%; border-collapse: collapse; }
.ra-compare-table th,
.ra-compare-table td {
  border-top: 1px solid var(--ri-line);
  padding: 7px 10px;
  font-size: 12.5px;
  vertical-align: top;
}
.ra-compare-table th { width: 38%; color: var(--ri-soft); font-weight: 600; text-align: start; }
.ra-compare-table td { text-align: center; }

.ra-cmp-verdict {
  border-top: 1px solid var(--ri-line);
  font-size: 13px;
  line-height: 1.55;
}
.ra-cmp-rec { padding: 12px 14px; }
.ra-cmp-rec div { white-space: pre-wrap; }
.ra-cmp-rec + .ra-cmp-rec { border-top: 1px solid var(--ri-line); }
.ra-cmp-rec.is-a { background: #eef4f1; }   /* subtle green — chair A */
.ra-cmp-rec.is-b { background: #ffffff; }   /* plain white — chair B */
.ra-cmp-rec-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  margin-bottom: 4px;
}

.ra-cmp-cta {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--ri-line);
}
.ra-cmp-buy {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--ri-accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}
.ra-cmp-buy:hover { filter: brightness(1.14); }
.ra-cmp-buy .ra-cmp-tag { background: rgba(255, 255, 255, 0.25); margin-top: 0; }

@media (max-width: 480px) {
  .rotai-inline-banner { padding: 22px 14px; border-radius: 12px; }
  .rotai-inline-heading { font-size: 1.25rem; }
}
