/* specs/010-ai-chat-assistant: shared chat widget styling, loaded by every
   site-kind that includes _chat_widget.html (storefront/marketing/coach/
   portal). Uses marketing/tokens.css custom properties so it matches
   whichever site it's dropped into without its own token set. */

#chat-widget {
  position: fixed;
  right: var(--space-4, 1.5rem);
  bottom: var(--space-4, 1.5rem);
  z-index: 2147483000;
  font-family: var(--font-body, system-ui, sans-serif);
}

#chat-widget-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: none;
  border-radius: var(--radius-pill, 999px);
  padding: .875rem 1.25rem;
  background: var(--ascent-500, #FF6A3D);
  color: var(--text-on-ink-high, #FFF8F0);
  font-family: inherit;
  font-size: var(--fs-300, .9375rem);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 12px 32px -8px rgba(11, 18, 32, .18));
  transition: transform var(--dur-fast, 180ms) var(--ease-out, ease),
              background var(--dur-fast, 180ms) var(--ease-out, ease);
}

#chat-widget-toggle:hover {
  background: var(--ascent-600, #E8502A);
  transform: translateY(-1px);
}

#chat-widget-toggle__icon {
  font-size: 1.125rem;
}

#chat-widget-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + .75rem);
  width: min(22rem, calc(100vw - 2.5rem));
  max-height: min(32rem, calc(100vh - 8rem));
  flex-direction: column;
  background: var(--paper-000, #fff);
  color: var(--text-900, #0B1220);
  border-radius: var(--radius-lg, 1.75rem);
  border: 1px solid var(--border-100, rgba(11, 18, 32, .08));
  box-shadow: var(--shadow-md, 0 12px 32px -8px rgba(11, 18, 32, .18));
  overflow: hidden;
  /* The [hidden] attribute is how JS opens/closes this panel (toggle.js) --
     an ID selector like this one has higher specificity than the browser's
     default `[hidden] { display: none }` rule, so `display` must stay
     conditional on :not([hidden]) below or the panel renders open/unclosable
     regardless of the attribute. */
  display: none;
}

#chat-widget-panel:not([hidden]) {
  display: flex;
}

.chat-widget-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.125rem;
  background: var(--ink-900, #0B1220);
  color: var(--text-on-ink-high, #FFF8F0);
  font-weight: 600;
  font-size: var(--fs-300, .9375rem);
}

#chat-widget-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: .25rem;
}

#chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  min-height: 12rem;
}

.chat-widget-message {
  max-width: 85%;
  padding: .625rem .875rem;
  border-radius: var(--radius-md, 1rem);
  font-size: var(--fs-300, .9375rem);
  line-height: var(--lh-normal, 1.5);
  white-space: pre-wrap;
}

.chat-widget-message--visitor {
  align-self: flex-end;
  background: var(--ascent-500, #FF6A3D);
  color: var(--text-on-ink-high, #FFF8F0);
  border-bottom-right-radius: .25rem;
}

.chat-widget-message--assistant {
  align-self: flex-start;
  background: var(--paper-100, #FFF1E2);
  color: var(--text-900, #0B1220);
  border-bottom-left-radius: .25rem;
}

.chat-widget-message--declined {
  background: var(--paper-200, #FCE4CC);
  color: var(--text-600, #4B5566);
  font-style: italic;
}

.chat-widget-bottom-form {
  gap: .5rem;
  padding: .875rem;
  border-top: 1px solid var(--border-100, rgba(11, 18, 32, .08));
  /* Same [hidden]-vs-specificity note as #chat-widget-panel above -- both
     this form and the email gate toggle via the hidden attribute. */
  display: none;
}

.chat-widget-bottom-form:not([hidden]) {
  display: flex;
}

.chat-widget-gate-hint {
  margin: 0;
  padding: .75rem 1.125rem 0;
  font-size: var(--fs-200, .8125rem);
  color: var(--text-600, #4B5566);
}

.chat-widget-bottom-form input {
  flex: 1;
  border: 1px solid var(--border-200, rgba(11, 18, 32, .14));
  border-radius: var(--radius-pill, 999px);
  padding: .625rem 1rem;
  font-family: inherit;
  font-size: var(--fs-300, .9375rem);
  color: var(--text-900, #0B1220);
  background: var(--paper-000, #fff);
}

.chat-widget-bottom-form input:focus {
  outline: 2px solid var(--horizon-400, #6C94F0);
  outline-offset: 1px;
}

.chat-widget-bottom-form button[type="submit"] {
  border: none;
  border-radius: var(--radius-pill, 999px);
  padding: .625rem 1.125rem;
  background: var(--ink-900, #0B1220);
  color: var(--text-on-ink-high, #FFF8F0);
  font-family: inherit;
  font-size: var(--fs-300, .9375rem);
  font-weight: 600;
  cursor: pointer;
}

.chat-widget-bottom-form button[type="submit"]:hover {
  background: var(--ink-800, #141D33);
}

@media (max-width: 30rem) {
  #chat-widget {
    right: var(--space-2, .75rem);
    bottom: var(--space-2, .75rem);
  }

  #chat-widget-panel {
    width: calc(100vw - 1.5rem);
  }
}
