/* ==========================================================================
   Encompass Research-A-Part demo — shared styles
   Recreates the look of encompass.com/general/Contact-Model-Research
   for the HappyRobot chatbot demo. Two routes share this stylesheet.
   ========================================================================== */

:root {
  --navy: #0a1e2d;
  --navy-2: #0e2637;
  --teal: #35c1a6;
  --teal-dark: #2ba98f;
  --ink: #1a1a1a;
  --grey: #6b7280;
  --line: #d7dbde;
  --field-border: #b9c0c5;
  --bg: #ffffff;
  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- top header ---------- */
.top {
  background: var(--navy);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.brand .cube { width: 46px; height: 40px; }
.brand .wordmark { line-height: 1; }
.brand .wordmark .name {
  font-size: 26px; font-weight: 800; letter-spacing: .3px; color: #fff;
}
.brand .wordmark .tag {
  display: block; font-size: 9px; letter-spacing: .6px; color: #cbd3d8; margin-top: 2px;
}

.searchbar {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 999px;
  padding: 4px 4px 4px 22px;
  max-width: 1000px;
}
.searchbar input {
  border: 0; outline: 0; flex: 1; font-size: 16px; color: #333;
  background: transparent; padding: 10px 0;
}
.searchbar input::placeholder { color: #9aa2a8; }
.searchbar .go {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--teal); color: #fff; cursor: pointer;
  display: grid; place-items: center; flex: 0 0 auto;
}
.searchbar .go:hover { background: var(--teal-dark); }

.utils { display: flex; align-items: center; gap: 22px; flex: 0 0 auto; }
.utils .u { display: flex; align-items: center; gap: 7px; font-size: 14px; color: #e6ebee; }
.utils .flag { font-size: 16px; }
.utils .login {
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #06231c;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 8px;
}

/* ---------- nav ---------- */
.nav {
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.08);
  color: #e9eef1;
  padding: 0 32px 16px;
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 15px;
  font-weight: 600;
}
.nav .grow { flex: 1; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 6px 0; white-space: nowrap; }
.nav a:hover { color: var(--teal); }
.nav .caret { opacity: .8; }

/* ---------- breadcrumb band ---------- */
.band {
  background: var(--teal);
  color: #06231c;
  padding: 30px 32px 34px;
}
.band .crumbs { font-size: 14px; opacity: .9; }
.band .crumbs a:hover { text-decoration: underline; }
.band .title { font-size: 22px; font-weight: 600; margin-top: 6px; }

/* ---------- page layout ---------- */
.wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  max-width: 1500px;
  margin: 0 auto;
  padding: 60px 40px 90px;
  gap: 30px;
}

.rail { padding-top: 6px; }
.rail .group { margin-bottom: 34px; }
.rail .group > .h {
  font-size: 22px; font-weight: 700; margin: 0 0 16px;
}
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { margin: 14px 0; font-size: 17px; color: #333; }
.rail li a:hover { color: var(--teal-dark); }
.rail li.active a { font-weight: 700; color: var(--ink); }

/* ---------- main content ---------- */
.main { max-width: 780px; }
.icon-badge {
  width: 118px; height: 118px; border-radius: 50%;
  border: 3px solid var(--teal);
  display: grid; place-items: center;
  color: var(--teal); float: left; margin: 6px 40px 20px 30px;
}
.h1 { font-family: var(--serif); font-weight: 400; font-size: 46px; margin: 0 0 14px; }
.lede { font-size: 18px; color: #333; margin: 0 0 10px; }
.h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 46px 0 20px; }
.muted { color: #333; }
.req-note { color: #333; margin: 18px 0 30px; }

/* ---------- form ---------- */
.field { margin: 0 0 26px; }
.field label { display: block; font-size: 19px; margin: 0 0 10px; }
.field .star { color: var(--ink); }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 3px;
  padding: 13px 14px;
  font-size: 16px;
  font-family: var(--sans);
  color: #222;
  background: #fff;
}
.field select { height: 50px; appearance: auto; }
.field textarea { min-height: 190px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--teal); box-shadow: 0 0 0 2px rgba(53,193,166,.25);
}

.file-row { display: flex; align-items: center; gap: 12px; }
.file-row input[type="file"] { font-size: 15px; }

.actions { display: flex; justify-content: flex-end; margin-top: 34px; }
.btn-submit {
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 17px;
  font-weight: 600;
  padding: 13px 34px;
  cursor: pointer;
}
.btn-submit:hover { background: var(--navy-2); }

.footnote { color: #333; margin-top: 40px; max-width: 640px; }

/* ---------- route 2: chat-first hero ---------- */
.chat-hero { max-width: 720px; }
.chat-hero .lede { font-size: 19px; margin-bottom: 26px; }
.chat-hero ul.benefits {
  list-style: none; padding: 0; margin: 0 0 34px;
}
.chat-hero ul.benefits li {
  position: relative; padding-left: 34px; margin: 14px 0; font-size: 17px; color: #333;
}
.chat-hero ul.benefits li::before {
  content: ""; position: absolute; left: 0; top: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--teal);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center/16px no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center/16px no-repeat;
}
.btn-chat {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--teal); color: #06231c;
  border: 0; border-radius: 10px;
  font-size: 19px; font-weight: 700;
  padding: 16px 30px; cursor: pointer;
}
.btn-chat:hover { background: var(--teal-dark); }
.chat-hero .reassure { color: var(--grey); margin-top: 18px; font-size: 14px; }

/* ---------- footer strip ---------- */
.footer { background: var(--navy); color: #9fb0bb; padding: 26px 32px; font-size: 13px; }

/* ---------- HappyRobot widget: hide the auto launcher bubble ----------
   We want ONLY the page's own "Start a chat" / Submit button to open the chat,
   not the widget's default floating bubble. Hiding the launcher button still
   lets us open the panel by clicking it programmatically (works on display:none).
   The chat panel itself is a separate element, so it still shows when opened. */
#happyrobot-chat-widget .hr-widget-wrapper > button { display: none !important; }

/* ---------- inline embed mode (Route 1) ----------
   After Submit we move the widget's root into #hr-inline-host (in the page flow)
   and tag it .hr-inline. The panel ships with position:fixed inline styles, so we
   override them with !important (CSS !important beats element inline styles). */
#hr-inline-host { margin-top: 34px; }
#hr-inline-host .hr-inline-label {
  font-size: 15px; color: var(--grey); margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
#hr-inline-host .hr-inline-label::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal); flex: 0 0 auto;
}

/* neutralise the floating positioning on the root, wrapper and panel shell */
#happyrobot-chat-widget.hr-inline,
#happyrobot-chat-widget.hr-inline .hr-widget-wrapper,
#happyrobot-chat-widget.hr-inline .hr-widget {
  position: static !important;
  inset: auto !important;
  top: auto !important; right: auto !important; bottom: auto !important; left: auto !important;
  width: 100% !important;
  max-width: 100% !important;   /* full column width */
  height: auto !important;
  margin: 0 !important;
}
/* the actual chat panel (view) inside .hr-widget */
#happyrobot-chat-widget.hr-inline .hr-widget > * {
  position: static !important;
  inset: auto !important;
  top: auto !important; right: auto !important; bottom: auto !important; left: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 420px !important;   /* chat height — was 620px→380px; tweak here */
  border-radius: 12px !important;
  box-shadow: none !important;
  border: 1px solid var(--line) !important;
}
/* if the widget double-mounts, only show the first instance inline */
#happyrobot-chat-widget.hr-inline .hr-widget-wrapper ~ .hr-widget-wrapper { display: none !important; }

