/* widget.css — Nathen chat widget styles
   CSS custom properties (--c1, --c2 etc.) are set by a <style> block
   in index.html that only contains the :root declaration.
   Everything else lives here — no Jinja, no template syntax. */

/* ── Embed info page ── */
.page { max-width: 560px; margin: 0 auto; padding: 64px 28px 100px; text-align: center; }
.page h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--c2), var(--c1) 55%, #b47fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
  margin-bottom: 12px;
}
.page p { color: var(--ts); font-size: .92rem; line-height: 1.75; max-width: 420px; margin: 0 auto 28px; }
.embed-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; text-align: left; }
.embed-card h3 {
  font-family: 'Sora', sans-serif; font-size: .76rem; font-weight: 600; color: var(--ts);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 9px;
}
.embed-code {
  background: var(--bg); border: 1px solid #1a1e2c; border-radius: 8px;
  padding: 11px 13px; font-family: 'Courier New', monospace; font-size: .71rem;
  color: var(--c2); white-space: pre; overflow-x: auto; line-height: 1.7;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 13px;
  border-radius: 7px; border: 1px solid #1c2030; background: var(--lift); color: var(--ts);
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: .76rem;
  margin-top: 8px; transition: all .2s;
}
.copy-btn:hover { border-color: var(--c1); color: var(--c1); }

/* ── Widget root ── */
#nathen {
  position: fixed; bottom: 26px; right: 0;
  z-index: 99999; font-family: 'DM Sans', sans-serif; font-size: 14px;
  /* Wide enough for the pill launcher; height just anchors bottom */
  width: 210px; height: 67px;
}

/* Teaser bubble — dark background matching second reference image */
.n-teaser {
  position: absolute; bottom: 72px; right: 0;
  background: #18192a;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px 18px 18px 4px; padding: 14px 18px;
  font-size: .84rem; white-space: nowrap; cursor: pointer;
  color: #e8eaf6;
  box-shadow: 0 10px 32px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(8px) scale(.95);
  transition: all .38s cubic-bezier(.34, 1.56, .64, 1); pointer-events: none;
  max-width: 220px; white-space: normal;
}
.n-teaser.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }
.n-teaser strong { color: #60a5fa; font-weight: 700; }

/* Launcher — pill button */
.n-launcher {
  /* Pill shape — wide enough for avatar + text */
  width: auto; height: 67px;
  border-radius: 100px;
  border: none; cursor: pointer;
  background: #2563eb;
  box-shadow: 0 6px 28px rgba(37,99,235,.45);
  display: flex; align-items: center; gap: 10px;
  padding: 6px 18px 6px 7px;
  position: relative;
  transition: transform .25s, box-shadow .25s, background .2s;
  white-space: nowrap;
}
.n-launcher:hover {
  transform: scale(1.04);
  box-shadow: 0 10px 36px rgba(37,99,235,.6);
  background: #1d4fd8;
}

/* Avatar inside launcher */
.n-launcher .n-launch-av {
  width: 42px; height: 42px; border-radius: 50%; overflow: visible; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
  position: relative;
}
.n-launcher .n-launch-av img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
  overflow: hidden;
}
/* Chat-bubble badge — top-center, outside the circle */
/* .n-launcher .n-launch-av::after {
  content: '\1F4AC';
  position: absolute; top: -10px; left: 100%; transform: translateX(-50%);
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #2563eb;
  line-height: 1;
  padding-top: 1px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
} */

/* Text next to avatar */
.n-launcher .n-launch-txt {
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25;
}
.n-launcher .n-launch-txt span:first-child {
  font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: .88rem; color: #fff;
}
.n-launcher .n-launch-txt span:last-child {
  font-family: 'DM Sans', sans-serif; font-weight: 400; font-size: .78rem; color: rgba(255,255,255,.82);
}

/* Legacy badge — hidden, we use the new style */
.n-badge { display: none !important; }

