/* Chat messenger — shared by index.html and gallery.html (markup is built by
   chat.js). Brand tokens come from the page's :root; the fallbacks keep it
   intact on a page that doesn't define them. */

.nlc, .nlc-launch, .nlc-tease {
  --c-ink: var(--ink, #050505);
  --c-asphalt: var(--asphalt, #0a0a0a);
  --c-surface: var(--surface, #111111);
  --c-steel: var(--steel, #1e1e1e);
  --c-steel-2: var(--steel-2, #2a2a2a);
  --c-red: var(--red, #E10600);
  --c-red-hot: var(--red-hot, #ff1a0d);
  --c-bone: var(--bone, #f0f0f0);
  --c-ash: var(--ash, #b8b8b8);
  box-sizing: border-box;
  font-family: 'Rajdhani', system-ui, sans-serif;
}
.nlc *, .nlc-launch *, .nlc-tease * { box-sizing: border-box; }

/* ---------- launcher ---------- */
.nlc-launch {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 18px 0 16px;
  background: linear-gradient(180deg, #ff3527 0%, #E10600 18%, #b30400 46%, #8a0300 50%, #a40400 78%, #5c0200 100%);
  border: 1px solid rgba(0,0,0,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 8px 26px rgba(0,0,0,.6), 0 2px 12px rgba(225,6,0,.4);
  color: #fff;
  font-family: 'Archivo Black', sans-serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s ease;
}
.nlc-launch:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 12px 30px rgba(0,0,0,.7), 0 0 26px rgba(255,40,30,.4); }
.nlc-launch[hidden] { display: none; }
.nlc-launch .nlc-dot { position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; background: var(--c-bone); border: 2px solid var(--c-ink); border-radius: 50%; }
.nlc-launch .nlc-dot[hidden] { display: none; }

/* ---------- teaser ---------- */
.nlc-tease {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 70;
  max-width: min(280px, calc(100vw - 32px));
  padding: 14px 40px 14px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-steel-2);
  border-left: 2px solid var(--c-red);
  box-shadow: 0 16px 40px rgba(0,0,0,.65);
  color: var(--c-bone);
  font-size: 15.5px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  animation: nlc-rise .28s ease both;
}
.nlc-tease[hidden] { display: none; }
.nlc-tease b { display: block; font-family: 'Archivo Black', sans-serif; font-weight: 400; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 3px; }
.nlc-tease-x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; background: transparent; border: 0; color: var(--c-ash); font-size: 18px; line-height: 1; cursor: pointer; }
.nlc-tease-x:hover { color: var(--c-red); }

/* ---------- panel ---------- */
.nlc {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  width: min(400px, calc(100vw - 32px));
  height: min(640px, calc(100dvh - 32px));
  background: var(--c-asphalt);
  border: 1px solid var(--c-steel-2);
  box-shadow: 0 30px 80px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.6);
  color: var(--c-bone);
  animation: nlc-rise .24s ease both;
}
.nlc[hidden] { display: none; }
@keyframes nlc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.nlc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  background: var(--c-surface);
  border-top: 2px solid var(--c-red);
  border-bottom: 1px solid var(--c-steel);
}
.nlc-head img { width: 38px; height: 38px; flex: none; }
.nlc-head div { flex: 1; min-width: 0; }
.nlc-head b { display: block; font-family: 'Archivo Black', sans-serif; font-weight: 400; font-size: 16px; letter-spacing: -0.01em; text-transform: uppercase; line-height: 1.1; }
.nlc-head b i { font-style: normal; color: var(--c-red); }
.nlc-head span { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-ash); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nlc-head span::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c-red); box-shadow: 0 0 0 0 rgba(225,6,0,.6); animation: nlc-pulse 2.4s ease-out infinite; }
@keyframes nlc-pulse { 70% { box-shadow: 0 0 0 7px rgba(225,6,0,0); } 100% { box-shadow: 0 0 0 0 rgba(225,6,0,0); } }
.nlc-x { flex: none; width: 44px; height: 44px; background: transparent; border: 0; color: var(--c-ash); font-size: 24px; line-height: 1; cursor: pointer; }
.nlc-x:hover { color: var(--c-red); }

.nlc-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--c-steel-2) transparent;
}
.nlc-msg {
  max-width: 84%;
  padding: 11px 14px;
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: nlc-pop .2s ease both;
}
@keyframes nlc-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.nlc-msg.shop { align-self: flex-start; background: var(--c-surface); border: 1px solid var(--c-steel-2); border-left: 2px solid var(--c-red); }
.nlc-msg.me { align-self: flex-end; background: var(--c-red); color: #fff; }
.nlc-msg.me + .nlc-msg.shop, .nlc-msg.shop + .nlc-msg.me { margin-top: 6px; }
.nlc-typing { align-self: flex-start; display: flex; gap: 5px; padding: 15px 16px; background: var(--c-surface); border: 1px solid var(--c-steel-2); border-left: 2px solid var(--c-red); }
.nlc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ash); animation: nlc-blink 1.1s infinite ease-in-out; }
.nlc-typing i:nth-child(2) { animation-delay: .15s; }
.nlc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes nlc-blink { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

/* quick replies + next-step actions */
.nlc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 16px 12px; }
.nlc-chips:empty { display: none; }
.nlc-chip {
  appearance: none;
  padding: 10px 14px;
  background: var(--c-ink);
  border: 1px solid var(--c-steel-2);
  color: var(--c-bone);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
  animation: nlc-pop .2s ease both;
}
.nlc-chip:hover { border-color: var(--c-red); color: #fff; }
.nlc-chip.go { background: var(--c-red); border-color: var(--c-red); color: #fff; font-family: 'Archivo Black', sans-serif; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; padding: 12px 14px; }
.nlc-chip.go:hover { background: var(--c-red-hot); border-color: var(--c-red-hot); }
/* something is in flight: chips ignore taps until it finishes, so dim them */
.nlc-busy .nlc-chip { opacity: .55; cursor: progress; }

/* day picker: one swipeable row instead of a tall wrap; Cancel sits below it */
.nlc-days { display: flex; gap: 8px; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nlc-days::-webkit-scrollbar { display: none; }
.nlc-days .nlc-chip { flex: none; }
/* photos the customer attached */
.nlc-msg.nlc-photos { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; max-width: 84%; }
.nlc-photos img { width: 72px; height: 72px; object-fit: cover; display: block; }
.nlc-file { display: none; }
/* vehicle picker in the chat (vehicle.js) */
.nlc-veh { width: 100%; display: grid; gap: 8px; animation: nlc-pop .2s ease both; }
.nlc-veh .vp { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 8px; }
.nlc-veh .vp-model, .nlc-veh .vp-text, .nlc-veh .vp-note { grid-column: 1 / -1; }
.nlc-veh select, .nlc-veh input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 34px 0 12px;
  background: var(--c-ink);
  border: 1px solid var(--c-steel-2);
  border-radius: 0;
  color: var(--c-bone);
  font: inherit;
  font-size: 16px;
  outline: none;
}
.nlc-veh input { padding-right: 12px; }
.nlc-veh select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b8b8b8' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color-scheme: dark;
  cursor: pointer;
}
.nlc-veh select:disabled { opacity: .45; cursor: not-allowed; }
.nlc-veh select:focus, .nlc-veh input:focus { border-color: var(--c-red); }
.nlc-veh select[hidden], .nlc-veh input[hidden], .nlc-veh .vp-note[hidden] { display: none; }
.nlc-veh .vp-note { margin: 0; font-size: 13.5px; color: var(--c-ash); }
.nlc-veh-row { display: flex; flex-wrap: wrap; gap: 8px; }
.nlc-veh .nlc-chip.go:disabled { opacity: .45; cursor: not-allowed; }

.nlc-form { display: flex; gap: 8px; padding: 12px 12px 10px 16px; background: var(--c-surface); border-top: 1px solid var(--c-steel); }
.nlc-form input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  background: var(--c-ink);
  border: 1px solid var(--c-steel-2);
  color: var(--c-bone);
  font: inherit;
  font-size: 16px;   /* 16px stops iOS zooming the page on focus */
  outline: none;
  border-radius: 0;
  transition: border-color .15s ease;
}
.nlc-form input[hidden] { display: none; }
.nlc-form input:focus { border-color: var(--c-red); }
.nlc-send {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--c-red);
  border: 1px solid var(--c-red);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.nlc-send:hover { background: var(--c-red-hot); }
.nlc-send[disabled] { opacity: .5; cursor: default; }
.nlc-foot { margin: 0; padding: 0 16px calc(10px + env(safe-area-inset-bottom)); background: var(--c-surface); font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-ash); }

/* ---------- phones: full-screen, sized to the visible area above the keyboard ---------- */
@media (max-width: 560px) {
  .nlc {
    left: 0;
    right: 0;
    top: var(--nlc-top, 0px);
    bottom: auto;
    width: 100%;
    height: var(--nlc-h, 100dvh);
    border: 0;
    animation-name: nlc-sheet;
  }
  @keyframes nlc-sheet { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .nlc-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  html.nlc-lock, html.nlc-lock body { overflow: hidden; }
  .nlc-launch { height: 52px; padding: 0 16px 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .nlc, .nlc-msg, .nlc-chip, .nlc-tease { animation: none; }
  .nlc-typing i, .nlc-head span::before { animation: none; }
  .nlc-launch { transition: none; }
}
