/*
 * HostCrust Assistant — help widget styles. Loaded site-wide via tools/site-header.html.
 * Self-contained: every class is prefixed .hcx- so it can't collide with the page.
 * No inline styles anywhere (the site's strict CSP forbids them); all presentation lives here.
 */

.hcx-root {
  --hcx-navy: #0f172a;
  --hcx-navy-2: #1e293b;
  --hcx-sky: #0284c7;
  --hcx-sky-ink: #ffffff;
  --hcx-green: #0f9d6b;
  --hcx-bg: #ffffff;
  --hcx-panel: #ffffff;
  --hcx-text: #0f172a;
  --hcx-muted: #475569;
  --hcx-border: #e2e8f0;
  --hcx-bot-bg: #f1f5f9;
  --hcx-user-bg: #0284c7;
  --hcx-user-ink: #ffffff;
  --hcx-chip-bg: #eff6ff;
  --hcx-chip-border: #bfdbfe;
  --hcx-chip-ink: #075985;
  --hcx-shadow: 0 10px 40px rgba(2, 8, 23, 0.28);
  --hcx-focus: #0284c7;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000; /* above site chrome, below nothing we control */
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--hcx-text);
}

@media (prefers-color-scheme: dark) {
  .hcx-root {
    --hcx-bg: #0b1220;
    --hcx-panel: #0f172a;
    --hcx-text: #e2e8f0;
    --hcx-muted: #94a3b8;
    --hcx-border: #334155;
    --hcx-bot-bg: #1e293b;
    --hcx-user-bg: #0ea5e9;
    --hcx-user-ink: #04121f;
    --hcx-chip-bg: #0b2537;
    --hcx-chip-border: #1e4a63;
    --hcx-chip-ink: #bae6fd;
    --hcx-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}

/* ---- the launcher bubble ---- */
.hcx-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  background: var(--hcx-navy);
  color: #fff;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  box-shadow: var(--hcx-shadow);
  font: inherit;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.15s ease;
}
.hcx-bubble:hover { background: var(--hcx-navy-2); transform: translateY(-1px); }
.hcx-bubble svg { width: 22px; height: 22px; flex: none; }
.hcx-bubble-label { white-space: nowrap; }

/* ---- the panel ---- */
.hcx-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: var(--hcx-panel);
  border: 1px solid var(--hcx-border);
  border-radius: 16px;
  box-shadow: var(--hcx-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hcx-hidden { display: none !important; }

/* header */
.hcx-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  background: var(--hcx-navy);
  color: #fff;
}
.hcx-head-glyph {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.12); border-radius: 9px;
}
.hcx-head-glyph svg { width: 20px; height: 20px; }
.hcx-head-text { flex: 1 1 auto; min-width: 0; }
.hcx-head-title { font-weight: 700; font-size: 15px; }
.hcx-head-sub { font-size: 12px; opacity: 0.85; }
.hcx-close {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.hcx-close:hover { background: rgba(255, 255, 255, 0.14); }
.hcx-close svg { width: 20px; height: 20px; }

/* message log */
.hcx-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--hcx-bg);
}
.hcx-msg { max-width: 88%; }
.hcx-msg-bot {
  align-self: flex-start;
  background: var(--hcx-bot-bg);
  color: var(--hcx-text);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 13px;
}
.hcx-msg-user {
  align-self: flex-end;
  background: var(--hcx-user-bg);
  color: var(--hcx-user-ink);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 13px;
}
.hcx-msg p { margin: 0 0 8px; }
.hcx-msg p:last-child { margin-bottom: 0; }
.hcx-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.hcx-msg-bot a { color: var(--hcx-sky); }
.hcx-msg code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(2, 8, 23, 0.06);
  padding: 1px 5px; border-radius: 5px;
}
@media (prefers-color-scheme: dark) {
  .hcx-msg code { background: rgba(255, 255, 255, 0.1); }
}