/* ── Chat window (desktop / tablet default) ── */
.n-window {
  position: absolute; bottom: 74px; right: 47px; width: 374px;
  height: min(582px, calc(100vh - 110px));
  /* Dark radial gradient background like the reference */
  background: radial-gradient(ellipse at 20% 0%, #2a1a3e 0%, #111220 50%, #09090f 100%);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.06);
  display: flex; flex-direction: column; overflow: hidden; position: absolute;
  transform: scale(.88) translateY(18px); opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .24s ease, visibility 0s .32s;
}
.n-window.open {
  transform: scale(1) translateY(0); opacity: 1; pointer-events: all; visibility: visible;
  transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .24s ease, visibility 0s 0s;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE  (≤ 480 px)
   nathen.js expands the iframe to (70% vw + 26) × (70% vh + 102)
   anchored at right:0 / bottom:0.  Inside that iframe 100vw/100vh
   map to those pixel values, so the window fills it exactly.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  .n-teaser {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.95);
    transition: all 0.3s ease;
  }
  .n-teaser.show {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
  }

  /* 70% panel — same position anchor as desktop, fills the resized iframe */
  .n-window {
    position: absolute;
    bottom: 76px; right: 0;
    left: auto; top: auto;
    width: calc(100vw - 26px);   /* = 70% of parent viewport width  */
    height: calc(100vh - 102px); /* = 70% of parent viewport height */
    border-radius: 16px;
    z-index: auto;
    transform: scale(.88) translateY(18px);
    transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .24s ease, visibility 0s .32s;
  }
  .n-window.open {
    transform: scale(1) translateY(0);
    transition: transform .32s cubic-bezier(.34,1.56,.64,1), opacity .24s ease, visibility 0s 0s;
  }
}