/* Inline demo is a one-way flow: no going back to the welcome/past-conversations
   screen. Hide the header back arrow. */
#happyrobot-chat-widget button[aria-label="Back to welcome"] { display: none !important; }

/* Keep it possible to close the chat, but as a clear "Close chat" text button
   instead of a bare X icon. */
#happyrobot-chat-widget button[aria-label="Close chat"] {
  width: auto !important;
  padding: 4px 10px !important;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
#happyrobot-chat-widget button[aria-label="Close chat"] svg { display: none !important; }
#happyrobot-chat-widget button[aria-label="Close chat"]::after {
  content: "Close chat";
  white-space: nowrap;
}

/* while searching: hide the (empty) chat panel AND the label; show the loading
   card instead. The widget still runs hidden; we reveal it once the bot's first
   message arrives. */
#hr-inline-host.searching #happyrobot-chat-widget { display: none !important; }
/* label stays visible in both states so the loading card and the chat panel sit
   at the exact same spot — the reveal is a pure content swap, no vertical shift */

/* loading card (Option A: branded spinner + rotating status line).
   Same footprint AND same dark header as the real chat panel, so the reveal is
   a seamless content swap. */
#hr-inline-host .hr-loading { display: none; }
#hr-inline-host.searching .hr-loading {
  display: flex; flex-direction: column;
  width: 100%; height: 420px;
  border: 1px solid var(--line); border-radius: 12px; background: #fafafa;
  overflow: hidden;
}
#hr-inline-host .hr-loading .hr-loading-head {
  flex: 0 0 auto; height: 56px; background: #1a1a1a;
  display: flex; align-items: center; padding: 0 16px;
}
#hr-inline-host .hr-loading .hr-loading-logo {
  width: 34px; height: 34px; border-radius: 8px; background: #fff;
  object-fit: contain; padding: 3px;
}
#hr-inline-host .hr-loading .hr-loading-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px; padding: 24px;
}
#hr-inline-host .hr-loading .hr-spinner {
  width: 46px; height: 46px; border: 4px solid #e3e6e8; border-top-color: var(--teal);
  border-radius: 50%; animation: hr-spin .9s linear infinite;
}
#hr-inline-host .hr-loading .hr-loading-title { font-size: 19px; font-weight: 600; color: var(--ink); }
#hr-inline-host .hr-loading .hr-loading-sub { font-size: 15px; color: var(--grey); min-height: 20px; transition: opacity .3s; }
@keyframes hr-spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .top { flex-wrap: wrap; }
  .searchbar { order: 3; flex-basis: 100%; max-width: none; }
  .wrap { grid-template-columns: 1fr; }
  .rail { display: none; }
  .nav { flex-wrap: wrap; gap: 16px; }
}

/* ---------- phones ---------- */
@media (max-width: 600px) {
  .wrap { padding: 26px 16px 60px; gap: 20px; }
  .icon-badge { width: 84px; height: 84px; margin: 0 0 16px 0; float: none; }
  .h1 { font-size: 34px; }
  .h2 { font-size: 26px; }
  .actions { justify-content: stretch; }
  .btn-submit { width: 100%; }
}

/* The widget ships a rule that makes the panel fullscreen-fixed under 480px.
   Re-assert our inline sizing at the same breakpoint so the chat + loading card
   stay embedded in the page (not a fixed overlay) on phones too. */
@media (max-width: 480px) {
  #happyrobot-chat-widget.hr-inline .hr-widget-wrapper,
  #happyrobot-chat-widget.hr-inline .hr-widget {
    position: static !important;
    inset: auto !important;
    top: auto !important; right: auto !important; bottom: auto !important; left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
  #happyrobot-chat-widget.hr-inline .hr-widget > * {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 440px !important;   /* a touch taller on portrait phones */
    border-radius: 12px !important;
  }
  #hr-inline-host.searching .hr-loading { height: 440px; }
}
