/* NorthStead website chat bubble. Self-contained: does not rely on the site's CSS variables. */
.nsc {
  --nsc-bg: #141414;
  --nsc-surface: #1f1f1f;
  --nsc-border: #2e2e2e;
  --nsc-green: #5c7a3e;
  --nsc-green-lt: #7a9f55;
  --nsc-gold: #c9a84c;
  --nsc-text: #e8e4dc;
  --nsc-muted: #9a9690;
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9990;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--nsc-text);
}

.nsc-bubble {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.7rem 1.1rem 0.7rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #4a7c2f 0%, #5c9a3a 100%);
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(74, 124, 47, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.nsc-bubble:hover { transform: translateY(-2px); }
/* Both the bubble and the window's title bar are drag handles. */
.nsc-bubble, .nsc-head { touch-action: none; -webkit-user-select: none; user-select: none; }
.nsc-head { cursor: move; }
.nsc-dragging, .nsc-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.nsc-dragging .nsc-bubble { transform: none; }
.nsc-bubble:focus-visible, .nsc-send:focus-visible, .nsc-close:focus-visible { outline: 2px solid var(--nsc-gold); outline-offset: 2px; }
.nsc-bubble svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; }
.nsc-open .nsc-bubble { display: none; }

.nsc-panel {
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 2rem));
  height: min(560px, calc(100vh - 2.5rem));
  background: var(--nsc-bg);
  border: 1px solid var(--nsc-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.nsc-panel[hidden] { display: none; }

.nsc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--nsc-surface);
  border-bottom: 3px solid var(--nsc-green);
}
.nsc-title { display: flex; flex-direction: column; }
.nsc-title strong { font-size: 0.98rem; color: #fff; }
.nsc-title span { font-size: 0.78rem; color: var(--nsc-muted); }
.nsc-close {
  border: 0;
  background: none;
  color: var(--nsc-muted);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}
.nsc-close:hover { color: #fff; }

.nsc-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.nsc-msg { display: flex; flex-direction: column; max-width: 88%; }
.nsc-text {
  padding: 0.6rem 0.85rem;
  border-radius: 14px;
  font-size: 0.95rem;
  word-wrap: break-word;
}
.nsc-bot { align-self: flex-start; }
.nsc-bot .nsc-text { background: var(--nsc-surface); border: 1px solid var(--nsc-border); border-bottom-left-radius: 4px; }
.nsc-me { align-self: flex-end; }
.nsc-me .nsc-text { background: var(--nsc-green); color: #fff; border-bottom-right-radius: 4px; }
.nsc-text a { color: var(--nsc-green-lt); font-weight: 600; }
.nsc-me .nsc-text a { color: #fff; }

.nsc-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.nsc-photos a { display: block; color: var(--nsc-muted); font-size: 0.72rem; text-decoration: none; }
.nsc-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--nsc-border);
}
.nsc-photos span { display: block; margin-top: 0.15rem; }

.nsc-typing .nsc-text { display: flex; gap: 4px; padding: 0.8rem 0.9rem; }
.nsc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nsc-muted);
  animation: nsc-dot 1.2s infinite ease-in-out;
}
.nsc-typing span:nth-child(2) { animation-delay: 0.15s; }
.nsc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes nsc-dot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.nsc-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem;
  border-top: 1px solid var(--nsc-border);
  background: var(--nsc-surface);
}
.nsc-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--nsc-border);
  border-radius: 10px;
  background: var(--nsc-bg);
  color: var(--nsc-text);
  font: inherit;
  font-size: 16px; /* 16px stops iPhone from zooming in on focus */
}
.nsc-input:focus { outline: none; border-color: var(--nsc-green-lt); }
.nsc-send {
  border: 0;
  border-radius: 10px;
  padding: 0 1rem;
  background: var(--nsc-green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.nsc-send:disabled { opacity: 0.5; cursor: default; }

.nsc-foot {
  padding: 0.4rem 0.75rem 0.55rem;
  background: var(--nsc-surface);
  font-size: 0.72rem;
  color: var(--nsc-muted);
  text-align: center;
}
.nsc-foot a { color: var(--nsc-green-lt); }

@media (max-width: 520px) {
  .nsc { right: 0.75rem; bottom: 0.75rem; }
  /* On a phone the open chat fills the screen, wherever the bubble was dragged. */
  .nsc-open { right: 0 !important; bottom: 0 !important; left: 0 !important; top: 0 !important; }
  .nsc-open .nsc-head { cursor: default; }
  .nsc-open .nsc-panel { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nsc-bubble, .nsc-typing span { transition: none; animation: none; }
}
