/* ==========================================================================
   Nova — LockettFlow AI website chat widget
   Brand: dark navy #070b16 / #0d2435 · amber #f0a332 / #f5b942 · cream #f9f5eb
   Body font: "Avenir Next", Avenir, "Segoe UI", sans-serif
   ========================================================================== */

/* Scoped to #nova-chat-root so the host site's CSS can't leak in. */
#nova-chat-root,
#nova-chat-root *,
#nova-chat-root *::before,
#nova-chat-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#nova-chat-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000; /* above site chrome, below nothing else matters */
  pointer-events: none;
  color: #f9f5eb;
}

#nova-chat-root > * { pointer-events: auto; }

/* ---------------- Launcher (bottom-right, amber, subtle pulse) ---------------- */

#nova-launcher {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #f5b942 0%, #f0a332 55%, #e8962a 100%);
  box-shadow: 0 8px 28px rgba(240, 163, 50, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#nova-launcher:hover { transform: scale(1.07); }
#nova-launcher:active { transform: scale(0.96); }

#nova-launcher svg { width: 30px; height: 30px; stroke: #070b16; }

/* pulse ring — ambient only, stops on hover/open */
#nova-launcher::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(240, 163, 50, 0.55);
  animation: nova-pulse 2.6s ease-out infinite;
  pointer-events: none;
}

#nova-launcher.nova-open::after { animation: none; opacity: 0; }
#nova-launcher:hover::after { animation: none; opacity: 0; }

@keyframes nova-pulse {
  0%   { transform: scale(0.92); opacity: 0.9; }
  70%  { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}

/* unread dot for the proactive nudge */
#nova-launcher .nova-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  background: #d84f2b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  border: 2px solid #070b16;
  display: none;
}
#nova-launcher.nova-has-unread .nova-badge { display: block; }

/* ---------------- Chat panel (dark-navy glass) ---------------- */

#nova-panel {
  position: absolute;
  right: 24px;
  bottom: 100px;
  width: 384px;
  max-width: calc(100vw - 48px);
  height: min(600px, calc(100vh - 140px));
  min-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(7, 11, 22, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(240, 163, 50, 0.28);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#nova-panel.nova-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------------- Header ---------------- */

#nova-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(13, 36, 53, 0.9), rgba(7, 11, 22, 0.6));
  border-bottom: 1px solid rgba(240, 163, 50, 0.22);
  flex-shrink: 0;
}

#nova-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f5b942, #e8962a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 14px rgba(240, 163, 50, 0.5);
}

#nova-header-meta { flex: 1; min-width: 0; }

#nova-header-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f9f5eb;
}

#nova-header-sub {
  font-size: 12px;
  color: #aab8c2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#nova-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
  flex-shrink: 0;
}

#nova-header-actions { display: flex; gap: 4px; }

.nova-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #aab8c2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.nova-icon-btn:hover { background: rgba(240, 163, 50, 0.14); color: #f5b942; }
.nova-icon-btn svg { width: 17px; height: 17px; }

/* ---------------- Messages ---------------- */

#nova-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 163, 50, 0.4) transparent;
}
#nova-messages::-webkit-scrollbar { width: 6px; }
#nova-messages::-webkit-scrollbar-thumb { background: rgba(240, 163, 50, 0.35); border-radius: 3px; }

.nova-msg-row { display: flex; width: 100%; }
.nova-msg-row.nova-from-nova   { justify-content: flex-start; }
.nova-msg-row.nova-from-user   { justify-content: flex-end; }

.nova-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: nova-bubble-in 0.22s ease;
}

@keyframes nova-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Nova — left, dark navy card, cream text */
.nova-from-nova .nova-bubble {
  background: #0d2435;
  color: #f9f5eb;
  border: 1px solid rgba(240, 163, 50, 0.14);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Visitor — right, amber, dark text */
.nova-from-user .nova-bubble {
  background: linear-gradient(135deg, #f5b942, #f0a332);
  color: #070b16;
  border-bottom-right-radius: 5px;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(240, 163, 50, 0.25);
}

/* links inside Nova bubbles */
.nova-from-nova .nova-bubble a {
  color: #f5b942;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nova-from-nova .nova-bubble a:hover { color: #ffd88f; }

/* system / status line (errors, "copied", etc.) */
.nova-sysline {
  align-self: center;
  font-size: 12px;
  color: #aab8c2;
  background: rgba(170, 184, 194, 0.1);
  padding: 5px 12px;
  border-radius: 10px;
  text-align: center;
  max-width: 90%;
}

/* ---------------- Typing indicator ---------------- */

.nova-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
}

.nova-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f5b942;
  opacity: 0.4;
  animation: nova-typing-bounce 1.2s ease-in-out infinite;
}
.nova-typing span:nth-child(2) { animation-delay: 0.15s; }
.nova-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes nova-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------------- Quick-reply chips ---------------- */

#nova-chips {
  display: flex;
  gap: 8px;
  padding: 4px 14px 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
#nova-chips:empty { display: none; }

.nova-chip {
  border: 1px solid rgba(240, 163, 50, 0.55);
  background: rgba(240, 163, 50, 0.08);
  color: #f5b942;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}
.nova-chip:hover {
  background: #f0a332;
  color: #070b16;
  transform: translateY(-1px);
}
.nova-chip:active { transform: translateY(0); }

/* ---------------- Input bar ---------------- */

#nova-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(240, 163, 50, 0.18);
  background: rgba(7, 11, 22, 0.7);
  flex-shrink: 0;
}

#nova-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(170, 184, 194, 0.25);
  background: rgba(13, 36, 53, 0.7);
  color: #f9f5eb;
  font-size: 14.5px;
  padding: 11px 14px;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#nova-input::placeholder { color: rgba(170, 184, 194, 0.55); }
#nova-input:focus {
  border-color: rgba(240, 163, 50, 0.7);
  box-shadow: 0 0 0 3px rgba(240, 163, 50, 0.15);
}

#nova-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #f5b942, #e8962a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(240, 163, 50, 0.4);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
#nova-send:hover { transform: scale(1.06); }
#nova-send:active { transform: scale(0.94); }
#nova-send:disabled { opacity: 0.45; cursor: default; transform: none; }
#nova-send svg { width: 19px; height: 19px; stroke: #070b16; }

#nova-powered {
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: rgba(170, 184, 194, 0.5);
  padding: 0 0 8px;
  text-transform: uppercase;
}

/* ---------------- Mobile ---------------- */

@media (max-width: 480px) {
  #nova-launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  #nova-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 92vh;
    min-height: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(24px);
  }
  #nova-panel.nova-open { transform: translateY(0); }
  .nova-bubble { max-width: 88%; }
}

/* ---------------- Reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  #nova-launcher::after { animation: none; opacity: 0; }
  .nova-bubble { animation: none; }
  .nova-typing span { animation: none; opacity: 0.7; }
  #nova-panel { transition: opacity 0.1s ease; transform: none; }
  #nova-launcher, #nova-send, .nova-chip { transition: none; }
}
