/* === NRI OUTPOST CHAT WIDGET ===
 * Shared chat button + chat panel + contact form modal.
 * Relies on the host page's CSS variables: --ink, --paper, --rule, --card,
 * --card-2, --paper-2, --ink-2, --ink-3, --saffron, --gold.
 * The three product pages (index, cities, first-month-wizard) all define
 * the same palette in :root, so this file just inherits cleanly.
 */
.chat-btn {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  cursor: pointer;
  z-index: 90;
  box-shadow: 0 12px 32px -8px rgba(26,20,16,0.35);
  display: grid; place-items: center;
  transition: transform 0.2s, background 0.2s;
}
.chat-btn:hover { background: var(--saffron); transform: scale(1.05); }
.chat-btn:focus { outline: none; }
.chat-btn:focus-visible { outline: 2px solid var(--saffron); outline-offset: 3px; }
.chat-btn.open { background: var(--saffron); }
.chat-btn-icon { width: 24px; height: 24px; pointer-events: none; }
.chat-btn .chat-icon-close { display: none; }
.chat-btn.open .chat-icon-open { display: none; }
.chat-btn.open .chat-icon-close { display: block; }
.chat-btn-dot {
  position: absolute; top: 6px; right: 6px;
  width: 12px; height: 12px;
  background: var(--saffron);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
.chat-btn.open .chat-btn-dot { display: none; }

.chat-panel {
  position: fixed;
  bottom: 92px; right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 18px;
  box-shadow: 0 28px 60px -16px rgba(26,20,16,0.32);
  z-index: 91;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--card);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-head-title {
  font-family: "Instrument Serif", serif;
  font-size: 20px;
  line-height: 1.1;
}
.chat-head-title em { font-style: italic; color: var(--saffron); }
.chat-head-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.chat-close {
  background: none; border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 22px;
  color: var(--ink-3);
  cursor: pointer;
  display: grid; place-items: center;
}
.chat-close:hover { background: var(--paper-2); color: var(--ink); }

.chat-disclaimer {
  padding: 10px 16px;
  background: color-mix(in oklab, var(--gold) 12%, var(--paper-2));
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.4;
}
.chat-disclaimer strong { color: var(--ink); font-weight: 600; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.chat-msg { max-width: 86%; }
.chat-msg.bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}
.chat-msg.bot strong { color: var(--ink); font-weight: 600; }
.chat-msg.bot a {
  display: inline-block;
  background: color-mix(in oklab, var(--saffron) 12%, transparent);
  color: var(--saffron);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  margin: 4px 4px 0 0;
}
.chat-msg.bot a:hover { background: var(--saffron); color: var(--paper); text-decoration: none; }
.chat-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
}
.chat-msg.system {
  align-self: center;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
  padding: 6px 12px;
}

.chat-typing {
  display: flex; gap: 4px;
  padding: 16px 14px;
  align-items: center;
}
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: chat-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.chat-suggest {
  padding: 0 16px 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chat-suggest-label {
  font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  width: 100%; margin-bottom: 4px;
}
.chat-suggest-chip {
  background: var(--card);
  border: 1px solid var(--rule);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.chat-suggest-chip:hover { border-color: var(--ink); background: var(--paper-2); }

.chat-input-wrap {
  border-top: 1px solid var(--rule);
  padding: 12px 16px;
  background: var(--card);
}
.chat-input-row {
  display: flex; gap: 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  align-items: center;
}
.chat-input {
  flex: 1;
  border: none; background: none;
  font-family: inherit; font-size: 14px;
  color: var(--ink); outline: none;
  padding: 10px 0;
}
.chat-input::placeholder { color: var(--ink-3); }
.chat-send {
  background: var(--ink);
  color: var(--paper);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
}
.chat-send:hover { background: var(--saffron); }
.chat-send:disabled { background: var(--rule); cursor: not-allowed; }
.chat-escalate {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
}
.chat-escalate button {
  background: none; border: none;
  color: var(--saffron);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-family: inherit; font-size: 11px;
  font-weight: 600;
}

/* Contact form modal */
.contact-modal-bg {
  position: fixed; inset: 0;
  background: rgba(26,20,16,0.6);
  z-index: 110;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.contact-modal-bg.open { display: flex; }
.contact-modal {
  background: var(--paper);
  border-radius: 18px;
  max-width: 480px; width: 100%;
  padding: 32px;
  border: 1px solid var(--rule);
  box-shadow: 0 28px 60px -16px rgba(0,0,0,0.4);
}
.contact-modal h3 {
  font-family: "Instrument Serif", serif;
  font-size: 30px;
  line-height: 1.1;
  margin-bottom: 6px;
}
.contact-modal h3 em { font-style: italic; color: var(--saffron); }
.contact-modal p.sub {
  font-size: 14px; color: var(--ink-2);
  margin-bottom: 22px;
  line-height: 1.55;
}
.contact-field { margin-bottom: 14px; }
.contact-field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}
.contact-field input,
.contact-field textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}
.contact-field input:focus,
.contact-field textarea:focus { border-color: var(--ink); }
.contact-field textarea {
  resize: vertical;
  min-height: 110px;
}
.contact-actions {
  display: flex; gap: 10px;
  margin-top: 20px;
}
.contact-btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.contact-btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.contact-btn-primary:hover { background: var(--saffron); }
.contact-btn-secondary {
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}
.contact-mailto {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}
.contact-mailto a { color: var(--saffron); font-weight: 600; }
.contact-success {
  text-align: center;
  padding: 16px 0;
}
.contact-success-icon {
  font-family: "Instrument Serif", serif;
  font-size: 56px;
  color: var(--saffron);
  line-height: 1;
}
.contact-legal {
  margin-top: 18px;
  font-size: 10px;
  color: var(--ink-3);
  line-height: 1.5;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.contact-legal a { color: var(--ink-2); text-decoration: underline; }

@media (max-width: 480px) {
  .chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 84px; height: calc(100vh - 110px); }
  .chat-btn { bottom: 16px; right: 16px; }
}
