/* The finder's AI advisor (assets/chat.js). Uses the page's colours, fonts and buttons from styles.css. */

/* Floating button: above WhatsApp, in the same corner. */
.nc-fab {
  position: fixed; bottom: 92px; inset-inline-end: 22px; z-index: 27;
  display: flex; flex-direction: row-reverse; align-items: center; gap: 8px;
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; font-family: var(--font);
}
.nc-fab-icon {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; flex: none;
  background: var(--ink); box-shadow: 0 10px 30px rgba(17,24,39,.4); transition: background .15s;
}
.nc-fab-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linejoin: round; }
.nc-fab-icon .spark { fill: var(--gold); stroke: none; }
.nc-fab-label { background: #fff; font-weight: 700; font-size: .84rem; padding: 8px 14px; border-radius: 999px; box-shadow: 0 4px 16px rgba(17,24,39,.18); white-space: nowrap; }
.nc-fab:hover .nc-fab-icon { background: #1f2937; }
.nc-open .nc-fab { display: none; }

/* Panel */
.nc-panel {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 35;
  width: min(410px, calc(100vw - 44px)); height: min(680px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  border-radius: 20px; box-shadow: 0 30px 80px rgba(17,24,39,.35);
  animation: nc-in .25s ease-out;
}
.nc-panel[hidden] { display: none; }
@keyframes nc-in { from { transform: translateY(16px); opacity: 0; } }

.nc-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; background: var(--ink); color: #fff; flex: none; }
.nc-panel[dir="rtl"] .nc-head { padding: 12px 16px 12px 12px; }
.nc-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--gold); flex: none; }
.nc-avatar svg { width: 22px; height: 22px; fill: var(--ink); }
.nc-titles { flex: 1; min-width: 0; }
.nc-head h2 { font-size: 1rem; font-weight: 700; }
.nc-sub { margin: 1px 0 0; font-size: .76rem; color: #cbd5e1; }
.nc-head .icon-btn { width: 36px; height: 36px; font-size: 1.3rem; background: rgba(255,255,255,.12); color: #fff; flex: none; }
.nc-head .icon-btn:hover { background: rgba(255,255,255,.22); }
.nc-restart { font-size: 1.1rem !important; }

.nc-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.nc-msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.nc-bot { align-self: flex-start; background: var(--surface); box-shadow: var(--shadow); border-end-start-radius: 4px; }
.nc-user { align-self: flex-end; background: var(--ink); color: #fff; border-end-end-radius: 4px; white-space: pre-wrap; }
.nc-ai { border-inline-start: 3px solid var(--gold); }
.nc-ai p { margin: 0 0 6px; }
.nc-ai p:last-child, .nc-ai ul:last-child { margin-bottom: 0; }
.nc-ai ul { margin: 0 0 6px; padding-inline-start: 18px; }
.nc-ai li { margin: 0 0 4px; }

.nc-typing { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.nc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-2); animation: nc-dot 1s infinite ease-in-out; }
.nc-typing span:nth-child(2) { animation-delay: .15s; }
.nc-typing span:nth-child(3) { animation-delay: .3s; }
.nc-typing em { font-style: normal; font-size: .82rem; margin-inline-start: 6px; }
@keyframes nc-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Project cards */
.nc-cards { display: flex; flex-direction: column; gap: 10px; }
.nc-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: grid; grid-template-columns: 92px minmax(0, 1fr); grid-template-areas: "img body" "money money" "actions actions";
}
.nc-card img { grid-area: img; width: 92px; height: 100%; min-height: 92px; object-fit: cover; background: #e5e7eb; }
.nc-card-body { grid-area: body; padding: 10px 12px; min-width: 0; }
.nc-card-price { margin: 0; font-weight: 700; font-size: .92rem; }
.nc-card-price small { font-weight: 500; color: var(--muted); font-size: .74rem; }
.nc-card h4 { margin: 2px 0; font-family: var(--font-display); font-weight: 400; font-size: 1.12rem; line-height: 1.2; }
.nc-panel[dir="rtl"] .nc-card h4 { font-family: "DM Serif Display", var(--font); }
.nc-card h4 button { all: unset; cursor: pointer; }
.nc-card h4 button:hover { text-decoration: underline; text-underline-offset: 3px; }
.nc-card h4 button:focus-visible { outline: 3px solid var(--gold-2); }
.nc-card-meta { margin: 0 0 6px; color: var(--muted); font-size: .8rem; }
.nc-card .badge { display: inline-block; font-size: .72rem; }
.nc-card-money { grid-area: money; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0 10px; }
.nc-card-money div { background: var(--gold-soft); border-radius: 10px; padding: 7px 8px; min-width: 0; }
.nc-card-money dt { font-size: .68rem; color: var(--ink-2); }
.nc-card-money dd { margin: 0; font-size: .8rem; font-weight: 700; overflow-wrap: anywhere; }
.nc-card-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 12px 10px; }
.nc-save {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .8rem; font-weight: 600; cursor: pointer;
}
.nc-save svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 2; }
.nc-save.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.nc-save.on svg { fill: var(--gold); stroke: var(--gold); }
.nc-link { background: none; border: 0; padding: 0; min-height: 34px; display: inline-flex; align-items: center; font-size: .82rem; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Answers and actions */
.nc-controls { flex: none; padding: 4px 14px 8px; max-height: 45%; overflow-y: auto; }
.nc-controls:empty { display: none; }
.nc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nc-chip {
  border: 1.5px solid var(--gold-2); background: #fff; color: var(--ink); border-radius: 999px;
  min-height: 38px; padding: 6px 14px; font-size: .86rem; font-weight: 600; cursor: pointer; text-align: start;
}
.nc-chip:hover { background: var(--gold-soft); }
.nc-mini { display: flex; align-items: center; gap: 6px; margin-top: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.nc-mini:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(233,196,106,.35); }
.nc-mini-cur { padding-inline-start: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.nc-mini input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; padding: 6px 8px; }
.nc-mini[data-mini="amount"] input { direction: ltr; text-align: start; }
.nc-notice { margin: 8px 0 0; font-size: .82rem; color: var(--amber); }
.nc-handoff { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.nc-log .nc-handoff { margin-top: 0; }
.nc-handoff .btn { white-space: normal; text-align: center; line-height: 1.25; padding-block: 6px; }
.nc-handoff .btn-outline { background: #fff; }

/* Typing a question */
.nc-input { flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; background: #fff; border: 1px solid var(--line); border-radius: 22px; }
.nc-panel[dir="rtl"] .nc-input { padding: 6px 14px 6px 6px; }
.nc-input:focus-within { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(233,196,106,.35); }
.nc-input textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; font: inherit; font-size: 16px; line-height: 1.4; padding: 6px 0; max-height: 120px; }
.nc-send { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--gold); cursor: pointer; flex: none; }
.nc-send:hover { background: var(--gold-2); }
.nc-send svg { width: 18px; height: 18px; fill: var(--ink); }
.nc-panel[dir="rtl"] .nc-send svg { transform: scaleX(-1); }
.nc-foot { flex: none; margin: 6px 14px 10px; font-size: .7rem; color: var(--muted); text-align: center; }

/* Phones: the chat fills the screen, and the button drops its label. */
@media (max-width: 640px) {
  .nc-fab-label { display: none; }
  .nc-fab { bottom: 90px; inset-inline-end: 22px; }
  .nc-fab-icon { width: 54px; height: 54px; }
  /* The "Free consultation" box spans the screen there; the chat button waits until it is closed. */
  #ctaTeaser:not([hidden]) ~ .nc-fab { display: none; }
  .nc-panel {
    inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.nc-open { overflow: hidden; }
  .nc-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  .nc-panel { animation: none; }
  .nc-typing span { animation: none; opacity: .7; }
}
