/* GapMetric FAQ chatbot widget — uses the theme's design tokens (with literal
   fallbacks so it looks right even if loaded before style.css). */

.gmchat {
  --gm-bg:        var(--color-surface, #111518);
  --gm-bg-2:      var(--color-surface-2, #181d21);
  --gm-border:    var(--color-border, #1f2830);
  --gm-accent:    var(--color-accent, #c8a96e);
  --gm-text:      var(--color-text, #e8e2d9);
  --gm-muted:     var(--color-text-muted, #7a8490);
  --gm-bubble-bg: #0a0d0f;
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9999;
  font-family: var(--font-body, 'DM Sans', 'Helvetica Neue', sans-serif);
}

/* ── Floating toggle button ── */
.gmchat__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gm-accent);
  color: #0a0d0f;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s;
}
.gmchat__toggle:hover { transform: translateY(-2px); }
.gmchat__toggle-close { display: none; font-size: 1.5rem; line-height: 1; }
.gmchat__toggle.is-open { padding: 0.85rem 1rem; }
.gmchat__toggle.is-open .gmchat__toggle-open { display: none; }
.gmchat__toggle.is-open .gmchat__toggle-close { display: inline; }

/* ── Panel ── */
.gmchat__panel {
  position: absolute;
  right: 0;
  bottom: 4rem;
  width: min(370px, calc(100vw - 2.5rem));
  height: min(540px, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  background: var(--gm-bg);
  border: 1px solid var(--gm-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: gmchat-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
/* The panel's display:flex would otherwise override the [hidden] attribute,
   so closing (hidden=true) wouldn't actually hide it. This makes hidden win. */
.gmchat__panel[hidden] { display: none; }
@keyframes gmchat-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gmchat__header {
  padding: 1rem 1.1rem;
  background: var(--gm-bg-2);
  border-bottom: 1px solid var(--gm-border);
}
.gmchat__title {
  display: block;
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 1.05rem;
  color: #fff;
}
.gmchat__status {
  display: block;
  font-size: 0.72rem;
  color: var(--gm-muted);
  margin-top: 0.15rem;
}

/* ── Message log ── */
.gmchat__log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.gmchat__msg {
  max-width: 85%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.gmchat__msg--bot {
  align-self: flex-start;
  background: var(--gm-bg-2);
  color: var(--gm-text);
  border: 1px solid var(--gm-border);
  border-bottom-left-radius: 3px;
}
.gmchat__msg--user {
  align-self: flex-end;
  background: var(--gm-accent);
  color: #0a0d0f;
  border-bottom-right-radius: 3px;
}
.gmchat__msg--typing { color: var(--gm-muted); letter-spacing: 0.15em; }

/* ── CTA button inside the log ── */
.gmchat__cta-wrap { background: none; border: none; padding: 0; max-width: 100%; }
.gmchat__cta {
  display: inline-block;
  background: var(--gm-accent);
  color: #0a0d0f !important;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.2s;
}
.gmchat__cta:hover { filter: brightness(1.08); }

/* ── Quick-reply chips ── */
.gmchat__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.gmchat__chip {
  background: transparent;
  border: 1px solid var(--gm-accent);
  color: var(--gm-accent);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}
.gmchat__chip:hover { background: var(--gm-accent); color: #0a0d0f; }

/* ── Input row ── */
.gmchat__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--gm-border);
  background: var(--gm-bg-2);
}
.gmchat__input {
  flex: 1;
  background: var(--gm-bubble-bg);
  border: 1px solid var(--gm-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--gm-text);
  font-size: 0.9rem;
  font-family: inherit;
}
.gmchat__input:focus { outline: none; border-color: var(--gm-accent); }
.gmchat__send {
  background: var(--gm-accent);
  color: #0a0d0f;
  border: none;
  border-radius: 8px;
  width: 2.6rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: filter 0.2s;
}
.gmchat__send:hover { filter: brightness(1.08); }

@media (prefers-reduced-motion: reduce) {
  .gmchat__toggle, .gmchat__panel, .gmchat__cta, .gmchat__send { transition: none; animation: none; }
}
