/* Luma site chat widget — matches index.html :root tokens.
   APPLY note: FormSubmit (hello@askluma.co.za) may need one inbox confirmation
   the first time a lead is posted. */
:root {
  --luma-navy: #0B1629;
  --luma-gold: #D4A843;
  --luma-gold-lt: #E8C76A;
  --luma-gold-ink: #8A6420;
  --luma-paper: #FBFAF8;
  --luma-white: #FFFFFF;
  --luma-ink: #141A23;
  --luma-ink-2: #48525F;
  --luma-muted: #737C8A;
  --luma-line: #E6E2DB;
  --luma-line-navy: #1F3350;
}

.luma-chat-root {
  --navy: var(--luma-navy);
  --gold: var(--luma-gold);
  --gold-lt: var(--luma-gold-lt);
  --gold-ink: var(--luma-gold-ink);
  --paper: var(--luma-paper);
  --white: var(--luma-white);
  --ink: var(--luma-ink);
  --ink-2: var(--luma-ink-2);
  --muted: var(--luma-muted);
  --line: var(--luma-line);
  --line-navy: var(--luma-line-navy);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  -webkit-font-smoothing: antialiased;
}

.luma-chat-launcher {
  position: fixed;
  z-index: 99980;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 14px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #F4F1EC;
  box-shadow: 0 10px 28px rgba(11, 22, 41, 0.28), 0 0 0 1px rgba(212, 168, 67, 0.25);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.luma-chat-launcher:hover {
  background: #12203a;
  box-shadow: 0 12px 32px rgba(11, 22, 41, 0.34), 0 0 0 1px var(--gold);
}
.luma-chat-launcher:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.luma-chat-launcher[aria-expanded="true"] {
  transform: scale(0.96);
}
.luma-chat-launcher-icon {
  display: flex;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--gold);
}
.luma-chat-launcher-label {
  white-space: nowrap;
}
@media (max-width: 420px) {
  .luma-chat-launcher-label { display: none; }
  .luma-chat-launcher {
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}

.luma-chat-panel {
  position: fixed;
  z-index: 99990;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 72px);
  width: min(392px, calc(100vw - 24px));
  max-height: min(640px, calc(100dvh - 100px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(11, 22, 41, 0.22);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.luma-chat-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}
@media (max-width: 420px) {
  .luma-chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 68px);
    max-height: calc(100dvh - 88px);
  }
}

.luma-chat-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 14px;
  background: var(--navy);
  color: #C2CCDA;
  flex-shrink: 0;
}
.luma-chat-brand {
  flex: 1;
  min-width: 0;
}
.luma-chat-brand-title {
  margin: 0;
  font-family: 'Spectral', Georgia, serif;
  font-weight: 500;
  font-size: 18px;
  color: #F4F1EC;
  letter-spacing: -0.01em;
}
.luma-chat-brand-title span { color: var(--gold); }
.luma-chat-brand-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #8A98AD;
  line-height: 1.4;
}
.luma-chat-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin: -6px -6px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8A98AD;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
}
.luma-chat-close:hover { color: var(--gold); background: rgba(255,255,255,0.06); }
.luma-chat-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.luma-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  -webkit-overflow-scrolling: touch;
}
.luma-chat-msg {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 14.5px;
  line-height: 1.55;
  word-wrap: break-word;
}
.luma-chat-msg p { margin: 0 0 8px; }
.luma-chat-msg p:last-child { margin-bottom: 0; }
.luma-chat-msg a {
  color: var(--gold-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.luma-chat-msg--bot {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-bottom-left-radius: 3px;
}
.luma-chat-msg--user {
  align-self: flex-end;
  background: var(--navy);
  color: #F4F1EC;
  border-bottom-right-radius: 3px;
}
.luma-chat-msg--system {
  align-self: center;
  max-width: 100%;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12.5px;
  padding: 4px 8px;
  text-align: center;
}

.luma-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 14px 12px;
  flex-shrink: 0;
}
.luma-chat-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.luma-chat-chip:hover {
  border-color: var(--gold);
  color: var(--gold-ink);
  background: #FFFBF2;
}
.luma-chat-chip:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.luma-chat-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: var(--white);
  flex-shrink: 0;
}
.luma-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--paper);
  resize: none;
  min-height: 44px;
  max-height: 96px;
  line-height: 1.4;
}
.luma-chat-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}
.luma-chat-input::placeholder { color: var(--muted); }
.luma-chat-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.luma-chat-send:hover { background: var(--gold-lt); }
.luma-chat-send:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}
.luma-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.luma-chat-lead {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: var(--white);
  flex-shrink: 0;
}
.luma-chat-lead-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.luma-chat-lead-hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}
.luma-chat-field {
  margin-bottom: 10px;
}
.luma-chat-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.luma-chat-field input,
.luma-chat-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--paper);
}
.luma-chat-field input:focus,
.luma-chat-field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.18);
}
.luma-chat-field textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}
.luma-chat-lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.luma-chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.luma-chat-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.luma-chat-btn--primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
  flex: 1 1 auto;
}
.luma-chat-btn--primary:hover { background: var(--gold-lt); }
.luma-chat-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.luma-chat-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.luma-chat-btn--ghost:hover {
  border-color: var(--gold);
  color: var(--gold-ink);
}
.luma-chat-lead-error {
  margin: 0 0 10px;
  font-size: 13px;
  color: #9B2C2C;
  display: none;
}
.luma-chat-lead-error.is-visible { display: block; }
.luma-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.luma-chat-open {
  /* Keep page scrollable; panel traps focus instead of locking body on mobile. */
}