/* ── Header ── */
.n-head {
  display: flex; align-items: center; gap: 11px; padding: 14px 15px 13px;
  background: rgba(37,99,235,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.n-av {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
}
.n-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.n-meta { flex: 1; min-width: 0; }
.n-name {
  font-family: 'Sora', sans-serif; font-weight: 600; font-size: .9rem;
  color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.n-status { display: flex; align-items: center; gap: 5px; font-size: .68rem; color: rgba(255,255,255,.75); margin-top: 2px; }
.n-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; animation: n-blink 2.2s infinite; }
@keyframes n-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.n-close {
  width: 29px; height: 29px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.18); color: #fff; cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s; flex-shrink: 0;
}
.n-close:hover { background: rgba(255,255,255,.3); }

/* ── Messages ── */
.n-msgs {
  flex: 1; overflow-y: auto; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #13161f;
}
.n-msgs::-webkit-scrollbar { width: 3px; }
.n-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.msg { display: flex; align-items: flex-end; gap: 8px; animation: n-slideUp .28s ease; }
@keyframes n-slideUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* Bot message: bubble on the left, NO inline avatar (avatar floats outside) */
.msg.b { flex-direction: row; align-items: flex-end; }
/* Hide the inline bot avatar — the floating avatar is rendered separately */
.msg.b .msg-av { display: none; }

/* User message: bubble on the right */
.msg.u { flex-direction: row-reverse; }
.msg-av {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center;
  font-size: .6rem; color: rgba(255,255,255,.6); font-weight: 600;
}
.msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-body { max-width: 82%; }

/* Bot bubble — white pill, like reference */
.bubble { padding: 11px 15px; font-size: .85rem; line-height: 1.6; border-radius: 20px; }
.msg.b .bubble {
  background: #fff;
  color: #111;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
}

/* Highlight bot name in blue (first word) handled via JS — fallback plain */
.msg.b .bubble .bot-name { color: #2563eb; font-weight: 700; }

/* User bubble */
.msg.u .bubble {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #e8f0fe;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(37,99,235,.35);
}

.msg-ts { font-size: .62rem; color: rgba(255,255,255,.35); margin-top: 4px; display: block; }
.msg.u .msg-ts { text-align: right; }
.msg.b .msg-ts { text-align: left; }

/* ── Floating bot avatar (bottom-right of chat window) ── */
.n-float-av {
  position: absolute;
  bottom: 54px; right: 10px;
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden;
  border: 2.5px solid rgba(255,255,255,.25);
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  pointer-events: none;
  z-index: 5;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.n-float-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Bounce in when chat opens */
.n-window.open .n-float-av { transform: scale(1); }
.n-float-av { transform: scale(0); }

/* Typing dots */
#typing-row { display: none; }
#typing-row.show { display: flex; }
.typing-dots { display: flex; gap: 4px; align-items: center; padding: 11px 14px; }
.td { width: 6px; height: 6px; border-radius: 50%; background: var(--c1); animation: n-bounce 1.1s infinite; }
.td:nth-child(2) { animation-delay: .18s; }
.td:nth-child(3) { animation-delay: .36s; }
@keyframes n-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Decision tree option chips */
.opts-group { display: flex; flex-direction: column; gap: 6px; padding: 0 12px 8px 45px; animation: n-slideUp .3s ease; }
.opt-btn {
  padding: 8px 13px; border-radius: 20px; border: 1px solid #1e2535;
  background: var(--bg); color: var(--ts); font-family: 'DM Sans', sans-serif;
  font-size: .79rem; cursor: pointer; text-align: left; transition: all .18s; line-height: 1.45;
}
.opt-btn:hover { border-color: var(--c1); color: var(--c1); background: rgba(91,184,255,.07); }
.opt-btn.sel { border-color: var(--c1); color: var(--c1); background: rgba(91,184,255,.1); opacity: .55; cursor: default; }

/* Seed chips */
.seed-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 9px; background: #13161f; }
.seed-chip {
  padding: 6px 11px; border-radius: 20px; border: 1px solid #1e2535;
  background: var(--bg); color: var(--ts); font-size: .76rem; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all .18s;
}
.seed-chip:hover { border-color: var(--c1); color: var(--c1); }
.seed-loading { font-size: .72rem; color: var(--tm); padding: 4px 8px; animation: n-fade 1.4s ease-in-out infinite; }
@keyframes n-fade { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* Input bar */
.n-bar {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
  background: #13161f;
  backdrop-filter: blur(6px);
}
.n-input {
  flex: 1;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px;
  padding: 10px 15px;
  color: #e8eaf6;
  font-family: 'DM Sans', sans-serif; font-size: .84rem;
  outline: none; resize: none; max-height: 94px; line-height: 1.45;
  transition: border-color .2s, background .2s;
}
.n-input:focus { border-color: #2563eb; background: rgba(255,255,255,.1); }
.n-input::placeholder { color: rgba(255,255,255,.3); }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; flex-shrink: 0;
  background: #2563eb;
  color: #fff; font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 3px 12px rgba(37,99,235,.5);
}
.send-btn:hover { transform: scale(1.1); box-shadow: 0 5px 18px rgba(37,99,235,.7); }
.send-btn:disabled { opacity: .28; cursor: default; transform: none; box-shadow: none; }
.n-foot { text-align: center; font-size: .62rem; color: var(--tm); padding: 5px 0 2px; flex-shrink: 0; }

/* ── Widget position variants (desktop) ── */

/* bottom-left */
#nathen.n-pos-bottom-left { right: auto; left: 26px; }
#nathen.n-pos-bottom-left .n-teaser { right: auto; left: 0; border-radius: 16px 16px 16px 4px; }
#nathen.n-pos-bottom-left .n-window { right: auto; left: 0; }

/* bottom-center */
#nathen.n-pos-bottom-center { right: auto; left: 50%; transform: translateX(-50%); }
#nathen.n-pos-bottom-center .n-teaser {
  right: auto; left: 50%; border-radius: 16px;
  transform: translateX(-50%) translateY(8px) scale(.95);
}
#nathen.n-pos-bottom-center .n-teaser.show { transform: translateX(-50%) translateY(0) scale(1); }
#nathen.n-pos-bottom-center .n-window {
  right: auto; left: 50%;
  transform: translateX(-50%) scale(.88) translateY(18px);
}
#nathen.n-pos-bottom-center .n-window.open { transform: translateX(-50%) scale(1) translateY(0); }

/* top-right */
#nathen.n-pos-top-right { bottom: auto; top: 26px; }
#nathen.n-pos-top-right .n-teaser {
  bottom: auto; top: 78px; border-radius: 4px 16px 16px 16px;
  transform: translateY(-8px) scale(.95);
}
#nathen.n-pos-top-right .n-teaser.show { transform: translateY(0) scale(1); }
#nathen.n-pos-top-right .n-window { bottom: auto; top: 76px; transform: scale(.88) translateY(-18px); }
#nathen.n-pos-top-right .n-window.open { transform: scale(1) translateY(0); }

/* top-left */
#nathen.n-pos-top-left { bottom: auto; top: 26px; right: auto; left: 26px; }
#nathen.n-pos-top-left .n-teaser {
  bottom: auto; top: 78px; right: auto; left: 0; border-radius: 16px 4px 16px 16px;
  transform: translateY(-8px) scale(.95);
}
#nathen.n-pos-top-left .n-teaser.show { transform: translateY(0) scale(1); }
#nathen.n-pos-top-left .n-window { bottom: auto; top: 76px; right: auto; left: 0; transform: scale(.88) translateY(-18px); }
#nathen.n-pos-top-left .n-window.open { transform: scale(1) translateY(0); }

