/* High Jet customer bot chat widget */
.hj-bot-root {
  --hj-bot-primary: #12377A;
  --hj-bot-primary-dark: #0d2858;
  --hj-bot-surface: #ffffff;
  --hj-bot-muted: #6b7280;
  --hj-bot-user-bg: #12377A;
  --hj-bot-bot-bg: #f1f5f9;
  --hj-bot-border: #e2e8f0;
  --hj-bot-shadow: 0 12px 40px rgba(18, 55, 122, 0.22);
  --hj-bot-vv-height: 100dvh;
  --hj-bot-vv-offset: 0px;
  position: fixed;
  z-index: 1040;
  bottom: calc(1.25rem + var(--hj-bot-vv-offset));
  inset-inline-end: 1.25rem;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-height: calc(var(--hj-bot-vv-height) - 1.25rem);
}

.hj-bot-fab {
  width: 3.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 50%;
  background: var(--hj-bot-primary);
  color: #fff;
  box-shadow: var(--hj-bot-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.hj-bot-fab:hover,
.hj-bot-fab:focus {
  background: var(--hj-bot-primary-dark);
  outline: none;
  transform: scale(1.04);
}

.hj-bot-fab svg {
  width: 1.55rem;
  height: 1.55rem;
  fill: currentColor;
}

/* Only the header close is shown while open — hide FAB (was a second X below the panel) */
.hj-bot-root.is-open .hj-bot-fab {
  display: none;
}

.hj-bot-panel {
  display: none;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  height: min(28rem, calc(var(--hj-bot-vv-height) - 5.5rem));
  max-height: calc(var(--hj-bot-vv-height) - 2.5rem);
  margin-bottom: 0.75rem;
  background: var(--hj-bot-surface);
  border: 1px solid var(--hj-bot-border);
  border-radius: 1rem;
  box-shadow: var(--hj-bot-shadow);
  overflow: hidden;
}

.hj-bot-root.is-open .hj-bot-panel {
  margin-bottom: 0;
  height: min(28rem, calc(var(--hj-bot-vv-height) - 2.5rem));
  max-height: calc(var(--hj-bot-vv-height) - 2.5rem);
}

.hj-bot-panel.is-open {
  display: flex;
}

.hj-bot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--hj-bot-primary);
  color: #fff;
  flex-shrink: 0;
}

.hj-bot-header-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.hj-bot-header-sub {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  opacity: 0.85;
}

.hj-bot-header-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.hj-bot-icon-btn {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 0;
  opacity: 0.9;
  border-radius: 0.35rem;
}

.hj-bot-icon-btn:hover,
.hj-bot-icon-btn:focus {
  opacity: 1;
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.hj-bot-icon-btn.is-copied {
  opacity: 1;
}

.hj-bot-icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

/* Back-compat if old class remains cached */
.hj-bot-close {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 0;
  opacity: 0.9;
}

.hj-bot-close:hover {
  opacity: 1;
}

.hj-bot-close svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.hj-bot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #fafbfc;
}

.hj-bot-msg {
  max-width: 92%;
  padding: 0.6rem 0.8rem;
  border-radius: 0.85rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.hj-bot-msg--bot {
  align-self: flex-start;
  background: var(--hj-bot-bot-bg);
  color: #1e293b;
  border-end-start-radius: 0.25rem;
  font-size: 1rem;
  line-height: 1.55;
}

.hj-bot-msg--user {
  align-self: flex-end;
  background: var(--hj-bot-user-bg);
  color: #fff;
  border-end-end-radius: 0.25rem;
}

.hj-bot-msg--error {
  align-self: center;
  max-width: 100%;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.8rem;
  text-align: center;
}

.hj-bot-msg--typing {
  color: var(--hj-bot-muted);
  font-style: italic;
}

.hj-bot-msg a {
  color: var(--hj-bot-primary);
  text-decoration: underline;
  word-break: break-all;
}

.hj-bot-msg--user a {
  color: #fff;
}

.hj-bot-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--hj-bot-border);
  background: #fff;
  flex-shrink: 0;
}

.hj-bot-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--hj-bot-border);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  outline: none;
}

.hj-bot-input:focus {
  border-color: var(--hj-bot-primary);
}

.hj-bot-send {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  background: var(--hj-bot-primary);
  color: #fff;
  padding: 0.55rem 0.95rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.hj-bot-send:hover:not(:disabled) {
  background: var(--hj-bot-primary-dark);
}

.hj-bot-send:disabled,
.hj-bot-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .hj-bot-root {
    bottom: calc(0.75rem + var(--hj-bot-vv-offset));
    inset-inline-end: 0.75rem;
    max-height: calc(var(--hj-bot-vv-height) - 0.75rem);
  }

  .hj-bot-panel {
    width: calc(100vw - 1.5rem);
    height: min(70dvh, calc(var(--hj-bot-vv-height) - 5.5rem));
  }

  .hj-bot-root.is-open .hj-bot-panel {
    height: calc(var(--hj-bot-vv-height) - 1.5rem);
    max-height: calc(var(--hj-bot-vv-height) - 1.5rem);
  }
}
