/* ============================================================
   Floating AI support widget - "Support Assistant"
   Bottom-right bubble, collapsible, business-minimal, responsive.
   Independent of the platform chat: this one is built into the site.
   ============================================================ */
:root { --lj-chat-z: 300; }

/* ---------- floating bubble (fixed bottom-right) ---------- */
.lj-chat-fab {
  position: fixed; right: 20px; bottom: 30px; z-index: var(--lj-chat-z);
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--accent, #f27022); color: #fff;
  border: none; cursor: pointer;
  box-shadow: 0 8px 22px rgba(242, 112, 34, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  font-family: inherit; -webkit-tap-highlight-color: transparent;
}
.lj-chat-fab:hover { background: var(--accent-dark, #d95f12); transform: scale(1.06); }
.lj-chat-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lj-chat-fab .fab-ico,
.lj-chat-fab .fab-ico-collapse { width: 24px; height: 24px; flex-shrink: 0; }
.lj-chat-fab .fab-ico-collapse { display: none; }
.lj-chat-fab .fab-txt {
  font-size: 10.5px; font-weight: 700; line-height: 1.15; text-align: center;
  letter-spacing: 0.1px; max-width: 66px;
}
/* expanded state: bubble turns into an explicit "collapse" control */
.lj-chat-fab.open { background: var(--primary, #183b64); box-shadow: 0 8px 22px rgba(16, 39, 65, 0.35); }
.lj-chat-fab.open .fab-ico { display: none; }
.lj-chat-fab.open .fab-ico-collapse { display: block; }
.lj-chat-fab.open:hover { background: var(--primary-dark, #102741); }

/* ---------- panel ---------- */
.lj-chat-panel {
  position: fixed; right: 20px; bottom: 120px; z-index: calc(var(--lj-chat-z) + 1);
  width: 352px; max-width: calc(100vw - 32px);
  height: min(540px, calc(100vh - 170px));
  height: min(540px, calc(100dvh - 170px));
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(16, 39, 65, 0.28);
  display: none; flex-direction: column;
  border: 1px solid var(--line, #dfe7f0);
}
.lj-chat-panel.open { display: flex; animation: ljChatIn 0.22s ease; }
@keyframes ljChatIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.lj-chat-head {
  background: linear-gradient(120deg, var(--primary-dark, #102741), var(--primary, #183b64));
  color: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-shrink: 0;
}
.lj-chat-head .ch-txt { min-width: 0; }
.lj-chat-head .ch-name { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lj-chat-head .ch-name .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #3ddc7f;
  display: inline-block; flex-shrink: 0;
}
.lj-chat-head .ch-sub {
  font-size: 11.5px; color: #b9cbe0; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lj-chat-close {
  background: rgba(255, 255, 255, 0.14); border: none; color: #fff; width: 28px; height: 28px;
  border-radius: 50%; font-size: 17px; cursor: pointer; line-height: 1; flex-shrink: 0;
  font-family: inherit;
}
.lj-chat-close:hover { background: rgba(255, 255, 255, 0.28); }

.lj-chat-body {
  flex: 1; overflow-y: auto; padding: 14px 14px 8px;
  background: var(--soft-2, #f4f8fc);
  display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.lj-msg {
  max-width: 84%; padding: 9px 13px; border-radius: 12px;
  font-size: 14px; line-height: 1.65; word-break: break-word; white-space: pre-wrap;
}
.lj-msg.bot { background: #fff; color: var(--text, #333); border: 1px solid var(--line, #dfe7f0); align-self: flex-start; border-top-left-radius: 4px; }
.lj-msg.user { background: var(--primary, #183b64); color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.lj-msg.typing { color: var(--muted, #6b7a8d); }

.lj-chat-chips {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 10px;
  background: var(--soft-2, #f4f8fc); flex-shrink: 0;
}
.lj-chat-chips .chips-label {
  width: 100%; font-size: 11px; color: var(--muted, #6b7a8d);
  letter-spacing: 0.2px; margin-bottom: 1px;
}
.lj-chat-chips button {
  background: #fff; border: 1px solid var(--line, #dfe7f0); color: var(--primary, #183b64);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; cursor: pointer;
  transition: all 0.15s; font-family: inherit; max-width: 100%;
}
.lj-chat-chips button:hover { border-color: var(--accent, #f27022); color: var(--accent, #f27022); }

.lj-chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line, #dfe7f0); background: #fff; flex-shrink: 0; }
.lj-chat-input input {
  flex: 1; border: 1px solid var(--line, #dfe7f0); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; outline: none; background: var(--soft-2, #f4f8fc);
  min-width: 0; font-family: inherit;
}
.lj-chat-input input:focus { border-color: var(--primary, #183b64); background: #fff; }
.lj-chat-input button {
  background: var(--accent, #f27022); color: #fff; border: none; border-radius: 8px;
  padding: 0 18px; font-size: 14px; cursor: pointer; flex-shrink: 0; font-family: inherit;
}
.lj-chat-input button:disabled { background: #f5b98c; cursor: not-allowed; }

/* the panel covers the footer / floating helpers while open */
body.lj-chat-open .back-top { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .lj-chat-fab {
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    width: 66px; height: 66px;
  }
  .lj-chat-fab .fab-txt { font-size: 10px; max-width: 58px; }
  /* bottom sheet: keeps the bubble visible so it can still collapse the panel */
  .lj-chat-panel {
    left: 12px; right: 12px; width: auto;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    height: min(66vh, 520px);
    height: min(66dvh, 520px);
    border-radius: 12px;
  }
  .lj-chat-head { padding: 12px 14px; }
  .lj-msg { font-size: 13.5px; max-width: 90%; }
  /* 16px stops iOS from zooming the page when the input is focused */
  .lj-chat-input input { font-size: 16px; }
  .lj-chat-input button { padding: 0 15px; }
  .lj-chat-chips button { font-size: 12px; padding: 4px 10px; }
}

/* keep the back-to-top button above the support bubble */
.back-top { bottom: 120px !important; }
@media (max-width: 640px) { .back-top { bottom: 100px !important; } }