/* top-center */
#nathen.n-pos-top-center { bottom: auto; top: 26px; right: auto; left: 50%; transform: translateX(-50%); }
#nathen.n-pos-top-center .n-teaser {
  bottom: auto; top: 78px; right: auto; left: 50%; border-radius: 16px;
  transform: translateX(-50%) translateY(-8px) scale(.95);
}
#nathen.n-pos-top-center .n-teaser.show { transform: translateX(-50%) translateY(0) scale(1); }
#nathen.n-pos-top-center .n-window {
  bottom: auto; top: 76px; right: auto; left: 50%;
  transform: translateX(-50%) scale(.88) translateY(-18px);
}
#nathen.n-pos-top-center .n-window.open { transform: translateX(-50%) scale(1) translateY(0); }

/* ── Drag-to-reposition ── */
.n-launcher { cursor: grab; }
.n-launcher:active { cursor: grabbing; }

/* While dragging: kill transitions so the button tracks instantly */
#nathen.n-dragging,
#nathen.n-dragging .n-window,
#nathen.n-dragging .n-teaser { transition: none !important; }

/* Drag-quadrant classes — control which direction the window pops */
#nathen.n-quad-bl .n-teaser { right: auto; left: 0; border-radius: 16px 16px 16px 4px; }
#nathen.n-quad-bl .n-window { right: auto; left: 0; }

#nathen.n-quad-tr .n-teaser {
  bottom: auto; top: 78px;
  border-radius: 4px 16px 16px 16px;
  transform: translateY(-8px) scale(.95);
}
#nathen.n-quad-tr .n-teaser.show { transform: translateY(0) scale(1); }
#nathen.n-quad-tr .n-window    { bottom: auto; top: 76px; transform: scale(.88) translateY(-18px); }
#nathen.n-quad-tr .n-window.open { transform: scale(1) translateY(0); }

#nathen.n-quad-tl .n-teaser {
  bottom: auto; top: 78px; right: auto; left: 0;
  border-radius: 16px 4px 16px 16px;
  transform: translateY(-8px) scale(.95);
}
#nathen.n-quad-tl .n-teaser.show { transform: translateY(0) scale(1); }
#nathen.n-quad-tl .n-window    { bottom: auto; top: 76px; right: auto; left: 0; transform: scale(.88) translateY(-18px); }
#nathen.n-quad-tl .n-window.open { transform: scale(1) translateY(0); }

/* ── Iframe: transparent background, hide scrollbar without clipping fixed children ── */
html, body {
  background: transparent !important;
  margin: 0;
  padding: 0;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE / Edge */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; } /* Chrome / Safari */

/* ── Close widget button ── */
#n-close-widget {
  position: absolute;
  top: -8px; right: 0;
  width: 27px; height: 27px; border-radius: 50%;
  border: 2px solid #fff; background: #e53935; color: #fff;
  font-size: 10px; font-weight: 700; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  padding: 0; line-height: 1; z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transition: transform .15s, background .15s;
}
#n-launcher:hover #n-close-widget { display: flex; }
#n-close-widget:hover { transform: scale(1.15); background: #c62828; }


/* Launcher needs overflow:visible so badge can show outside */
.n-launcher { overflow: visible !important; }