/* suggestion chips */
.hcx-chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 100%; }
.hcx-chip {
  border: 1px solid var(--hcx-chip-border);
  background: var(--hcx-chip-bg);
  color: var(--hcx-chip-ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.hcx-chip:hover { filter: brightness(0.97); }

.hcx-related-label { font-size: 12px; color: var(--hcx-muted); margin: 2px 0 -4px; }

/* footer: always-visible fallbacks + input */
.hcx-foot { border-top: 1px solid var(--hcx-border); background: var(--hcx-panel); }
.hcx-actions {
  display: flex; gap: 8px;
  padding: 10px 12px 0;
}
.hcx-act {
  flex: 1 1 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--hcx-border);
  background: var(--hcx-bg);
  color: var(--hcx-text);
  border-radius: 9px;
  padding: 9px 10px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.hcx-act:hover { border-color: var(--hcx-sky); color: var(--hcx-sky); }
.hcx-act svg { width: 16px; height: 16px; flex: none; }

.hcx-inputrow {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px 12px;
}
.hcx-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--hcx-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit; font-size: 14px;
  color: var(--hcx-text);
  background: var(--hcx-bg);
  max-height: 110px;
  min-height: 42px;
}
.hcx-input:focus { outline: 2px solid var(--hcx-focus); outline-offset: 1px; border-color: var(--hcx-focus); }
.hcx-send {
  flex: none;
  width: 42px; height: 42px;
  border: 0; border-radius: 10px;
  background: var(--hcx-sky); color: var(--hcx-sky-ink);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.hcx-send:hover { filter: brightness(1.05); }
.hcx-send:disabled { opacity: 0.5; cursor: default; }
.hcx-send svg { width: 20px; height: 20px; }

/* ticket form */
.hcx-ticket { padding: 12px 14px 14px; border-top: 1px solid var(--hcx-border); background: var(--hcx-bg); }
.hcx-ticket h3 { margin: 0 0 4px; font-size: 14px; }
.hcx-ticket p.hcx-ticket-note { margin: 0 0 10px; font-size: 12.5px; color: var(--hcx-muted); }
.hcx-field { display: block; margin-bottom: 10px; }
.hcx-field span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.hcx-field input, .hcx-field textarea {
  width: 100%;
  border: 1px solid var(--hcx-border);
  border-radius: 9px;
  padding: 9px 11px;
  font: inherit; font-size: 14px;
  color: var(--hcx-text); background: var(--hcx-panel);
}
.hcx-field input:focus, .hcx-field textarea:focus { outline: 2px solid var(--hcx-focus); outline-offset: 1px; border-color: var(--hcx-focus); }
.hcx-field textarea { resize: vertical; min-height: 70px; }
.hcx-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.hcx-ticket-btns { display: flex; gap: 8px; }
.hcx-btn-primary {
  flex: 1 1 auto;
  border: 0; border-radius: 9px;
  background: var(--hcx-sky); color: var(--hcx-sky-ink);
  padding: 10px 12px; font: inherit; font-weight: 600; cursor: pointer;
}
.hcx-btn-primary:hover { filter: brightness(1.05); }
.hcx-btn-primary:disabled { opacity: 0.6; cursor: default; }
.hcx-btn-ghost {
  flex: none;
  border: 1px solid var(--hcx-border);
  background: var(--hcx-bg); color: var(--hcx-text);
  border-radius: 9px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.hcx-err { color: #b91c1c; font-size: 12.5px; margin: 0 0 8px; }
@media (prefers-color-scheme: dark) { .hcx-err { color: #fca5a5; } }

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

/* phone width: keep the bubble bottom-right, let the panel fill the screen */
@media (max-width: 480px) {
  .hcx-root { right: 12px; bottom: 12px; left: auto; }
  .hcx-panel {
    position: fixed;
    right: 12px; left: 12px; bottom: 12px; top: auto;
    width: auto;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    max-height: none;
    border-radius: 14px;
  }
  .hcx-bubble-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hcx-bubble { transition: none; }
}
