/* ================================================================
   J&M Connections — AI chat widget (MC #3501)
   jnm-chat.css v1.0 — plain CSS, no build step, no framework.
   Reuses the design tokens already defined in jnmc.css (:root custom
   properties) -- load this file AFTER jnmc.css. Renders nothing unless
   jnm-chat.js decides the feature is on (see that file's header comment).
   ================================================================ */

.jnm-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--navy, #14233B);
  background: var(--orange, #E2661D);
  border: 2px solid var(--orange, #E2661D);
  border-radius: 999px;
  padding: 0.8125rem 1.25rem;
  box-shadow: 0 8px 24px rgba(20, 35, 59, 0.3);
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.jnm-chat-launcher:hover { background: var(--orange-deep, #B84E12); border-color: var(--orange-deep, #B84E12); transform: translateY(-1px); }
.jnm-chat-launcher[hidden] { display: none; }
.jnm-chat-launcher .jnm-chat-launcher-icon { font-size: 1.125rem; line-height: 1; }

.jnm-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 901;
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--white, #fff);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(13, 24, 38, 0.35);
  overflow: hidden;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.875rem;
}
.jnm-chat-panel[hidden] { display: none; }

.jnm-chat-header {
  background: var(--navy, #14233B);
  color: var(--white, #fff);
  padding: 0.75rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.jnm-chat-header-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; min-width: 0; }
.jnm-chat-header-title span.jnm-chat-title-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jnm-chat-ai-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy, #14233B);
  background: var(--white, #fff);
  border-radius: 999px;
  padding: 0.125rem 0.5rem;
  flex: none;
}
.jnm-chat-close {
  background: transparent;
  border: 0;
  color: var(--white, #fff);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
  border-radius: 6px;
}
.jnm-chat-close:hover { background: rgba(255,255,255,0.15); }

.jnm-chat-log {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 160px;
}

.jnm-chat-msg {
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  max-width: 88%;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.jnm-chat-msg-bot { background: var(--cloud, #F5F7F9); color: var(--navy, #14233B); align-self: flex-start; }
.jnm-chat-msg-me  { background: var(--orange, #E2661D); color: var(--white, #fff); align-self: flex-end; }
.jnm-chat-msg-error { background: #FBEAEA; color: var(--error, #B3261E); align-self: flex-start; border: 1px solid #f0c6c6; }
.jnm-chat-msg-pending { opacity: 0.7; font-style: italic; }

.jnm-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0 0.75rem 0.625rem;
}
.jnm-chat-chip {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--navy, #14233B);
  background: var(--white, #fff);
  border: 1px solid var(--steel-mist, #D7DEE5);
  border-radius: 999px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}
.jnm-chat-chip:hover { border-color: var(--cyan, #1791A8); }

.jnm-chat-bid-link {
  display: block;
  padding: 0 0.75rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--cyan, #1791A8);
}

.jnm-chat-consent {
  padding: 0 0.75rem 0.625rem;
  border-top: 1px solid var(--steel-mist, #D7DEE5);
  padding-top: 0.625rem;
}
.jnm-chat-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--slate-mist, #6B7684);
  cursor: pointer;
}
.jnm-chat-consent-checkbox {
  flex: none;
  margin-top: 0.15rem;
}
.jnm-chat-consent-privacy-link {
  color: var(--cyan, #1791A8);
  font-weight: 600;
  text-decoration: underline;
}

.jnm-chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--steel-mist, #D7DEE5);
  flex: none;
}
.jnm-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--steel-mist, #D7DEE5);
  border-radius: 8px;
  color: var(--navy, #14233B);
}
.jnm-chat-send {
  flex: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--navy, #14233B);
  background: var(--orange, #E2661D);
  border: 2px solid var(--orange, #E2661D);
  border-radius: 8px;
  padding: 0.5rem 0.875rem;
  cursor: pointer;
}
.jnm-chat-send:hover { background: var(--orange-deep, #B84E12); border-color: var(--orange-deep, #B84E12); }
.jnm-chat-send:disabled, .jnm-chat-input:disabled { opacity: 0.6; cursor: not-allowed; }

.jnm-chat-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  .jnm-chat-panel { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .jnm-chat-launcher { right: 12px; bottom: 12px; }
}
